• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Can I get some basic source code for a simpel game

RESmonkey

Diamond Member
I want to get an idea of how a simple game is structured. Nothing too complex, I'm noob at C++ and only know how to do nongraphical stuff.

 
There are a lot of tutorials out there for C++ and quite a few involve simple games. A little Google will go a long way.
 
Originally posted by: Markbnj
There are a lot of tutorials out there for C++ and quite a few involve simple games. A little Google will go a long way.

whats the point of having a forum if every time someone asks a question all anyone answers is "GOOGLE!"...
If you have something to answer for the man provide it... otherwise... dont waste a post... you have contributed nothing.
 
Originally posted by: sao123
Originally posted by: Markbnj
There are a lot of tutorials out there for C++ and quite a few involve simple games. A little Google will go a long way.

whats the point of having a forum if every time someone asks a question all anyone answers is "GOOGLE!"...
If you have something to answer for the man provide it... otherwise... dont waste a post... you have contributed nothing.

You're right, Mark should be posting thousands of lines of code into a forum post... :disgust:

Where is your helpful post? I don't see you answering his questions in your post. There's a time and place for using Google to get answers and for using a web forum to get answers. Coming onto a web forum for a "give me code to do this" is a bad way of doing it, especially for something that's not overly simple. People have to be willing to help themselves if they want others to help them.
 
On the flip side of the same issue - there is tons o' crap out there and sometimes you can do 10 searches using slightly different keywords and never quite find what you need and in those cases sometimes asking for help pointing you in the right direction is a good thing
 
whats the point of having a forum if every time someone asks a question all anyone answers is "GOOGLE!"...
If you have something to answer for the man provide it... otherwise... dont waste a post... you have contributed nothing.

Thanks for your input.
 
It might help if you tell us the OS, development tools, and graphics library (OpenGL, DirectX, ...?).

"game source code c++" does give 4+ million hits in Google but including the OS + development tools will narrow it down.

Windows: CodeProject.com has some, MSDN.Microsoft.com has some for the XNA cross platform library (PC + 360 + Zune (next version of XNA)).

There are a bunch of game programming books with source code, often with a simple 2D and/or 3D engine included.

www.Gamasutra.com -- poke around for code links
 
if you are just trying to do something real simple with a keyboard and dont need like real directinput and stuff, you might actually be better off searching for stuff on keyloggers.
 
I think you guys are taking it a bit TOO far. Games have a fairly simple structure with all things considered it is basically
Initialize program
-Initialize game engine
--Start Game Loop
--Wait for exit conditions
-Destroy Game engine.
Destroy program

The game loop is where all the magic happens, the rest is just a matter of implimentation.

One question to consider is "How often do I want to update?" If you are doing a text game then you update every time the user sends a command. If you are doing a 2d an up type game, then you update as fast as possible and use timers to calculate where to move things.

That is what makes turn based games fairly easy to do, because you just wait until a turn is up to do any processing, real time games are harder because you have to consider things like timing ect.

Hope this helps a bit
 
A turn-based game is a good idea for baby steps.

Google "wumpus c++" for the 60s classic Hunt the Wumpus.

For something real-time you could simulate the timer interrupts real games use by adding a sleep to your loop:

loop
- poll keyboard (get char without a wait if no press)
- move player
- move other
- if not game over, sleep() ; // 1 second is OK if that's all your sleep / Sleep allows, else 1/10 - 1/30 sec
end loop
 
Back
Top