Yo! what's up? This is your favourite Weekly Updates blog! This week was really intense. It was one of these weeks that actually gave me a headache, which is quite the feat to be really honest. I was also able to add new pieces of equipment too so without any further ados let's get right to it
The Seeds
First up, I've been cooking this one for quite a while. With the game being a roguelike, most of its levels are procedurally generated. One perk of this is to always have different levels, which in turns can greatly augment the lifetime of any game.
Procedural generation is kinda like a guided RNG. We simply use random numbers to decide everything in the game. However, because we're using a computer which is deterministic our RNG will inherently be deterministic too. Thus, in computer programs (including video games) we instead use a PRNG or a pseudorandom number generator.
PRNG uses a variety of parameters to generate seamlessly random numbers. Usually, this takes the form of a seed. A seed is usually a unique int which is passed to the PRNG to generate a different set of numbers altogether. This effectively means that a PRNG seeded with a specific seed will always give out the same numbers. This is particularly useful when debugging or testing code. In video games like a roguelike, seeds can also be useful as a way to share unique games that can be quite fun to play. Usually, because people don't like to write down numbers seeds are usually given as a random string of characters. This way people can easily share their favourite seed around without any hassle.
As you can see this can be quite useful. However, it comes with a caveat. PRNGs are deterministic generators, and as such by using a given seed it will always give out the same numbers every time. In case of procedural generation, this can be quite the hassle to deal with. Effectively, every action involving RNG that is taken will affect the next one. This can mean that opening a chest can radically change the layout of the next level.
This kinda defeats the purpose of a shareable seed. While this might be out of our control we can try to mitigate its effect by being smart.
PRNG Isolations
One way to help with this issue is to isolate most PRNG calls as much as possible.
In order to achieve this, we simply need to take into account the fundamental nature of a PRNG. We know that with a given seed every number will be the same as long as they are requested at the same order every time.
So now that we know this we simply need to make sure that the most probable PRNG calls are done first. But how can we do this? After all, procedural generation is, well, procedural. Even if we prioritize the most probable calls the player still need to take action in order to continue the generation.
This problem can also be fixed with some tools. First up we don't really need to pre-generate every level and holding it in memory until it's needed. Instead, we must always remember the nature of PRNG and their relation with their seeds.
With this in mind, the answer is quite simple: we'll simply use the main seed to generate more seeds! We can generate as many seeds as we want too! So let's generate a seed for every level from the get-go. This way we can use those seeds when we're ready to generate a level. Thus, every level generation is isolated. Now a player's action won't have any radical incident on the next level. Problem solved.
But I hear you say: It's nice to have seeds and all, but how can you effectively save and load seeds? Well, in my case, Unity got me covered. Unity's Random class have a special State property which is easily swappable. In essence, it's like taking a snapshot of the RNG. This is quite useful, because not only is it safer than handling seeds but we can even return to a previous state i.e. return to an earlier random value and continue from there.
In other game engines, a similar functionality should be available. So keep searching, it's there somewhere!
So to recap now we properly isolated each of our procedurally generated levels by generating sub-seeds for each level. But this doesn't stop there...
Go Beyond!
Up until now, everything I've said was technically already there. Each of my levels already had uniquely generated seed with isolated states.
This means that everything was pretty much always the same no matter the player's previous actions. However, this didn't apply to loot. So, to deal with this I've decided to extend my sub-seed generation to the individual room of each level. By doing this I was isolating each room form each other and subsequently each loot by each other. Now I can properly say that the game is as much replicable as it could be no matter the player's actions.
Item Pools
Next up, I've also implemented a new Item Pool system. Previously when players encounter an item in-game they would, depending on their luck stat either pieces of equipment, relics or a certain amount of consumable based on their needs.
Basically, there was no specific type of relics to spawn in specific contexts. In the Binding of Isaac, the game uses different item pools to spawn for different contexts. For example, there's a boss item pool used for rewards after beating a boss. This was a clever way for the game to balance the run.
This also meant that players would rarely find the same item twice as once an item spawns it gets removed from the pool. A pretty good solution if you ask me.
So after really thinking with the PRNG, I've also decided to add different item pools. In my case, each context will give different types of relics. This means that in order to get the full experience the player needs to find hidden rooms and get unique relics that can only be found there.
These item pools contain both relic and activatable items. Each pool is then subdivided into three sub-pools, one for each level of rarity. When a sub-pool is emptied we then pick items from the previous sub-pool. Once all sub-pools are emptied we then pick from a default pool and if it too is empty then we spawn a default fallback relic, much like how it's done in the Binding of Isaac.
With this in place, it's only a matter of balancing them out to get better more rewardable gameplay.
A Default Relic
With this, I still needed to create a cheap underpowered relic which effect would easily stack up.
I've decided that a simple HP up would be necessary, so here it is: the Golden Heart:
Golden Heart
Stats
- HP : + 1%
Description
This is a solid gold heart. It's made of solid gold.
With it, the player gets a very small HP bonus along with a slim better chance of spawning hearts from loot.
As I said, this will be our default relic. When the player mainly sees Golden Hearts as loot then it means that the given item pool was emptied.
You can also see it normally too as it is part of a normal item pool, so don't worry about it!
New Chest Wear Items
Finally, I'm happy to say that I've also been able to add 6 new chest wear items:
The Tuxedo
Focus: Vaporwave
A baby blue tuxedo. This is really classy.
Stats
- ATK +1
- DEF -2
Description
This is a blue tuxedo. With it, the player gains a discount on mall items. With the correct focus, the player also gains a +4 defence bonus.
The Jumpsuit
Focus: Vaporwave
A nice tight jumpsuit. Makes you feel invincible.
Stats
- AGL +3
- DEF -2
Description
A yellow jumpsuit. With it, the player hits harder with melee weapons and can double jump. With the correct focus, the player will even gain a +2 luck bonus
The Toga
Focus: Vaporwave
A simple Toga. This is really comfy.
Stats
- AGL +2
- HP +5
Description
A simple toga. With it, players can resist status effects. With the correct focus, they will also earn an additional discount at malls.
The Iron Armor
Focus: Hardvapor
A really heavy shiny iron armour. I like its style.
Stats
- DEF +5
- ATK +2
- AGL -5
Description
Aesthetic body armour made of solid iron. It's part of an ensemble. While wearing it the player will make louder sounds. With the correct focus, players can reflect statuses back.
The Football Gear
Focus: Hardvapor
A set of American football gear. Comes with a jersey and a chest plate.
Stats
- DEF +2
- ATK +1
Description
A typical display of American football gear. With the correct focus, the player can hurt enemies by charging at them.
The Elegant Robe
Focus: Vaporwave
A really pretty robe. It's shiny and looks quite luxurious.
Stats
- DEF -2
- ATK -1
- LCK +5
Description
An elegant silk dress. With the correct focus, players can make enemies frenzied while attacking them.
Minor Updates
- Fixed a bug where the attack speed wouldn't get changed at all.
Next week
So I'm mainly going to continue with the pieces of equipment. I'm almost done with chest wear and will be starting gloves, rings and other hand wear items soon.
After this is done I'm going to get right into bosses. Maybe edit the one already there or adding another one I'm not sure.
After all of this, it's your usual suspect.
So yeah!