What can help me transition from intermediate web OOP to game OOP
5 06 Jun 2015 07:48 by u/sec
I feel like I am hitting a road block in learning in web development. I have always wanted to get into C++ and make a game (maybe in web?) but for career purposes, I feel like having a solid grasp on C++ would be advantageous...However, I have no clue where to start. I am not talking about learning how to set variables, but like, how does a game function from an architectural point of view?
Any direction would be appreciated
6 comments
4 u/rwbj 06 Jun 2015 08:11
Haha, interesting. Coming from a game/application background this is such a strange question but I suppose it makes sense. I imagine the paradigm in web development is an infinite event driven system. Games are much more simple from an architectural (although generally vastly more complex from an implementation) point of view. It's just a state system with constant looping in the game itself.
The game loop itself is going to be made up of input querying, AI updating, physics updating, rendering, and so on. That is where the actual complexity comes in but from a broad architectural point of view games are trivial.
1 u/nitrixion 06 Jun 2015 09:32
While I agree with you for simple games, mobile games, stuff like Flappy Bird, more complex games like World of Warcraft, Hearthstone, or Civilization require and highly benefit from well thought out systems architecture. Having well defined and well built systems makes the inevitable iteration that much faster to implement. Building modular systems using standard design patterns makes adding content to the game a task to be done by content designers rather than engineers. Again, allowing for rapid iteration.
Apologies for the rambling. I work in games and we spend a LOT of time building well architected systems. We iterate on the game systems almost as much as we iterate on the interface or game mechanics.
All that said, to get back to the OPs question. Build a game! Try to build the underlying systems to be reusable. Then build another game and reuse those systems. Learn what kinds of assumptions you made wrong and what patterns you like. Rinse and repeat. I promise your first game will be a spagetti mess of code, but you will learn a lot. If you don't know OO concepts and design patterns well, start reading and exploring these concepts!
2 u/rwbj 06 Jun 2015 09:56
Any game regardless of complexity is going to have an identical basic architecture. Well at least any local game. Get into games where you're running a dependent client and not a stand-alone application and the architecture becomes different, but even a game like Civilization is going to have an identical architecture at the most fundamental level. Modular design, design patterns, and all of this is an entirely tangential discussion. There are an enormous amount of details and concepts in between but that is a matter of design and ultimately implementation - not a broad spectrum layman's consideration of the way to begin to think about how it works.
2 u/dchem 10 Jun 2015 03:54
First, get yourself a good C++ book. I'd recommend something like Effective Modern C++.
Next, get yourself started with Visual Studio for an IDE and SFML for video/audio/thread library. I know a lot of game programmers poopoo the idea, but SFML is a decent way to learn the basic architecture of C++ game without having to go from grounds up.
Basic architecture is to run worker threads to update graphics, another worker thread to run the sound, and another to loop the game and so on. SFML gives you some thread management capability, so you have that going for you.
Here's an example code:
The GameEngine will have implementaion like this:
and you'd need somesort of application loop control:
AppLoop.h
You can then inherit AppLoop in various game modes.
Enjoy.
0 u/sec [OP] 16 Jun 2015 18:40
Thank you very much for this,
1 u/Vladar 12 Jun 2015 23:54
You totally must watch Handmade Hero.
It's video stream of making game completely from scratch (c-style c++) targeted at beginners.