#1 Members - Reputation: 116
Posted 08 November 2012 - 12:26 PM
I've tried to look at open source games to find a "pattern", but it seems each programmer uses his own method and I end up even more confused.
I read somewhere (can't remember the site) that a good checklist of games to make is:
Tetris - basic input/output, game loop, collision detection
Breakout - some physic primers
Pacman - AI implementation
Mario - Level creation, storage and reading
But I can't find a good Tetris tutorial to begin with. I need to know the common method and logistics to program any game!
Can anybody help me?
#2 Members - Reputation: 445
Posted 08 November 2012 - 02:11 PM
Here's a step by step guide on creating games with SDL
http://www.sdltutori...tutorial-basics
and the actual homepage of SDL
http://www.libsdl.org/
Edited by papulko, 08 November 2012 - 02:12 PM.
#3 Staff - Reputation: 8924
Posted 08 November 2012 - 06:32 PM
Those aren't game-specific topics, but you might try organizing code files in C and C++.I can't find a place to learn how a game is broken down into several source files, how to organise classes amongst the several source files, the logic of header/source file,
Try deWiTTERS game loop and fix your timestep.how to implement the game loop
That's a pretty good check-list, but I would recommend starting with Pong rather than Tetris. Both are relatively simple games that feature much of the functionality found in larger, more complex games, but the block logic in Tetris can be a bit complex for a beginner's first game and isn't something that is likely to continue to be useful unless you're making a very similar game.I read somewhere (can't remember the site) that a good checklist of games to make is [...]
Like the above member, I would also recommend choosing an API such as SDL, SFML or Allegro and working on some basic games.
There's also Lazy Foo's SDL Tutorials.Here's a step by step guide on creating games with SDL
http://www.sdltutori...tutorial-basics
Hope that's helpful!
- Jason Astle-Adams.
From my blog: 20 ways to advertise your game | What next? Intermediate to advanced C++
How to make games WITHOUT programming | 4 reasons you aren't a successful indie developer
#4 Members - Reputation: 1436
Posted 08 November 2012 - 07:30 PM
Once you familiarized yourself with the API, then you can start working on the core of the game. There isn't any 'de facto' Tetris tutorial, as there's no one correct way of making a Tetris (or anything else really). How you make it is up to you. Other people's source code should be good as points of reference. Here's one: http://code.google.c...e-tetris-clone/
As a beginner, I wouldn't suggest trying too much organizing your code. Your lack of experience will probably backfire -- chose the wrong patterns, premature optimizations, and all that. Do it as best as you can, but the most important thing is to actually complete your game. After you complete your game, your knowledge of project structure will skyrocket, and you'd know how to do it better next time.
#5 Members - Reputation: 159
Posted 08 November 2012 - 08:39 PM
http://www.aaroncox.net/tutorials/arcade/index.html
#6 Staff - Reputation: 8924
Posted 08 November 2012 - 09:25 PM
This is really invaluable advice. Do your best with what you already know, but don't worry too much about applying things you haven't previously used. Whilst there is value in reading about design patterns, code formatting, etc. you won't really understand a lot of these topics properly until you experience them first-hand. Write a game in any way you're able to make it work, and you'll learn a lot of lessons to improve future projects.As a beginner, I wouldn't suggest trying too much organizing your code. Your lack of experience will probably backfire -- chose the wrong patterns, premature optimizations, and all that. Do it as best as you can, but the most important thing is to actually complete your game
- Jason Astle-Adams.
From my blog: 20 ways to advertise your game | What next? Intermediate to advanced C++
How to make games WITHOUT programming | 4 reasons you aren't a successful indie developer
#7 Members - Reputation: 1413
Posted 09 November 2012 - 12:09 AM
The more I look into it, then the more that I see such an amazing variety of game structs. I know that you are looking for standard ways of doing things, but in view of all the endless kinds of games, there are few hard fixed standards in the coding because of the staggering variety of game designs, languages, technology, and needs. Much of the class structure, for example, is a matter of opinion, though there are ways of testing for performance. Considerations besides performance often dominate. Are you looking for formulas for coding success which apply across the board? You will find some.
Much of what you are asking will only be realized with hard work, experience, and deep ponder over a specific game.
Clinton
Edited by 3Ddreamer, 09 November 2012 - 12:31 PM.
#8 Members - Reputation: 311
Posted 09 November 2012 - 01:57 AM
If you want to see how particular game is built, check out, for example, Doom3 source code (available for free at web).
Of course building simple games is very different from pro gamedev. Try to not "overdesign" classes for breakout or tetris, as it will make most of your code redundant.
#9 Members - Reputation: 445
Posted 09 November 2012 - 04:08 AM
I haven't reviewed the source code of doom3 myself, but I would guess it's way too complex as a starting point when trying to learn the basics of game development.If you want to see how particular game is built, check out, for example, Doom3 source code (available for free at web).
#11 Staff - Reputation: 8924
Posted 10 November 2012 - 05:57 PM
- Jason Astle-Adams.
From my blog: 20 ways to advertise your game | What next? Intermediate to advanced C++
How to make games WITHOUT programming | 4 reasons you aren't a successful indie developer
#12 Members - Reputation: 108
Posted 11 November 2012 - 01:00 PM
#13 Members - Reputation: 497
Posted 11 November 2012 - 04:58 PM
1. Use C++ to create a command-line game. The logic here is to see what you can do with just the language on its own. Give it a title screen, main menu and then numbered-menu selections for the main game itself. It doesn't have to be fancy - just enough to enter keyboard text, load and save a game and to produce a game without the complications(distractions!) of learning APIs and generating art resources etc. My first command-line game was a turn-based RPG...it was a wonderful experience that taught me a great deal.
2. If you are using Windows, now go learn the Windows API. Your previous command-line effort will leave you hungry to put a simple image on the screen - the Windows API will allow you to make a more visual version with the added benefit of "point'n'click" with the mouse. In fact, the Windows API(using GDI+ or whatever it uses now) can allow you to make a simple action game such as pong or space invaders. I reckon one could even write a Ray-caster demo with WinAPI...possibly more. Its really a case of setting up a loop that runs on a timer, polling input from the keyboard & mouse, updating player/enemy positions etc, and then rendering...
3. With a sound grounding in both C++ and the Windows API, its time to consider two things - swatting up on your math skills, and learning a bit of software development. A bit of trig and algebra go a long way for those first few 2D games whilst software development will make you a more disciplined programmer. Your applications will have less bugs and your code will be clean and easy to understand...
...with all of this, games development will become a lot easier to understand. Take it from one who made just about every mistake under the sun when starting out...I would spare you that pain! o_O
#14 Members - Reputation: 445
Posted 12 November 2012 - 05:17 AM
Don't get me wrong, I would still encourage you to grab the bull by its balls at some time and make use the windows API directly. Just remember it might seem overwhelming at first!
#15 Members - Reputation: 3283
Posted 12 November 2012 - 09:01 AM
If you decide to go with the previous poster's recommendation and learn the Windows API at an early stage, be prepared to spend considerable time just trying to grasp the concept of it. This particular step is difficult, and may kill your motivation altogether. It may seem like a trivial task, but just initializing a client window literally means hundreds of lines of code in this case. To complicate things further, the windows API uses their own type definitions for variables, instead of "int", you get "DWORD" etc, making the code almost unreadable at first for someone coming from a "pure" c++ environment. The beauty of frameworks like SDL and SFML takes care of all this (among other things) for you.
Don't get me wrong, I would still encourage you to grab the bull by its balls at some time and make use the windows API directly. Just remember it might seem overwhelming at first!
That is a really bad idea.
Win32 is a right pain in the ass to learn, and...
It's dying. Microsoft is transitioning people to RT, basically you are doing the equivalent of learning Esperanto.
I mean, learning Win32 has some merit, especially in some more or less niche areas, but at this stage in your career, certainly not. Plus, my god does it teach bad practices.
#16 Members - Reputation: 445
Posted 12 November 2012 - 11:36 AM
However, unfortunately it's not dying. Despite Microsoft's recent efforts on Windows 8, Windows XP/Vista/7 are still by far the most used systems, and they will most probably remain to be over the next couple of years. For example, in September 2012, more than 21% of all desktops out there still ran under Windows XP! (http://en.wikipedia.org/wiki/Usage_share_of_operating_systems#cite_note-wikimedia-stats-1)
#17 Members - Reputation: 3283
Posted 12 November 2012 - 12:14 PM
I agree that the Windows API is a mess and teaches bad practice. My previous post was intended as a warning more than anything, where some of the API issues were highlighted.
However, unfortunately it's not dying. Despite Microsoft's recent efforts on Windows 8, Windows XP/Vista/7 are still by far the most used systems, and they will most probably remain to be over the next couple of years. For example, in September 2012, more than 21% of all desktops out there still ran under Windows XP! (http://en.wikipedia....kimedia-stats-1)
Yeah, but reality is, almost nobody is writing to the Win32 level anymore. You are right, the API will be with us for a very very very long time.
However, people are either using a higher level framework ( like Qt, used for example by Autodesk Maya ) especially if they want to write cross platform code. Otherwise people are targeting the .NET layer above Win32. Even game developers dont really work with Win32... they write a small shim layer and that's about it. This coincidentally, is a "very good thing".
If you really want to look at app development using C++, look in to Qt.






