• Tuna

Catching up

I last left off with me talking about how I was going to create the procedural panel spawning. So here I am to catch you up on that!


So what I wanted to do was create a spawner where it was going to spawn panels from left to right, each panel being random.

So here is a list of tasks I needed to do to get this working:

  • Create object pooling

  • Create panels assets that contains different art.

  • Create a panel spawner.

As I am creating this game for mobile; I didn't want to constantly instantiate and destroy new panels all the time as it can use a lot of memory and cause lags spikes, so I implemented object pooling throughout the game. If you don't know what object pooling is I'll give a quick explanation. Object pooling is when at the beginning of the game you create all the object in the pool you want to use, I'll use bullet holes as an example. Now every time you want to use the bullet holes you would then grab them from the pool instead of creating a new one and once you're done with it they return to the pool. I used object pooling for pretty everything in my game, ranging from obstacles to panels to even pick ups. Thus saving me a lot of memory.


With that problem done I made my way into the art side of things. Firstly what I did was fixed up the panels I currently had. They were a bit too bright and blended in with the player character too much, easily fixed with some lower saturation and brightness. This makes the character pop out a lot more and separates the foreground (the space in which the game is played) from the background.

Next, I created a few extra panels. A bathroom that contains a hole in the floor (I'll explain what it does later on), lounge room and a garden panel. The process behind creating the panels is quite simple. I first do research and find a lot of pictures that I think would suit my style. I then sketch a quick drawing and layout of how I want it to look. Then I would just look at the reference photos and create the panels based on the layout.


Now, this is where I begin to code...actually coding this wasn't as bad as I thought it'd be. It was fairly simple:

  • Get a random panel from the pool

  • Get the spawn position which is the previous panel position + (the current panel position + the halfwidth of the panel)

And that's pretty much the gist of it. To spawn a new panel I just had a trigger far behind the player which gets triggered when entering an active panel. This returns the active panel to the pool and then spawns a new one.

Disclaimer: I made it to spawn step by step to show the process, but on the final version it all spawns at once.


Later on I do add a lot more features to this spawner but that's for another post.

1 view0 comments

Recent Posts

See All