Sunday, May 5, 2019

architecture - How to design a game engine in an object-oriented language?




Whenever I try and write a game in any object-oriented language, the first problem I always face (after thinking about what kind of game to write) is how to design the engine. Even if I'm using existing libraries or frameworks like SDL, I still find myself having to make certain decisions for every game, like whether to use a state machine to manage menus, what kind of class to use for resource loading, etc.


What is a good design and how would it be implemented? What are some tradeoffs that have to be made and their pros/cons?



Answer




I doubt somebody is going to be able to say 'You have to do this and that and this and this slots with that using pattern X'.


However, some useful resources:
Enginuity - a series of engine building articles on Gamedev.net.
Game Coding Complete - I own this book, and it goes over every (well, almost) aspect of game programming well. It also does have an engine built throughout the book.
Game Engine Architecture - This is another great book for engine design.
C4 Engine Layout - Taken from my comment, but this shows a high-level way of fitting each part of the engine together.


These may be a little too much for what you need, but you can't know too much about something, and I'm sure you'll get a good plan from them.


EDIT: I forgot the Gamedev articles have been archived since the new site, fixed :)


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...