Week 9 Game Engine Progress

Game Engine Work:

This week was a great week. I was able to get started on the procedural mountain generation. For the most part I was able to use a lot of the same code from the edge detection to generate the mountains. I only have one layer of mountains currently, but I plan on adding several different layers, so it looks like mountains instead of a one high wall.

Mountain Inner Corner Test
Image showing the inner corner checking system before the proper tiles were put in.
Mountain Inner Corners Done
Image showing the mountain generation after the corner checking was done.

Also this week I was able to get the first tree rendered in the game. I first rendered just one tree. Then I added a bunch. When I initially added them randomly in the forest area all over the world map the games fps went to almost zero. It was unplayable. I knew that I needed to find a way to limit what entities would render. After a little tinkering I was able to limit the rendering all the entities not just trees.

I calculated the distance the entities were from the current player position and then anything further than off the screen does not render. I also tested this on the Rabbits, and it worked for them too. Currently the movement of entities is still calculated, but not rendered if they are off the screen. In the future I may need to also not calculate their movement if they are for say on the other side of the map.

Now that I have the trees rendering, I can start working on an algorithm to better place them in the game world. Currently I am only using the built-in rand function to place them. I need to investigate other better algorithms for placement.

I will also need to work on the rendering order for entities. Currently the player is always on top of the trees, and rabbits run under them. I need take all the entities and take their y coordinates and then sort all of them based on there height on the map. Then depending on the height, it will draw them in order from highest to lowest on the screen. This will be accomplished from sorting the array of entities and then drawing them in order. I hope I can figure out how to implement it this week.

This week I also started working on the beginning of the GUI system for the game. Currently it is just a couple of boxes and components. But I will be working more on it this week if I have time.

Game Art Work:

Trees Rendering for the First Time
Image showing the trees rendering for the first time. Photobombed by the rabbit.

I wanted something that I could render easier. With the current tiles it would just be one tile high instead of several like my previous tiles. But as I add more layers, they should look ok. Now, that I made the current mountains for my game they render in for the most part in one tile. Then I calculate the inner corners to make it look correct. I’m very happy with the way they are turning out so far.

In order to render the trees I needed to have a sprite for it so I made my first tree sprite for the game. I was failing miserable making trees, so I went to YouTube to watch tutorials on pixel art. After watching several tutorials I was finally able to make a decent looking tree. I am sure with more practice I will be able to implement many different trees into the game.

Work Planned for the Upcoming Week:

This upcoming week I plan to continue working on the mountains. I want to add several layers and see how they look from there. I also want to work on an algorithm for placing game objects around the world in a much better pattern. Once I have the trees worked out then I can start adding patches of grass and other objects.

I don’t think I will work on River generation this week, but we shall see. I will be working on getting an animated tile class working hopefully. Once I have that working, I will be able to add my animated water tiles and see how they look. I am happy with the progress so far, and I can’t believe it has been 9 weeks since I started working on this. Let me know your thoughts on the project and any suggestions you may have. Until next time.

Leave a Comment

Your email address will not be published. Required fields are marked *