Friday, July 26, 2024

Something something Cloud something

The last few days I've been really focused on getting the cloud setup done right. I've half purposefully set myself up on a clock by activating the Google Cloud Platform trial as I was both up to it, but also as I want to light a little fire under my own feet to get a move-along with things. So, I've managed to get all the bits I need working.... well... working. I've got the domains and DNS all done, they're pointing to the right things, I think I have the setup reasonably secure. There's a little more to do in one area, but that's hopefully not going to be too much effort to bolster.

While I've been doing all this, I've taken a step away from the code to get a moment's breath and to think. My little snippet of world both works and doesn't work. One of my concepts for world geographic structure, although working amazingly well on paper and as an idea, doesn't work amazingly well in terms of load sizes and updates to the app, so I will need to look at changing the way I build the world. I'm not changing the code, just the way I implement things to manage the amount of data that is sent to the app in certain locations. If at some point in the future I can send larger data packets to the app without lagginess, I can look top implement some of the original design. For now, I'll tweak world design to function better as is.

My to-do list is shrinking delightfully. I need to find a place to allow non-combat spells and abilities to be used. I think I'll drop it into the front character screen, but I'm not completely sure where that will sit on the screen yet. I'd like to also tweak the main app screen/activity to interact with the light of the current character location - when you go to a dark place, the background should be dark, when you're in broad daylight, the background should be light - and that sort of thing. It's sort of simple enough to implement I think, and I can probably add it to the realm to do even more with it, but I think that sort of small thing will add to the immersion nicely. I think they're the two big things I want to tackle next. That'll probably do me for the weekend. Also, at some point, I'm going to have to say goodbye to the lovely little test-world and start building properly. That'll be both sad (saying goodbye to my test snippet of the last few years of dev) and awesome (as I start building the actual game in a way that functions nicely).

Tuesday, July 23, 2024

Sometimes you do the same thing really well. Twice.

And each time, you do it for the first time.

So, lets start with some back story here. While I was doing all the recent changes to the code in the way that static files are served to the app, I found a few things to be true. Firstly, the data sent was much larger than I thought it was. But that's not the important part, just leads to it. Anyhow, when the app gets new terrain information, it updates the min and max x and y coordinates of what it has, so that it can go and request more when it approaches the end. As I was working on creating the data files to server to the app, I saw the error in that code, and sadly worked out that while it worked in an ideal world, it would be very easy to have a "gap" in the map between the min and max coordinates, but with a blank bit. Sort of like a hole in the centre of a sheet of paper. Then what would happen, it wouldn't request more terrain, but it wouldn't have terrain to display.

So, the solution I came up with was that it would request new terrain each time the party moved a certain number distance in any direction. When it did that, it would take a note that it had asked for that location, and then if it got there again, it knew it had it, so no more requesting it. Great, that's the app covered, but I should put that same functionality into the editor I use to create the game world right? I can get rid of a bunch of other database entries (even longer, unnecessary story there). Getting rid of those entries would make the data chunks sent to the app smaller. Everyone's happy.

So I open up the editor code, start working backwards in the code from a particular action to try to find the point in the code where the trigger lies that causes more map to be loaded. Hey presto. It checks to see if you've moved a certain distance in any direction, and once you get past it, it will fetch more data from the server.

Just like the app does. Now that I updated it.

At least I know that I got to a nice elegant solution twice, apparently each time thinking it was the first time I'd done it.

Monday, July 22, 2024

MOAR MOAR INTERNETS

Ok, it's been many years coming to this milestone, but I finally got the app working on an actual server, over my phone's signal, and it worked. It actually worked.

Got to say that the weekend was basically a marathon coding session, then an environment setup session. And then a lot more coding to accommodate all the actual changes from my local setup (serving static files from buckets and not a local file system) and the crowning gem.... getting a cloud run server to talk to it's cloud sql companion. Ugh. I loathe, and I don't even feel that word is strong enough, environment setup mixed with on-the-fly code changes and tweaks.

Anyhow, the music is thumping in my house currently (the missus is out at choir) and I've got a celebratory vintage here. It's small things, but it's glorious milestones.

Reality check though, the server currently isn't as secure as I'd like it, so tomorrow after work, I'll try to work out how to screw that down a bit more. Then there's a few tweaks I'd like to make, and I might actually start to build out a world ever so slightly, so that when I start to do some alpha testing with a few friends, it'll actually feel more like a game, not a semi-finished broken test-build.

Sunday, July 21, 2024

Something something GCP something

Today, being Sunday, I wasn't working, and today I had the day to code. Looking at where I was up to, I decided to finally crack open the bundle of joy that was going to be setting everything up on a cloud product. I have chosen Google, as I'm at least a little familiar with it.

I say a little, as today was a textbook example of frustration, patience-sapping and generally statements along the lines of "Why? What do you mean? Well, that doesn't make sense!" and a lot of clicking, enabling APIs, more frustration and this sort of general cycle, but with more cuss words and the like.

However.

As I am finishing this up, I managed to load the app up here using a mix of online and local servers, which is a huge step forward. Now that I know that half of it is working and serving data (the static side) I can now look forward to working on the database side on the cloud product in the coming evenings.

Progress. Tiny, painful, frustrating, but delightfully glorious and fabulous progress.

Friday, July 19, 2024

Server Code and Loads of Performance Tweaks

Boy, there's a lot of updates to get through. I had a pretty free evening last night, so continued straight into the server code and got huge chunks of that finished off (and some more this morning) so that's looking really really solid now. I've only got some images now being called from the server for inventory items, which I've somehow missed I think - and aside from that, it's all coming from the internal app asset files, or from the new server code I've been working on - so that's really really sweet.

However, the bigger update is that while I was working on fetching world data from the server (and processing it in the app) I found that the app was getting really buggy, locking up the interface and other things like that which were red-line issues. So, first things first, I managed to do a quick rewrite of the bit of code that handles the main user interface to move the party about in the world. Made it much much simpler than it was (now that I understand a little more Android that seemed much simpler than it did before) which instantly yielded an improvement in terms of what movement felt like. Instantly much smoother and feeling a heck of a lot more responsive. So win there.

I also then looked at how things were being handled when data was being fetched from the server, and managed to update the code so that it spawns a whole bunch more threads when it needs to, so that once again, the app feels an awful lot more responsive and doesn't lag up when request are being processed. I'm still going to see what I can do to get further efficiencies, but last night was a super productive effort which is making me feel great.

I think I'm finally getting close to testing this out on an actual online platform to see where all the gaps potentially are when the network is laggy and finding what breaks.

Wednesday, July 17, 2024

It's all about the Server Code

I took a day off yesterday to get some finances sorted out for another year, and had a good bit of time in the afternoon to roll my sleeves up and write some code. It's finally been time to focus on what a server codebase might look like, splitting the sections that must be database driven, and what I can do without making all those expensive calls.

The big upside is that I've been running my app on a makeshift placeholder codebase, using a lot of code common, or similar to what my editor uses. So I had a good foundation already for the information needed by the app and how it was being consumed. Using that base, I created some clean server code to use static pre-made files to serve where possible to the app. That also meant that some of my app code had to change ever so slightly, but nothing too much there - primary change was a tweak into how/when the game requests more terrain from the server.

This evening, I'm hoping to get a good bunch more of the server side coded up and replace the current database calls still being made for those particular requests.

So, I started this project to write a game engine from the ground up in 2020, and for a long, long time, it's felt like I'm barely scratching at all the work that needs to be done, but I have to proudly say, of late, I'm really feeling not like I'm looking down a long tunnel to see a pin-prick of light, but that I'm almost at the sunny entrance itself.

Monday, July 15, 2024

New Player Setup Tweaks

I've been focused on getting the menu set up properly for new players, so there's been a lot of tweaking and finesse'ing of how the app handles a new account. I'm hoping that I've done enough basic testing, but it seems to now make you create six characters before it will let you launch - and you can do stuff like reset the app etc between characters and it picks up in the right place. I mean, sure the first time someone else does it, it'll break, but jokes aside, it's feeling a bit more resilient and set up for a new player nicely now.

So... server code it is!

Oh, and while I was looking at this code update for new players, I did find a few places that I'll need to tidy up in a similar fashion, but that shouldn't be too difficult - just bullet-proofing code and also circling back with a better understanding of android to some of the early screens I'd done which can do with a fix.

Something something Cloud something

The last few days I've been really focused on getting the cloud setup done right. I've half purposefully set myself up on a clock by...