SpellShocked

Overview

In the fall of 2021, I worked with a small group of classmates to create a 2.5D platform game SpellShocked. his game was designed for a school class, where we had two projects in a school year. In these projects, our team had to propose an idea, specify objectives, collaborate and communicate, and present a final project in front of the whole class at the end of the semester.

In the group, there was no "lead", but as I had the most experience with Java, I took a leadership role at the beginning of the project timeline to help teach other group member some new Java concepts such as generics, lambdas, and version control. I also made many of the base classes that other programmers then extended, as well as the world generation and map display engine.

The game

SpellShocked has a variety of game modes, ranging from a hunt mode to a PvE (Player versus Entity) timed challenge. The game was programmed entirely in Java using the LibGDX framework, with custom textures made in Paint.NET. Both game modes share the same movement engine, as well as many of the textures. The entity interactions in both are also very simila

The ShockWave game mode is the main mode with random world generation. In this mode, the player can gain points by defeating monsters that spawn in waves around the player. To fight back, the player is equipped with a wand that shoots fireballs at monsters, inflicting damage. The player can also eat pumpkins to regain health, as the monsters deal damage to the player on contact. Once the player defeats all the waves, or dies trying, the round is over and the player is given a score.

The Pumpkin rush game mode is a bit simpler. The objective now is to destroy all the pumpkins generated in the world. This isn't easy, as each pumpkin has a monster guarding it and will attack if the player gets close. If the pumpkin is destroyed, the monster will find the closest pumpkin and guard that one. Once all the pumpkins are destroyed, or the player dies trying, the round is over.

SpellShocked code Github Here

SpellShocked game mode with the wave counter at the top center,

health to the left, hotbar, and a point counter (cut off).

Pumpkin Rush game mode with the pumpkin counter to the right

health to the left, hotbar, and pumpkins on the ground.

The world engine

My biggest contribution to the game has to be the world generation/engine. Without this, there would be no movement, no world, no random generation, and no terrain.

The first step I took was figuring out how to display the world, as the game needed to give a 3d appearance, but also be flat and easy to work on (hence the 2.5d). To do this, I used a 2d array to store the tiles (the ground), but also gave each tile a height value. In conjunction with basic textures, this enabled me to make the first bit of terrain.

The next step was to add variable heights. Variable heights presented a problem, as the tiles needed to be offset from each other, and that left a gap with no texture. To solve this, a complex texture format was adopted to cover all edge cases, including connected textures for flat surfaces, as well as blending with different heights. Once this was resolved, the world now was ready for basic gameplay.

Finally, I worked on adding random generation. To do this, we used Perlin to generate a noise map that could be converted to a world. After experimenting with parameters, we made it such that the generated worlds with reasonable changes in elevation.

Later on, I helped add different tiles to the game, such as sand, as well as obstacles like rocks, My involvement here was much less, but I laid the parent classes that the other tiles would be derived from.

Sample texture file designed on a 6x4 grid

Efficient code to correctly iterate through the tile list and connect the textures. It handles the xy index of the selected texture on the grid, and makes its choice dependent on the tiles around it.

Code to draw an individual tile into the world. This takes into account the appearance of height difference, and factors that into where it draws a tile. If a tile is higher up, it will draw it higher on the screen, but will also draw it higher if the tile is farther back, an artifact of 2.5d games.