Some tedious goings ons


I never talk about boring technical stuff, it's not sexy to talk about prefab arrangements or object tag efficiency or scene debug object setups.

I also very much forget all the work I got done when I do this work. This month I know I got the combo system online, and I know I've done substantial revisions to level setups for the better. But I cannot for the life of me remember all the tedious, terrible stuff I waded through yesterday so the exciting stuff could come online.

So just this once I wanted to catalogue a couple of the boring, tedious things I got done today that will allow development to go smoothly tomorrow.

Completely revamped teleporters. No longer do I need to go into a teleporter and find where it's exit is supposed to be, and set by hand that reference, or worry somehow the reference will be lost in the scene file somehow. I assign the beggining and end teleport areas their level value, 1 for the first area, and they will look for the appropriate exit or entry object in the scene of the level higher and lower cycling all assets that have the tag "levelTeleport". This is actually kind of a big deal, because until now moving and adjusting levels was a bit of a nightmare. There was always the nagging feeling of, "Don't move anything too much, you'll break the teleports!". 

A great deal of development has been going into setting thigns up so they "just work" the loading and unloading of assets, teleports, item mods, upgrades, prefixes for items.

I also very recently totally revamped the internal logic of attacks hitting, they were god awfully scattered and overcomplicated. I was just so happy to get the systems working before, I had no mind for if the system could be simplified. Much like an early artist can sit for hours and tediously render small details forever as they pick up new techniques and practices. Now that I'm a bit better I can't bear to look at older systems and setups. Everything could be improved.

I had an epiphany  today while take a little breather. I have a lot of values that need to tick down, like let's say the bloodlust timer, it ticks down whenever an enemy is stunned, and eventually when it crosses 0, they go crazy and become immune to stun. Currently I use a bool "bloodlusted" and I need to do these checks to see if the fish bloodlusted already, otherwise once the threshold is crossed, it would cause the fish to bloodlust every frame, (if bloodlustTimer < 0) would trigger indefinitely, so I need to add (if bloodlustTimer <0 && !bloodlusted). I need to remember to set "bloodlusted" somehwere or else this setup doesn't work. But if I had a function that never allowed the tickdown to simply pass a 0 value, then I could very easily know when this threshold is crossed for a singular frame without having to do do lots of variable checks, I could simply check if (bloodlustTimer <= 0) by having a code like:

if(bloodlustTimer > 0) bloodlustTimer = Mathf.Clamp(bloodlustTimer - Time.deltatime, 0f, 1000f); //Prevents value of 0 skipping

else if(bloodlustTimer == 0){

TriggerBloodlust();

bloodlustTimer = -1;

}

I'm not sure why I'm posting this. It's not impressively clever, I'm sure there are WAY better ways of doing this stuff. I guess I'm just showing off how terrible my code is, and that I don't really ever take time to come up with better setups.

I wonder if there are ways where you could have this code automatically referenced in the update to automatically do this timer, and if there are ways to tie functions to this sorta thing more dynamically.

It would be nice to have a class of variable that automatically ticked down every frame if above a value of 0, and at the 0 tickdown mark, automatically performed a function. I'm sure this is all possible but I'm kind of a noob when it comes to coding. It's really not a big deal, I could probably create a list of classes and do a "foreach" to check their values and do a tickdown per index. 

It's funny, none of this stuff really matters, I'm able to do anything in my project I want, but this stuff would help with some overhead and reduce the mental strain of setting various things. I do with I spent more time developing best practices over the years, but it is what it is. I've always just figured "i'm not a coder, I'm not going to bother trying to set this code up in a way that's smart" and I'm certainly paying the piper now.

I wonder if I could add an event to a class, and then attatch functions to that event so that they would fire when the variable hits 0. I dunno! Too much other stuff to do to really worry about it now. I feel silly working on this project alone at times, the code is so remedial, but I think the game is becoming pretty good.

Pretty lame blog tonight, burned out, not quite enough energy to work on the game, but still thinking about it. Hoping tomorrow is the day zones start coming online. Worried I'll be hit by a meteor tomorrow before all this comes together and all of this will be for nothing.

Get SeaCrit

Leave a comment

Log in with itch.io to leave a comment.