Sign in to follow this  
mikzdx

Help with planning my game engine?

Recommended Posts

Hello, I am in the process of planning out my game engine for a simple metroidvania sidescroller type of game. I already have some practice in this as I have created a side scroller with basic enemies and victory conditions. Now, I would like to create an engine from which I can create multiple platforming or metroidvania type games but I am uncertain how the dependency trees should flow and if I am missing any major parts to a game engine. (NOTE: I am coding in python and using pygame)

Here is what I have so far.

Main[list][*]Game World[list][*]Game data[list][*]Player character[*]Levels[*]Physics[list][*]Gravity[*]Friction[*]Velocity/Acceleration[*]Electrical charge - Attract/Repel[*]Mass/Force/Momentum[*]Potential/Kinetic Energy[/list][/list][*]HUD(Appears on-screen)[*]Level Instantiation(Appears on-screen)[list][*]Level Objects[list][*]Player Object[*]NPC Objects[list][*]Allies[*]Enemies[*]Neutrals[/list][*]Environment Objects(Tile based)[*]Entity Objects(Non-static environmental objects, items and projectiles)[/list][*]Background[/list][/list][*]Menu[list][*]Button[*]Text entry[*]Save/Load[/list][*]Controller[list][*]Key state[*]Gamepad[/list][*]Networking[list][*]COOP Mode[/list][/list]
SO, should I rearrange anything and/or am I missing anything inherent to this particular genre?

thank you

Share this post


Link to post
Share on other sites
The hierarchy sounds good. It's alot of preference involved in what should come first. But the as a general rule, try to make your code as generalized as possible,that way even if you change your structure, it shouldn't be alot of work simply plugging in some data into a function etc. So my suggestion is to start out with base classes that will contain a combination of basic operations. Then when you specialize this class, they will all have a common feature.

Share this post


Link to post
Share on other sites
[url="http://scientificninja.com/blog/write-games-not-engines"]Write games, not engines[/url]. Required reading.

Write the first game you intended to use this engine with. Once finished, start to factor out the code that is non-specific to that game and use it in the next project. Rinse, repeat.

You might have an engine at the end of it. You will definitely have some finished games. Writing the engine first, you might have an engine at the end of it and you probably won't have any finished games.

Share this post


Link to post
Share on other sites
[quote name='gaunt7' timestamp='1307808336' post='4822121']
Hello, I am in the process of planning out my game engine for a simple metroidvania sidescroller type of game. I already have some practice in this as I have created a side scroller with basic enemies and victory conditions. Now, I would like to create an engine from which I can create multiple platforming or metroidvania type games but I am uncertain how the dependency trees should flow and if I am missing any major parts to a game engine. (NOTE: I am coding in python and using pygame)

Here is what I have so far.

Main[list][*]Game World[list][*]Game data[list][*]Player character[*]Levels[*]Physics[list][*]Gravity[*]Friction[*]Velocity/Acceleration[*]Electrical charge - Attract/Repel[*]Mass/Force/Momentum[*]Potential/Kinetic Energy[/list][/list][*]HUD(Appears on-screen)[*]Level Instantiation(Appears on-screen)[list][*]Level Objects[list][*]Player Object[*]NPC Objects[list][*]Allies[*]Enemies[*]Neutrals[/list][*]Environment Objects(Tile based)[*]Entity Objects(Non-static environmental objects, items and projectiles)[/list][*]Background[/list][/list][*]Menu[list][*]Button[*]Text entry[*]Save/Load[/list][*]Controller[list][*]Key state[*]Gamepad[/list][*]Networking[list][*]COOP Mode[/list][/list]
SO, should I rearrange anything and/or am I missing anything inherent to this particular genre?

thank you
[/quote]

I don't really like the hierarchy at all actually. For instance is networking really required in a "simple" platformer game? How are you defining your levels? Is your save/load system restricted to the menu?

Your physics breakdown looks a little wonky to me also, what are you doing about collision detection? Two dimensional vectors are important but I don't really see those listed. Is a simple platform game really going to need potential energies and electric charges? Platforms are a big part of platforming games (obviously) but they seem all lumped together in your environmental objects. Also how much functionality are you duplicating between your NPC objects and your player?

It seems like your headed for some very deep inheritance hierarchies which is specifically what component based architectures are aiming to avoid... not saying you need a component based architecture, just saying that it seems like you may run into some problems. For instance there is probably a good bit of shared functionality between a HUD and a menu.

I second the suggestion to just focus on writing a game and factor out the common functionality later. My critique of your current hierarchy is designed not to provide you with a better suggestion for a hierarchy but to get you to see the logical fallacy in trying to create a game engine without a game as context. You should just focus on the game and then the hierarchy will naturally result based on the needs of the game and through refactoring.

Share this post


Link to post
Share on other sites
Firstly, here is a revised hierarchy.

Main[list][*]Game World[list][*]Level[list][*]Camera[*]Level Objects[list][*]Non-static entity[list][*]Player[*]NPC[/list][*]Non-Static object[list][*]Object(Bullets, Moving tiles, Items)[/list][*]Static[list][*]Tile[/list][/list][*]Background[/list][*]HUD[/list][*]Game Data[*]Menu[list][*]Button[*]Panel[/list][*]Controller[*]Network[list][*]Host[*]Client[/list][/list]
In regards to Shadow's statements, each bullet is a class and the hierarchy stands for which class another class is instantiated in. I did plan to make a game while working on this underlying engine and one of the features does include multiple players from different networks. The levels are basically rooms as you would find them in a metroid or castlevania game. Loading will be restricted to the menu and saving to inside the game itself. I have decided to not have a physics class by itself and instead just include the various attributes to level objects where applicable. Collision detection will be handled by each non-static level object individually(unless you know of a better way) I don't know what you mean by two dimensional vectors. My game will need at the very least gravity, acceleration, friction and electrical charges because the platforming parts of the game revolve around magnet puzzles. Functionality between npc and player objects are duplicated very much in the parent class of non-static entity. And I currently don't see problems with the inheritance as it is what I used for my first test platformer.

I was never planning on making an engine without making a game to go with it. I was just wanting to keep the beginnings bare-bone so I could copy it and tuck it away for my next platforming project.

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