- Post 1 (start of 7DFPS)
- Post 2 (end of 7DFPS)
- Bonus Post (this post)
- Post 3 (first screenshot)
This weekend, I gave a talk for my local LUG on creating a simple game from scratch using SDL2 and OpenGL.
I had hoped that my 7DFPS text adventure would be the focus of this talk, but since it's still a little way off (I've continued development past 7DFPS, but it's still not quite at a point where I feel it can speak for itself - stay tuned though, I'm hoping to have some early builds up within the next week or so), I switched gears and spent Friday using the things I've learned whilst working on my 7DFPS game to make something new.
In addition to first person camera controls, I wanted to cover 3D translation and rotation so that I could talk about the way that OpenGL handles these. Rather than focusing on first person movement, I decided to do a little radio controlled car sim, where players would move a vehicle through a scene whilst watching from a fixed viewpoint.
As it came together, I realised that I hadn't bothered to stop the car - at this point it was a blue block - from turning when its speed was zero. Instead of fixing that, I embraced it and decided to make the vehicle a hovercraft (which also made modeling a little easier).
In the course of about 7 hours, the game was more or less in the state it's in now. Save for the OBJ loader and a half dozen lines in the middle of the rendering function which I copied from my text adventure, everything was written on the Friday.
I knocked the 3D assets together in around an hour in Blender, pulled a fan sound
from Freesound.org, and used a super funky track
by Kevin MacLeod, and the little game went from being a bunch of floating cubes to something more interesting.
For the talk, I gave an overview of what SDL2 and OpenGL are, focusing on windowing, input and rendering, did a brief code walkthrough and then talked about planning and game design as people had some hands on time with this and several other games I've made.
All up, Hover Drive is a long way shy of a finished game (and it's got a fairly significant bug with rendering normals that nobody seemed to notice on the day), but it sufficed for the talk I gave, and it was a bunch of fun to work on.
The source code (with comments!), Blender source files and the slideshow I gave my talk against are all up on Hover Drive's GitHub page
, along with builds for Linux and Windows which should have all of the deps that aren't likely to be installed on an OS by default. I'll have a Mac build up as soon as I sort out my MBA's busted GCC install.
Surprisingly, the game seems to be more enjoyable in its current state than I expected it to be. Even without collisions, environmental variation, objectives and other things that I feel a game like this would need, people seem to just enjoy driving around. I guess that's why people buy radio controlled cars :D