• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Zanman777

Already know C++ - where to learn game programming?

16 posts in this topic

Hello! I already know C++ (well, at least the most important parts of it, up to classes and such), and now I'd like to start making simple games to learn the basic concepts of game programming. The problem is 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, how to implement the game loop... What I mean is I need guidance on the most pragmatic side of game programming. C++ books/tutorials tend to focus on singlefile coding for pedagogical reasons, so I'm a bit unfamiliar with those multifile techniques...

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?
0

Share this post


Link to post
Share on other sites
In order to get started I'd recommend using a widespread and well documented framework such as SDL (short for "Simple Directmedia Layer"). It's free to use and saves you all the tedious work associated with initializing a client window, setting up a graphics device etc.

Here's a step by step guide on creating games with SDL
[url="http://www.sdltutorials.com/sdl-tutorial-basics"]http://www.sdltutori...tutorial-basics[/url]

and the actual homepage of SDL
[url="http://www.libsdl.org/"]http://www.libsdl.org/[/url] Edited by papulko
1

Share this post


Link to post
Share on other sites
Please try this site .. it shows you how to use SDL starting from the basics, and it has exmples : Pong , Tetris and Breakout

[url="http://www.aaroncox.net/tutorials/arcade/index.html"]http://www.aaroncox.net/tutorials/arcade/index.html[/url]
0

Share this post


Link to post
Share on other sites
[quote name='alnite' timestamp='1352424652' post='4999095']
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
[/quote]
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.
2

Share this post


Link to post
Share on other sites
Hi,

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
1

Share this post


Link to post
Share on other sites
I would advice you to read book "Game coding complete" which describes very well game architecture, but it is not for total beginners.
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.
0

Share this post


Link to post
Share on other sites
[quote name='teccubus' timestamp='1352447841' post='4999180']
If you want to see how particular game is built, check out, for example, Doom3 source code (available for free at web).
[/quote]
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.
0

Share this post


Link to post
Share on other sites
I think u should try learning native Windows api before choosing a game engine or DirectX (Engine Developing).
-1

Share this post


Link to post
Share on other sites
The design of a game depends on your own style and thought process. Some games such as pong may be more trivial(paddles are a class and the ball is a class) while other things such as complete game engines may require more work. In my opinion, it boils down to just looking at the concept for a game you thought up and analyzing it to find the best way to put it together. I would suggest starting with pong and SDL like other people have mentioned and work your way up from there.
0

Share this post


Link to post
Share on other sites
My advice would be this...

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
1

Share this post


Link to post
Share on other sites
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!
0

Share this post


Link to post
Share on other sites
[quote name='papulko' timestamp='1352719073' post='5000191']
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!
[/quote]


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.
0

Share this post


Link to post
Share on other sites
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! ([url="http://en.wikipedia.org/wiki/Usage_share_of_operating_systems#cite_note-wikimedia-stats-1"]http://en.wikipedia.org/wiki/Usage_share_of_operating_systems#cite_note-wikimedia-stats-1[/url])
0

Share this post


Link to post
Share on other sites
[quote name='papulko' timestamp='1352741776' post='5000279']
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! ([url="http://en.wikipedia.org/wiki/Usage_share_of_operating_systems#cite_note-wikimedia-stats-1"]http://en.wikipedia....kimedia-stats-1[/url])
[/quote]

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(tm)".

If you really want to look at app development using C++, look in to Qt.
2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0