Weekly Updates #58 - Building the level... please wait!

Published August 24, 2019
Advertisement

Well, look who's here! it's you again! And yes, this is your favourite Weekly Updates blog! This week has been quite busy in refactoring. I reworked a lot of code to make my title card much more responsive and fluid. It was a technical feat (at least for me) but the results are worth it! Aside from that there also a bit of bugfix among other things. But anyway, there's a lot to cover so let's get this thing started!

Fluid Title Card

First, I continued implementing my title card. The challenge here was to correctly identify the code that can be isolated and refactor it to make it run on a secondary thread. With a little code reading, I discovered two pieces of code that could be isolated: the generation part and the rendering part.

Level Generation

The level generation code being identified, I was able to isolate it and make it run on another thread. By reusing my threaded .mp3 file reading code it was rather easy. Next, I just changed the return value of my level generation function to an IEnumerator, thus effectively making it a coroutine. Afterwards, it was just a matter of adding a yield expression to wait for my thread to finish and that was it.

Mesh Generation

However, there was a problem. Unity is very strict in terms of multi-thread. This means no access to MeshFilters from secondary threads. To remedy this, I had to refactor my level rendering functions so that they also use coroutines. With a few well-placed yield statements well placed I was able to avoid freezing the title card significantly.

Admittedly, this caused some other problems such as reflection probes that would render at the wrong time and whatnot but nothing impossible to fix.

The Result

With that big refactoring, the title card can continue to animate without any problems. Here's a short video showing this off:

The Bank Room

Second, I've also implemented the game's bank system. For those who forgot, players can encounter a bunch of special rooms during a run. Each special rooms got their own purpose. If players encounter some padlocked doors and have at least one key, they can open it to find out which type of special room it is.

One of these special rooms is the bank. With this room, players can deposit or withdraw money into a savefile-persistent bank account.

While depositing money is free of charge, withdrawing some, however, isn't. Each bank has its own transaction rate. Depending on the player's luck, the rate can be between 25% and 75% of the amount to withdraw.

Each bank has two windows: a green one (deposit) and a red one (withdraw). Players just need to walk-up and interact with the window they want to use.

image.thumb.png.e38eb4c34cb5d10efd07f68711686fcd.png

A popup then appears. For the green window it this popup appears:

image.thumb.png.352072d4282b417e66aa4d3b6beef543.png

The player only has to enter the amount to deposit. When the field changes the popup updates the total amount in the bank after the operation.

And for the red windows, this one:

image.thumb.png.8662a1f0c18694151ada7d1704b643e6.png

Here, the player is asked for the amount to withdraw. The popup also specifies the banks' transaction rate. Then there is also the total amount remaining after the transaction.

And that's about it for banks.

Minor Updates

  • Added a new Memphis texture to the title card blue strip
  • General optimizations and code readability upgrade
  • Many quality-of-life refactorings
  • Added a bunch of helpful ToString functions.
  • Fixed a bug where reflection probes weren't placed right
  • Optimized and refactor a bunch of GUI elements
  • Upgraded the reflection probe resolution.

Next Week

I'm planning to check if there's any other room that needs to be completed first. I'm also planning to work on my GUI.

According to the profiler, most of the slowdowns appear to happen with the GUI so a good optimization is in order.

Aside from that I also want to start implementing many other relics, even perhaps modelling some too.

After all of this, it's brainstorming time!

And finally, it's your usual suspects.

So yeah, that's about it for this update! See you next week!

2 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement