Posted 11 May 2012 - 08:14 AM
Now I am stuck trying to figure out an organized way to have multiple levels in my game, I kind of understand the concept of inheritence and polymorphism (how lazyfoo explains in this article http://lazyfoo.net/a...cle06/index.php ) the problem is that he confuses me because he just mixes all of the classes into one file with comments all over the place for his examples.
Is there any tutorials out there that are organized and clear?
Posted 11 May 2012 - 08:17 AM
Posted 11 May 2012 - 08:47 AM
Posted 11 May 2012 - 08:51 AM
Posted 11 May 2012 - 09:19 AM
Posted 11 May 2012 - 10:58 AM
Posted 11 May 2012 - 11:05 AM
As for how you should design your code, that can be pretty subjective. What works for some, might not work out for others. One place to start is to read up on software design patterns. This won't outright solve your problem, but if you read through some of them it will open your mind to how you could potentially implement your solution in a way that's not destructive to your overall codebase. Keep these on hand and if you have the time, build a couple test projects and try them out. Get a feel for them and see how they work first hand. You'll more than likely come across a need for one of them in the future and you'll be happy to have already studied them.
To get you somewhat started on your problem, try not to think of a level as a class. Instead, break down your game into major and minor components. A major component would be rendering graphics, detecting collisions, loading and caching map files and its resources (sounds, textures, polygons), scripting, etc.. Next, break down these major components into minor ones, which are the core of your classes you will implement. You're interested in level rendering and interaction right now. To break this down into minor components, you need to figure out what are the inputs and outputs of your game. What can someone do and see in a level and are there any special considerations. Your final solution should have a set of reusable classes that are fed the exact same data every time, but have a sort of API that your maps can use to perform certain types of actions. Most games implement this as scripting.
Posted 11 May 2012 - 12:47 PM
i never have used c++ oo ever, and i never will, its completely perdantic using classes, i never do. trust me, you can do anything without them.
give me any oo code and i can write a straight version of it of equal power, straight c just gets the job done.
Posted 11 May 2012 - 07:53 PM
Posted 15 May 2012 - 10:28 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users