Week 2 Game Engine Progress

Running Right Sprite Sheet Animation

Game Engine Work:

I believe that this week I made some good strides towards setting up the basic game engine for my game. I started to program the basic setup for rendering tiles and being able to move around the randomly generated map. Also, I worked on only rendering the tiles that are visible on the screen, for optimization purposes. The last part that I completed this week was creating a void tile. So, if there is no tile in that location or it is the edge of the world it would render a void tile (currently a black tile).

The next step in the programming is to setup entities like the player and mob class. Currently I have movement working but I have not implemented the player sprite in the game or its animation. That is most likely the next step. I also need to create more tiles for the game. Currently I just have it randomly generating a 64 tile by 64 tile map for testing. But it is not taking the randomization data from the Perlin noise algorithms that I worked out in a separate program. Another major piece of work in the coming week will be getting the Perlin noise data and using that to determine which tile to load.

Game Art Work:

For the artwork this week I am going to continue working on my main character art. This week I completed the gray scale art for the player sprite for each direction. I probably need to create an idle animation as well. Also in the future I will need to create sprites for attack animations and others. But all that work will be done down the road. This week I want to try and finish coloring the main character sprite sheet. Besides the main character art, I also worked on a basic slime mob character this week. Currently I may not use any of the art, but I need something to render for engine testing. So, for now the slime mob can be a good test for programming the enemies and enemy movement. Once I am happy with that, I can move on to creating other enemies.

Main Character Sprite Sheet so far
Slime Enemy Sprite Sheet so far

Project Scope Thoughts:

This week most of the time that I could spend working on the game was just for getting the game engine started. I spent a lot of time working on getting the tiles to render properly and being able to move around the map without any crashing. Since I am coding the entire engine for the game this project will take much longer to complete.

I’m working on this to learn and get better at game programming and game development in general. I look forward to the day that I can look back at where this project started and how far it has come. Currently I don’t have any timeline for completion on this project as there are a lot of things that I want to implement. I think I will take a lot of inspiration from games that I enjoyed playing like Dwarf Fortress, Minecraft, Stardew Valley, The Legend of Zelda: A Link to the Past, and Legend of the River King just to name a few. I probably have to many ideas for what I want to do with this game and as I move forward, I will likely cut down the scope to make the project something that I can complete within a reasonable amount of time. My goal is to get a simple but working prototype done first and then add more and more systems to the game over time.

Week 2 Game Engine Progress Read More »

Start of 2D Terrain Generation and Perlin Noise

Initially when I started working with Perlin noise I was using grey scale values to display elevation. So the darker the area the lower the elevation. I also played around with smoothing the noise. The smoother the noise the less differentiation occurs in the height. But I figured for now I wanted to show more on one screen. Check out the images below for the different maps.

Since I currently do not have a chunk loading system or any way to move around the map, I have no way to test generating more than one screen worth of data. In the future I want to have a chunk loading system in place. Initially I would load 9 chunks of the map. The center map where the player is and its 8 neighbor chunks. Then as the character moves I would need to load and unload chunks from memory. This may lead to some problems with the edges of the chunks not matching up with terrain height and biome type. I am not sure of that until I get to that point. I have not started work on the chunk system yet but I think it is one of my next steps.

So, my initial maps just show different noise levels in grey scale. Then I added some color in the next maps to show that water would be the lowest elevation, then sand for beaches, then grass was green, and the grey area for mountains, and white for snow caps. From there I moved onto generating another noise map for moisture levels. I had to use another random seed of noise so the maps were not identical. Then I also changed the increment to smooth out the moisture differently than the elevation map. Most of which will change again once I can produce smaller sections of the overall map using chunks. Once I had both maps setup I merged the outputs together into my algorithm. Then I created different biomes based on the elevation and the moisture level at a specific location. I gave a specific color to each biome. Then I started to get some weird outputs. It took a long time before I realized that I was not adding the different octaves of the noise. Octaves are the number of levels of detail you want your Perlin noise to have. I was only generating one level. Now that I am using a higher number of octaves and adding them together, I am getting a much better result.

Current Biomes:

The biomes currently are: ocean / water, beach, scorched earth, bare, tundra, temperate desert, shrubland, grassland, temperate deciduous forest, temperate rain forest, subtropical desert, tropical seasonal forest, tropical rain forest, snow, and taiga. Each biome is represented by a different color on the map. I may raise or lower the number of biomes in the future. For now this was for testing purposes.

In the near future I am probably going to add more layers of abstraction to the final map. I need a way to produce rivers effectively as well as a way to place trees, bushes, stones, and other objects. I also would like to add a temperature / latitude map to make biomes limited by the temperature as well. This may be harder because I want the map to load dynamically. I will most likely have to determine what the max map size would be in order to add poles and equators. Then I would need a system to chose the starting point of the map, so that the player was not always starting in a specific biome or temperature based solely on the latitude. I also need to work on the system of not only generating the terrain data but then taking that data and translating each pixel to a tile. Currently my maps are not very detailed and don’t include all the data. But, I think I will start working on the basic system to going from a pixel map of colors to a map of tiles that will most likely be 16 pixels wide by 16 pixels tall. I may make it 32 but I have not decided yet.

I have worked a lot so far this week on the noise generation for the maps. But I will also continue to work on some art for the game. I have been working on the character art but I still have to finish the front and back views in grey scale before I move to coloring the character. I also need to work on more tiles for the map. Including more ground tiles for different biomes. Tiles for rock, snow, water, etc. I will also need to work on a tile system and an animated tile system. The game is in such early stages that I basically need to build everything, and as I do I will be adding the progressions here.

Screenshots of the map work so far:

Start of 2D Terrain Generation and Perlin Noise Read More »

Grass Block Tiles

Currently I am programming my own Java Game / Engine for a top down procedural generated world game. It is very early in the project and I wanted to share the entire process with everyone. Since it is so early in the project I wanted to get started working on something. Currently I am working a full time job and also teaching a couple classes a year as an adjunct professor of computer science. But for the summer I am not teaching, which allows me to work more on this project. Also with the current situation in the world I don’t know how long I will be working my current job, which is why I am starting this new venture in my life.

This weekend I spent some time working on some grass tiles as well as a bush tile for my game. I was happy with the way some of the basic grass tiles and the final bush tiles turned out. I don’t think I will use all of them but it is a start. This coming week I want to start working on the sprite sheet for the main character. I typically start with a gray-scale sprite and then add the color once I am happy with the way it looks. I know I may be working a bit out of order but I like to mix up working on art and programming so it stays interesting.

Also in this coming week I am going to be looking into using Perlin Noise or another method to start working on terrain generation. I think it is going to be a long road but I would like the game to have procedural generated 2D terrain. That way each time you generate a world it will be unique. Once I figure out the Perlin Noise part of the generation then I can move on to displaying the proper tiles depending on the values. I also will probably implement more layers of procedural generation to handle rivers and other necessary parts of the overall generation. For instance tree and brush locations. I have never done it before and I am looking forward to learning how it works. I know so far that I have not done much but I had to start somewhere.

Grass Tile Assets

Grass Block Tiles Read More »