I’ve been working really hard at a full-blown “game engine” over the past year or so, on and off. It’s an incredibly large workload, but I’ve honestly found that it’s really given me a far better understanding of the bowels of what goes on inside a lot of large-scale games, and it’s also through poking around engines’ documentation and even playing games based on them and observing certain practices that are used (note: I’m not referring to game mechanics, but the way the mechanics themselves can be implemented) that I’ve been able to build a semblance of an engine for myself.
It is not a project for the faint of heart. I find myself even questioning why I should bother, why I bothered in the first place, why I didn’t use a full-blown game engine and have most likely completed the game that I actually set out wanting to make, but for me the answer was simple and it’s one that I come back to every time - it’s not how I, as a programmer, work. Sure, I could’ve cut the workload into an eighth of what I’ve got currently, but I found myself unwilling to learn the ins and outs of a game engine that abstracted a lot of the fundamentals away from me. In the end, I would have maybe learned how to make a game, but I wouldn’t have learned better programming techniques or satiated the curiosity that’s been driving the development of the thing.
By on and off, I mean every month or so I’ll plug a heck of a lot of work into it, move it that one step further towards an alpha or a beta and beyond, before I lose the confidence to keep going and forget it for a while. This is something you’ve got to consider, whether you’ve got the time, effort to put into it and the motivation to succeed. I don’t mean to try to scare you away from it, but I’m just stating this from my experience - my voice is not the only one so please take into account all of the other posts in this thread and any more to come, they offer just as valuable advice.
But if you want to know what sort of work goes into an engine (well, my engine), this is what I’ve discovered so far:
- you have know the language. I know this seems simple enough but when you get into actually programming the beast you’ll find that it’s so many individual functions communicating with one another beneath the surface, you have to avoid sloppy practices and bloat in your code or else you may end up finding yourself on a bug hunt through tens of thousands of lines of cruft and have no idea what the code means any more.
- time management is key. you can’t leave endless unimplemented functions scattered in several classes, they will build up and you’ll find yourself returning to a much larger workload than you wanted.
- you’ll need means of storing, accessing, saving and altering so many different sorts of assets. Images can be simple enough to use, but when it gets to things like animations, or storing a game’s storyline, or a tileset, or items, or dialogues for NPCs, or particle effects, you’re going to need to have effective ways to use them - I opted for a Manager paradigm to keep all types of data together and to be able to access them from the right places and be able to keep it all consolidated. There aren’t any “standard” formats for these things, you’ll need to roll your own (I can share some implementations), and they take a lot of thought.
- rendering. you need an adequate understanding of your chosen graphics library (I opted for Java2D for simplicity but may port it over in future) to be able to provide abstraction to the end-user but enough flexibility to provide power over what goes on. it’s a balance you need to find.
- documentation. whether or not you’re the only one working on the engine, or the only one who’s going to use it, you’ll have difficulty remembering every single intricacy and function provided by the engine so you will have to provide extensive documentation. Granted, that may be one of the last things you do but even things like comments describing functions’… function will help you remember what your code actually does. Several IDEs (I don’t know if they all do, I use NetBeans) allow you to comment functions and variables in such a way that the comments appear as though they’re JavaDoc.
Those first two points and the last one apply to any decent-sized project really. Another point is that your code has to be self-documenting, because you may potentially be not the only one working on it and it could slow your development down.
At the end of all this - I am programming my game engine as a means to an end. I fully intend to complete the engine and use it in a game and I know that the familiarity I’ll have with it will allow for a lot of ease through the game development process. You need to decide why you want to write one and if any of the things I’ve said hasn’t deterred you then I wish you all the best, it’s been difficult, I’ve made a lot of the mistakes I mentioned for myself, but I’ve had fun doing it and I hope you do too if it’s the road you choose to take.