On-the-fly media generation to streamline prototyping and development

A few years back I splashed out and bought myself a beasty but very little (13.3 inch) XMG gaming laptop. It has 16GB of memory, an SSD and GTX 960M gpu, so it’s ideal for running most games, though I mostly use it for development. When I’m at home I sit at my desk and plug in a mouse and monitor. When hooked up like this it works just as well as a desktop; definitely better than most office machines I see in use! This means I also have a basic dual screen setup where the laptop will be used for documentation and the main large screen for coding and play-testing.

Fast forward to last week, I was away on holiday seeing family in Ireland. I bought my laptop with me as this was always the plan in buying a smaller unit; portability plus power. I was able to spend a couple of hours most nights developing and the time away from my day-job, doing web development mostly, greatly helped me concentrate on my project.

I hit a bit of a roadblock though when it came to media. Normally with my ‘desktop’ setup I could use most image editors and 3D modelers with ease; currently GIMP and Blender (though I’m terrible at Blender and still learning). It might just be me but I struggle using this type of software with a touchpad and a small screen. This was when I started thinking about using prefabs.

Most engines and platforms support inbuilt prefabs such as cubes and spheres which can be made with just code, no external resources required. I’d used these initially for this project and many other projects in the past. However, after a few cubes for different objects things start to look a bit samey and you end up creating/buying and importing media to do the job instead.

So I had these two options for my decision to create a new type of level in my game. I either used prefabs for the time-being or I went and found some objects, changed them a bit to make them game-engine ready and import them.

This is when it struck me that my ideal solution would be to have the simplicity of using prefabs combined with the flexibility of using custom objects, ideally without the often complicated steps involved in making one cube look very different to another cube. It may not seem complicated having different size and coloured cubes, but it will very quickly fill the screen when you are going through the same steps repeatedly to create different objects.

I started thinking about implementing the ideal solution; a method that I could give a handful of arguments like “cube, blue”, “tree,10”, “plain,ground.jpg” “cone,green,2” and would return an object ready for me to use. With a couple of functions behind the scenes to work with prefabs and create textures as needed I could have a very specific object created on-the-fly in a line of code:
tree.obj = qObject("cone", "leaves.jpg");

The cool thing with this is that list of prefabs could then grow when time permits within the qObject method:
tree.obj = qObject("tree", "dark", "tall");
But that would be more useful for a game heavily featuring procedural generation perhaps.

This may not seem like a great breakthrough but it will definitely speed up prototyping level designs.

Share this post