Tuesday, June 27, 2023

Zone Spawns starting to function nicely

I managed to get some good upgrades done to the encounters and zones code over the last few nights. The server database now stores all the correct game info with encounters, zones and chances of each thing spawning in there. I've managed to start connecting other things nicely too, so for example, I set up a test of a "Giant Spider" as well as a "Monstrous Spider" and set each encounter to use the same animation model, but render them differently depending on which one it is, and that worked a charm too.

I think tomorrow I'll start on Monsters directly in the editor, as that's the next thing I'll need to connect through to the encounters code I currently have. The editor should be able to then determine for me the right model to use for each encounter and so on, replacing the manual selections I did - or probably just prompting for one and letting it be over-written. I'm not completely certain, but there might be a few minor bug fixes to resolve in terms of the EXACT screen locations that models are rendered to - bot sure if all the correct information about offsets and scaling is making it's way through to all the right places - but that's going to be hopefully quick.

Lastly, I gave the app a session on the profiler, and it seems to be ticking along very nicely, maintaining a consistent memory footprint, similarly, on my physical device, it's running at a nice respectable framerate. Always a brown-pants moment after major code changes to check if things got screwey, and always a relief when things work nicely.

Saturday, June 24, 2023

Order of Operations

I'm calling it an evening for tonight, and I'm leaving the app in a state I don't like to leave things in overnight, but my brain has run out of smart-juice to make it all function nicely - so it's taking a sleep in a "doesn't run properly" state.

I have been working on the code for realms, and encounters along with the adjacent bits and bobs. The issue is that I've been calling things asynchronously, which is great for an app really, as it lets things happen in their own pace nicely, but I've come to a state where I need things to happen sequentially and that's not playing nicely. I can't properly load a realm until the possible encounters are loaded. I can't load those until the animation objects are loaded. There more along this thread, but you get the idea - and this is causing really consistent crashes in the app as things try to load and function out of sequence.

The solution is to re-write a bunch of the logic that is processed at the start so that when the game fires up, it loads all the "base" data first, setting all the right data structures to hold the library of information, then start to process the actual world for the player. I reckon I'm almost there, but I just don't have enough left in the tank to finish it up - the code I wrote to wait till everything was loaded up before enabling the "Launch Party" button along with other things needs updating, and it's been a long line of Fix issue A, find Issue B, fix Issue B, find Issue C and so on.

So... perhaps tomorrow?

Friday, June 23, 2023

Realms (Zones) and Spawn Rates Editor Interface Complete

In another update of what's boring to everyone except me, I rounded out the code for the editor interface to setting up Realms nicely, from the various lighting and weather effects for each area to setting up a spawn table as needed. I've still got to process all this out into the app, but that should hopefully be the easy part tomorrow. I'll still have to add some bits for item spawns in an area - as well as circling back when I properly integrate monsters into this equation - but that's going to be easier and quicker than what's been done on this currently.

So, weekend plans for the code are to try to have the app correctly picking up all the data for zones properly, cobble up a few more animated objects to be able to completely purge the old placeholders in the app for the party model etc. Anything above that will be sweet.

Wednesday, June 21, 2023

Realms (Zones) and Encounters Starting to Function

Having recently rounded off some corners nicely on complex animation objects, I've connected those new goodies to encounters (or spawn for lack of a better word) and then updated all the interfaces and places where I need to make those work. Next thing to do has been updating some really really old placeholder code how Realms/Zones work in the game and what they mean to the app itself.

So far, I've only ever had a rough placeholder object holding the fort so to speak as the app went through unit testing in other functionality. The time to finally start to connect all these dots (and update to real code) has come, and I've been working to roll out the right interfaces in the editor to be able to create new realms along with all the things that they need to store, such as ambient light, possible weather, and (finally connecting back to how I started this post update) encounters, how many can spawn, what types of things pop up and the chances of each. I'm still working on all the code that handles this, but it is coming together nicely and the app is happily lapping it all up quickly and easily - and it's damned nice to see the new features coming to life in the app, both in new updates to the code and old code that was sitting there waiting for real data to finally come flowing through.

I'm expecting a rather long work day tomorrow, but hopefully on Friday and over the weekend, I'll be able to really dot the i's and cross the t's on some of this stuff and start to work on the world editor to actually implement a proper way to create/enter/stuff the realmID connected to how that part of the world should behave and what it can do.

Yes, the party model in that screenshot is a giant spider. 'Cause I was testing that model out, and what better way to do so, than to see the party skittering about on eight legs. I also need to circle back, create some more animation models to use, connect them to some stuff and start to drop them about so I can start to work on the creature/encounter brains a bit more. 

Yes, today is another day where I realize the sheer scope in deciding to write a serious game start to finish solo (and I nod, grit my teeth and look to the destination, past the current pain) and crack a bit of a grin.

Sunday, June 18, 2023

Party and Monster Animations Update

So, first off, I am keenly aware that it's been a good while since I updated, and that's not for lack of trying to get good work done, but mainly due to work (the one that pays the bills) being very demanding of late, resulting in a good few late nights working on that rather than code. Coupled with what I'm currently doing which has been very limited in showing updates, it's been rather a dry spell.

Moving on to better news however, I've been plugging away as much as I can and what I've gotten working is great. Following up from the animations code I had written up, I've written the editor interface to create animated objects as collection of individual animations and pass that through to the app, along with all the individual optimised animation files and written up the code to assemble it all in the app into a coherent content driven class.

Changing into non-technical-nerd-speak, that all means that I can import assets nicely and assign them to either the player party/characters or monsters (though still have a few lines of code to write there) and the app will create/use the correct animation files to render, along with all the required actions and so on. The screenshot shows the party using a spider animation while I was testing things out, and it move delightfully about in all the directions etc. It's taken a while to get here in terms of code, but I am now on the brink of having the ability to import and use various assets in the game in a completely streamlined and simple process - and all while no longer having to pull each individual animation frame from the server, but rather storing the main assets directly in the app.

Sunday, June 4, 2023

Animations Loaded from Optimised App Assets Displaying Correctly

What a mouthful that title is. But.... it's exactly what it means. I managed to get a bit of time this weekend to work on my code and finally got the next bits working as I'd wanted them to. 

I previously managed to get my editor outputting optimised bitmaps to a folder location, but now have the app picking those images up, along with metadata about how to render them properly with their optimisations on start-up, finally slice up the resource in the app into frames, then render it all to the map properly.

I totally get that I'm getting deep into the weeds here in terms of technical stuff, but I've been working towards this for a damned good few nights now, so seeing it all render properly as it would be is finally a delightful. Here's what it does in detail if you're interested.

Lets use the image above as an example. The torch has 6 frames in the animation. It's rendering to a 64x64 space. If I was to use a 64x64 bitmap sized correctly, this would take up 96kb of RAM in the app to store that animation. I had already worked out a way to keep certain tiles (not animations, but I could have done so) in a smaller native resolution, then scale them up. So, lets say that I stored the torch animation in a 32x32 pixel format with 6 frames of animation. That's 24kb of RAM. Much better - that's why resolution is so crazy important. However. With the extra optimisations I've managed to add to trim unused pixels from top, bottom, left and right, then the extra code in the app to make sense of it all, the full animation only takes 5.5kb of RAM. That's a huge saving and why I've been working towards this for a good few coding sessions now.

This will now happen automatically for every animation I create with basically next to no effort on my part to do all that other than selecting what frames from the original asset spritesheet go into the animation.

Simple They Said... Simples...

The plan for yesterday was a simple one. Just get ability-use to cost the right amount of each pool, and deduct it from whoever uses it. Tha...