Can You Make 3D Games In GameMaker?


Can You Make 3D Games In GameMaker?

Hey there! I'm Fábio Fontes and I’m making cars do funky stuff in Buck Up And Drive!, a procedurally generated endless driving game with all the speeds and none of the common sense. 

It's also fully 3D and made in GameMaker!

Making 3D games in GameMaker

What's that? “GameMaker can't do 3D?”

Yeah, I also had the "GameMaker no do them 3Ds" mindset. I knew it could be done, but figured it would be either crude-looking or a complete pain in the donkey to set up... or both.

How true is this mindset? Well, keep reading!

GETTING STARTED WITH 3D IN GAMEMAKER

I got into this rabbit hole through DragoniteSpam's videos on how to set up a 3D environment by setting up a perspective camera, learning about vertex buffers (how 3D models are stored for use), and applying matrix transformations to them so we can put them in the game world.

After some fiddling...

undefined

WE GOT A BOX!

Shortly after, I realised I could also apply matrix transformations to sprites for some billboarding (see the sprite dude above). Add some crude collisions based on those of a top-down game, and... it actually looks like something now.

"Wait, this doesn't look like a driving game!", I hear you scream from the rooftops. Yep, this started as a general-purpose 3D environment, which is still in the game (looks a bit different now) and you can access it by hitting Shift+F5 in the main menu!

Then I added a "vehicle mode". Now we're getting somewhere.

IT'S BILLBOARDS ALL THE WAY DOWN

Now, what do you do when you have that nice 3D environment one could drive around?

You create a new one with a conveyor belt track because you wanna make an OutRun clone! Logically!

This is when the actual game started, and in many ways, it's still as crude now as it was back then. All those basic top-down racers people do as they're getting into gamedev? It’s that but with a fancier camera projection.

Background elements, cars, effects... all sprites moved around using matrix transformations and used as billboards. No fancy shaders (except the one for palette swaps by PixellatedPope) or anything.
 
At this point, the only 3D model was the skybox, as it was easier to rotate that than to set up some scrolling for the sky.
 
Laziness or convenience? You decide!

Buck Up and Drive 1 Buck up and Drive 2 .jpg

So things would stay like this for a bit. While I COULD have verticality before, I was somewhat limited by the fact I'd have to make sprites for every action and manage them accordingly. If I wanted the car to jump, I'd have to get sprites for that.
 
Sure, pre-renders would make the process easier than actually drawing them, but I intended to add extra cars over time, and... you can see how unmanageable that'd potentially become. Keep your scope in check, kids!
 
I also couldn't move the camera around too much or it'd break the illusion from the billboarded sprites (that one still somewhat applies today).

I could import models, but at the time they'd lack that cel-shaded look, something I considered important to the game's visual flair. So I kept the functionality of the car a bit modest, while making it look over-the-top enough to be enjoyable.

That'd be enough... right?!

IT WOULDN'T BE ENOUGH

I started to mess with shaders for fun, specifically lighting, and I figured out how to implement the type of cel-shading I was using for the car pre-renders.
 
It's based on the techniques used by Arc System Works for their recent fighting games, focused on flat colors with clean, sharp lines, rather than intricate patterns, by having the UVs arranged in a somewhat unconventional way; as a texture that's almost exclusively just a bunch of squares.

For the shading itself, it uses a colour ramp like many cel-shading methods, but instead of affecting the colours directly, it shifts the model’s UVs to other areas of the texture that contain the same layout in different colours.
 
This allows me to have full control of which colours the model uses for shaded and highlighted areas, rather than leaving it to the lighting.
 
As for the rim light, that's achieved by using the camera's coordinates instead of the light sources.

Buck Up and Drive 3

That's when the cars changed to real-time 3D models. The sprite limitations were now gone.
 
The track would still stay mostly billboard-based, but I could now do whatever I wanted with the cars.
 
I could make their actions look more intense. Adding new cars would no longer require organising sprites - it was just a simple mesh swap. I could move the wheels independently from the car's body, and making the car jump was now trivial.
 
Making it do silly flips in mid-air? Same thing.
 
From here I just went hog wild.

THE TAKEAWAY

My current setup has limitations, I'll be the first to say it.
 
There's no advanced lighting with multiple light sources. Skeletal animation's taking a leave of absence. There's jank all over the place. Performance could be better. A lot of it is put together with duct tape and a wish. And there's no 4k texelated-raytraced-sample mapping, or whatever the current technical buzzword is.

But it does what I need it to do, and it looks pretty.


Written by Ross Manthorp

Ross Manthorp handles all things community at the GameMaker team. When he’s not pulling the strings from behind the scenes he’s enjoying Nintendo games, indie games, and getting emotional over cartoons and comics.