Whether you’re starting with (or switching to!) Processing for prototyping/demonstrations, ActionScript 3 to make a web game, C#/Unity for a 3D game, or C++/SDL for a high performance downloadable game (or for a medium-high performance game developed in less time C++ paired with Allegro/SFML, or C#/MonoGame/XNA)… no matter which library, language, or development environment you’re starting into, it’s helpful to create a foundation project to duplicate.
Once you’re in the groove on a project, iterating and experimenting, programming can be fun. There’s some initial difficulty in getting everything set up for programming though. Tutorials and example code sometimes turn out to be for a different version of the environment or libraries you’re using, or out of sync with other tutorials and example code. Troubles may arise based on what operating system you’re working on.
Any way to simplify that hurdle at the start of a new game greatly improves your ability to spin up a new project whenever you’d like. What we’d like to do is sort all this out one time, then copy or branch that starter project to spare ourselves the trouble next time.
Additionally, there are certain essential tasks that you’ll need to do for pretty much every project you ever make. These include, but aren’t limited to:
- Setting (or accounting for) screen/window/game resolution
- Loading/displaying common image formats
- Loading/playing multiple sounds, looping music
- Separating generic (esp. initialization) from game-specific code into different files
- Displaying text, both static and dynamically constructed, in variable size and typeface
- Calling the main game code on a repeating event timer or within a loop (depending on the language), controlling or properly accounting for framerate
- Handling keyboard, mouse input
- Loading/saving arbitrary data files (small persistence for user preferences or saving progress, and arbitrary file sizes for level data etc.)
This will often include setting up a rudimentary folder convention to stick to: a place to toss sound files, music files, fonts, images, level data, other source files, include files if applicable – such that your project or code are set up to find them there by default.
If you’re going the AS3 or C++ route, scripts or batch files (ideally makefiles for C++, if you’re up for it) may be useful to simplify recompilation or copying files into the working directory. If it’s a downloadable game for Windows, making a basic installer using Inno Setup will be handy. There may also be additional libraries needed to support your preferred asset formats, or features you commonly rely on. It’s a good time to figure out compiler and editor settings.
All of these are things that, at the root, should only need to be figured out the first time, then duplicated when kicking off future projects.
To be clear: the purpose of all this is definitely not to start laying the foundation of an all-encompassing all-purpose game engine! Rather than trying to create as much functionality as can possibly be imagined, aim for the minimal intersection, the bare bones of what’s certain to be essential when starting virtually any project.
(Trying to make a generalized engine before you’ve made a specific game is a bad idea. That’s a potentially endless and ill-defined path likely to wander into tangents that don’t fit together coherently, hacked without appropriate planning for something of that scale. Generalized engines are already out there; if you start trying to remake Unity in C++ you’d be a lot better off just using Unity. Piling a bunch of functionality into Unity without rhyme or reason wouldn’t end well either, not only for performance but simply as a sake of maintaining enough organization and direction to not get quickly bogged down. Small indie teams and solo games benefit by staying lean! Though of course you can always revisit your foundation project to improve its organization or default functionality.)
The goal is simply to figure out all of the basics, to get over the initial hassle of getting everything pulled together, to gather and troubleshoot some example code to reuse for fundamental operations.
The content when doing this isn’t important. Every asset can be placeholder, no theme or intended purpose is needed. Any images and sounds will do.
Then, before adding any game-specific functionality or organization, duplicate the project’s root folder. That’s your personalized starter template.
If you juggle between more than one programming language with some regularity, this makes clear when tackling a new game in that platform the subtleties in syntax differences for variables, classes, imports, code entry point and audiovisual initialization, etc. There’s no need to look at a blank text file and get mixed up between nuances of different platforms.
If you don’t set up a template project to clone, you’ll likely find yourself trying to work backwards to spend more time doing the same thing anyhow: each time digging up a previous project then gutting it, incrementally stripping away everything unrelated to the next game. I spent a number of years doing just that, before realizing that the outcome every time was pretty much the same, which is to say exactly what I could start with instantly by simply cloning a minimal project created just up to (but before) adding any game-specific code.
When getting started on a new language, library, or environment, putting this sort of project together is a useful exercise to get to know the basics. Another thing I like about it as a warm up for a new platform is that it doesn’t require a concrete idea to justify getting started. It enables a developer to begin getting momentum and learning by doing from the outset, happening upon a direction along the way. If no such direction comes up, then at least there’s less time lost between when inspiration strikes and getting right into making it happen.
Learn and practice team game development with Gamkedo Club.
Membership worldwide. Professional support. Proven process.
Subscribe by e-mail to receive weekly updates with Gamkedo.Community interviews and YouTube training videos for game developers!