Coding a Jump Ruined my Game (Devlog #1)
Sometimes players want something ridiculous to be added into your game, but most of the time they’re very reasonable. Jumping. That’s all they wanted. A simple pop above the ground that would take no more than ten minutes to add to my arcade western game, High Moon.
High Moon is a fast paced slasher where players get to ride through an endless desert on their trusty steed. Taking down outlaws and cactuses with their special sword/gun, the Guntana. And although you can dodge around obstacles pretty easily, the players where asking for a new option, to jump.
But the designer in me wonders what sort of function this can possibly serve. It just seems indulgent to add a mechanic that serves the same purpose of another. So if I was to give people what they wanted, I’d have to add new, never-before-seen obstacles: endless pits and walls. But unlike in most game projects, this proved to be much harder than anticipated. Ultimately, it would require an entire system rewrite.
The reason for the overhaul came down to the game’s graphical style. High Moon is inspired by retro racing arcade titles like Outrunners, where game elements are represented by pixelart sprites and the level is just an endless, flat plane with a road texture.
To achieve this effect I utilized a lot of the same maths, and used the 2D GameMaker engine due to its favorable workflow for pixelart games. And although it achieves the desired effect, it really is just an optical illusion. Because under the hood, there are no collisions, or physics systems to make the game work.
But if I were to add the jumping obstacles required of me, we would need to to have real 3D models and collision, rather than the matter-less scrolling texture we where using before.
This is a lot of core changes, and so they take a long time. 3D rendering and collision systems also aren’t really something GameMaker does out of the box, so we’d have to cobble something together ourselves. The first thing I did was tried to tackle the collisions system.
A lot of 2D games use a tile system where instead of reading pixels to check for a wall, the player object translates their world position to a grid and read whether there is a collision or not in grid-space.
This type of collision system can be translated into 3D space by essentially stacking a bunch of grids on top of each other. And unlike polygonal raycasting, it’s not too computationally heavy for GameMaker to handle. However, it’s generally too impractical for a game designer to make.
An 8x8x8 cube grid would translate to an array 512 values of zeros and ones. If they wanted to change a single block, they would need to figure out where the block is in space, change it, update the 3D model of the level, and do this over and over again for every minor change. I’d be making grids until my grave, so my time was better spent making a tool that would help automate the process of creating grids and level polygons at the same time.
What I ended up with was something akin to a Minecraft building tool where I could place polygonal blocks which would update a 3D grid while simultaneously create a model file. These could then be exported as files that could be imported at runtime into GameMaker.
The blocks can be simple cubes with customizable textures, or I can import entire 3D models to make interesting shapes and geometry. This became a very powerful tool for playtesting and level design. When mixed with a chunk loading system, we can make endless, collide-able levels for High Moon.
From here, we ca use GameMaker’s built in vertex buffering to draw the level geometry, and create a psuedo-raycast system on the player to detect whether or not they are standing on something. Hit a button. BAM. You got yourself a jump.
It may seem like a long walk for a small glass of water, but a system like this has a lot of potential. I can add features to place game objects, vegetation, navmeshes, etc. Not to mention those sick looking jumps.
For a more entertaining walkthrough the process, be sure to check out my video.
Get High Moon
High Moon
The lawman takes on outlaws by day, and the jellyfish swarm at night.
Status | In development |
Author | Addy Valentine |
Genre | Action, Shooter |
Tags | Arcade, Driving, First-Person, GameMaker, On-Rails Shooter, Pixel Art, Retro, Singleplayer |
Languages | English |
More posts
- The Design Behind a Cowboy Samurai (Devlog #2)Feb 10, 2023
Leave a comment
Log in with itch.io to leave a comment.