Jump to content

  • Log In with Google      Sign In   
  • Create Account


Code & Engine Structure Review?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 makuto   Members   -  Reputation: 828

Like
1Likes
Like

Posted 07 September 2012 - 11:00 AM

Hi! I've been working on a game engine for a big learning experience and possible future use, and it's going along quite nicely. This is the code on SourceForge: http://sourceforge.net/p/woodenfoot/code/ci/26f967bdaa7291265910bf93273384fa41b73335/tree/trunk/Source/

Would anyone care to go through the little that I have done and give me some tips on the structure of the engine and my coding style? I've based the structure on what's discussed in Game Coding Complete, 4th ed (strongly recommended). It's in C++ primarily targeted for Linux (I'm on Ubuntu right now), but should still be platform independent as most of the code I've completed is basic C++ constructs.

The main portions that are far are the process manager:
http://sourceforge.net/p/woodenfoot/code/ci/26f967bdaa7291265910bf93273384fa41b73335/tree/trunk/Source/ProcessMan/
And the event manager:
http://sourceforge.net/p/woodenfoot/code/ci/26f967bdaa7291265910bf93273384fa41b73335/tree/trunk/Source/EventMan/

The demo.cpp files demonstrate the use of that specific component.

The main thing I'd like to get reviewed on is my overall coding style. What do you think of it?

Want to get to know my work and I better? See my website: Au 79 Games

I wrote General Tips on the Process of Solo Game Development


Sponsor:

#2 Goran Milovanovic   Members   -  Reputation: 1103

Like
0Likes
Like

Posted 09 September 2012 - 02:38 AM

Many of the files are empty ...

The ones with actual code seem convoluted: Whenever you have so many "managers", you should take a deep hard look at actual game requirements, because it's very likely that the game in question doesn't actually require a grand process/event handling architecture.

Build games, not engines.

+---------------------------------------------------------------------+

| Need a programmer?        ->   http://www.nilunder.com/protoblend   |

| Want to become one?       ->   http://www.nilunder.com/tutoring     |
| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |
+---------------------------------------------------------------------+

#3 Hodgman   Moderators   -  Reputation: 27622

Like
0Likes
Like

Posted 09 September 2012 - 03:09 AM

One quick point: you've committed the generated files (e.g. .o) into version control - don't do that Posted Image

#4 makuto   Members   -  Reputation: 828

Like
0Likes
Like

Posted 10 September 2012 - 10:12 AM

Many of the files are empty ...

The ones with actual code seem convoluted: Whenever you have so many "managers", you should take a deep hard look at actual game requirements, because it's very likely that the game in question doesn't actually require a grand process/event handling architecture.

Build games, not engines.

That's true. The reason why I've started with the engine is that I got the book Game Coding Complete and am trying to follow along a little bit. Would you recommend I stop making the engine for a time and make a few games? The way I see it there are only 4 parts of a game that are really needed:
  • Input via keyboard, mouse etc.
  • Output via sound, graphics, haptic feedback etc.
  • Objects (holds world, actors, interface, etc.)
  • Processing/execution
If I made a few games from those components and saved the parts that would be very good to reuse, then added them to this engine, would that be a good idea?

One quick point: you've committed the generated files (e.g. .o) into version control - don't do that Posted Image

I can't figure out how to delete any files or folders from SourceForge/Git. Do you know how? That's why there's a lot of .o's, old files, etc.

Want to get to know my work and I better? See my website: Au 79 Games

I wrote General Tips on the Process of Solo Game Development


#5 thedevsykes   Members   -  Reputation: 336

Like
2Likes
Like

Posted 10 September 2012 - 10:33 AM

Most development studios i've come into contact with in my local area don't build engines. In fact i'm with that regime, dont build an engine, build the game! The issue is, games are so diverse and your engine won't fit all problems. A better idea, as you've clearly pointed at is to take the reusable components of your game, and reuse them in other projects, eventually, you'll have compiled a lib of all your reusable systems. Personally I try to keep reusable components as independent as possible, but sometimes you just have to link them, but do that while building the game.

For example, any scene nodes may need to know about the rendering system, etc etc.

If you try to build an engine, (not saying you can't, but its a hell of a job) and you haven't built a whole lot of games, then how do you know for sure what you need ? Sure the book will take you along the path, but its generalised concept, you'll find that sometimes an engine is too much work for little gain.There fancy and nice, but in my personal opinion not very productive for a wide range of concepts.

So take what you can reuse, and pick and mix your components for any future games you may make, it creates a more flexible way of development in my opinion.
'Knowledge isn't key, but understanding...'

My qualifcations are not here to showcase, but for those I answer and ask, to get a better idea on my knowledge.

BCS Level 2 Certificate for IT Users (ECDL Part 2)
OCR Level 2 National Award in Business
Level 2 First Diploma in Media
Level 3 Diploma in Games Design and Development Extended
BSc Hons in Computer Games Programming (Current - 1st Year)

#6 makuto   Members   -  Reputation: 828

Like
0Likes
Like

Posted 10 September 2012 - 10:52 AM

Thanks for the tips! I guess I will pause this engine for a bit.

Want to get to know my work and I better? See my website: Au 79 Games

I wrote General Tips on the Process of Solo Game Development


#7 Goran Milovanovic   Members   -  Reputation: 1103

Like
1Likes
Like

Posted 10 September 2012 - 01:23 PM

Would you recommend I stop making the engine for a time and make a few games?


Yes.

For example, any scene nodes may need to know about the rendering system, etc etc.


I would also recommend holding to the KISS principle: Don't make some convoluted tree structure (scene graph) for a situation where a simple array would work just fine. There are various benefits to that: Operating on contiguous chunks of memory is far more optimal for cache, which can result in higher performance (significantly higher, in some cases). Also, arrays, being relatively simple structures, are easier to reason about, for nearly everyone.

+---------------------------------------------------------------------+

| Need a programmer?        ->   http://www.nilunder.com/protoblend   |

| Want to become one?       ->   http://www.nilunder.com/tutoring     |
| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |
+---------------------------------------------------------------------+

#8 makuto   Members   -  Reputation: 828

Like
2Likes
Like

Posted 10 September 2012 - 05:57 PM


Would you recommend I stop making the engine for a time and make a few games?


Yes.

For example, any scene nodes may need to know about the rendering system, etc etc.


I would also recommend holding to the KISS principle: Don't make some convoluted tree structure (scene graph) for a situation where a simple array would work just fine. There are various benefits to that: Operating on contiguous chunks of memory is far more optimal for cache, which can result in higher performance (significantly higher, in some cases). Also, arrays, being relatively simple structures, are easier to reason about, for nearly everyone.

Thanks! Would it be a safe decision to use Python for a game I'm entering into a competition and slowy migrate highly processed Python into C++? Most of my fellow peers working on the project aren't very seasoned C++ coders and I like programming in higher-level languages, but I still want to be able to do heavy processing (for more complex game mechanics) with the industry's C++ (which I have been learning & using for ~3 years).

Also, I was thinking of making one of those projects where I add a few things every week and the game slowly grows from it. It would be extremely nice if I could implement a simple Input Output Object system in C++ and code all the object-to-object interaction with Python. Basically, some C++ would loop through the object array and call each object's update function, which is where the control is passed to the Python script. Is this possible with Python?

Want to get to know my work and I better? See my website: Au 79 Games

I wrote General Tips on the Process of Solo Game Development


#9 Goran Milovanovic   Members   -  Reputation: 1103

Like
0Likes
Like

Posted 10 September 2012 - 11:25 PM

It's relatively easy to interface with C/C++ code from Python. A google search for "python c modules", "python ctypes" or "python SWIG" should provide you with all the relevant information.

However, before you commit to anything, I would recommend writing the whole project in Python first, and then running a few tests; It's very likely that Python is more than fast enough for what you want to do.

If it's not fast enough, you should profile to find the "hot spots", and then try your best to think of a better algorithm to get around them.

If you can't find a better algorithm, then you should write C/C++ code to handle the bottleneck.

+---------------------------------------------------------------------+

| Need a programmer?        ->   http://www.nilunder.com/protoblend   |

| Want to become one?       ->   http://www.nilunder.com/tutoring     |
| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |
+---------------------------------------------------------------------+

#10 makuto   Members   -  Reputation: 828

Like
0Likes
Like

Posted 11 September 2012 - 10:51 AM

Ok. Thanks for the tips

Want to get to know my work and I better? See my website: Au 79 Games

I wrote General Tips on the Process of Solo Game Development


#11 thok   Members   -  Reputation: 662

Like
0Likes
Like

Posted 13 September 2012 - 08:49 AM

I can't figure out how to delete any files or folders from SourceForge/Git. Do you know how? That's why there's a lot of .o's, old files, etc.


To remove files from git, do `git rm <filename>`, then commit.

#12 makuto   Members   -  Reputation: 828

Like
0Likes
Like

Posted 13 September 2012 - 11:04 AM

Thanks Thok!

Want to get to know my work and I better? See my website: Au 79 Games

I wrote General Tips on the Process of Solo Game Development





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS