Monday, July 29, 2024

Non-Combat Abilities, Usable Items and App Colors Working

So, I set myself some pretty ambitions targets for the weekend, and I almost, mainly got there in the end, but not quite. So tonight, I managed to pull out the last little bit which did end up (as always) taking longer than I'd expected it would by a bit. However, here's the good news:

Firstly, on Saturday, I started with and got the location colours working nicely in the app. Go to a desert area, the app should show a sandy colour as the background. Go to a deep forest, it'll be a deep green. Caves or dungeons? Probably dark grey or black. It'll also shift up and down in brightness with the day/night cycle in the game. It's a small thing, but hoping it adds to the immersion.

Secondly, I started on Saturday evening to set up all the layouts and things, but it took me well into Sunday to get a basic setup working for Usable items in the character screen. The idea is in your inventory screen, you can just double tap an item and use it on yourself, but I wanted to combine both abilities that a character could use outside of combat, along with items that might help another party member. I did find a few additional properties that needed to be added to items and also abilities at this point. Anyhow, I'm rambling. I got it working so that if you selected an item to use, it would show you a list of possible candidates to use it on, and then apply it to the right party member. I didn't quite get that same concept working with abilities, though I got close.

Lastly, I said I got close, but being close still took me all this evening to get quite right. So, now, finally, clicking your character non-combat skills can get them to correctly work on a fellow party member.

I swear, the amount of effort and code needed to sometimes get the simplest thing working makes me appreciate just how much effort goes into game development. 

 "I want my guy to cast a spell on my other guy..." the sheet number of checks, processes and code that is executed when this happens is genuinely dumbfounding.

As I've been working on this, I have noticed that I've rather completely dropped reagents from abilities, but I'm ignoring that for now. I'll fix that up in the future.

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.

Saturday, July 13, 2024

Sounds are ready to Go

I can say that sound now works functionally in all the spots that it's supposed to. You wander about, there's footsteps. Monsters attack? There's sounds. You go into combat mode - all the right sounds are played at the right times. Trading? Sounds. Equipment? All there.

It's a great and productive weekend.

There are some things that I didn't get working, which was rather annoying though. There's some rather fundamental limitations on the SoundPool class in android - and that makes doing some of the things I wanted to get done rather impossible. I wanted ambient sounds that got louder as you got closer to them - so walking up to a fire would mean you hear the crackling and popping of the fire louder, and then softer again as you walk away. Problem though, you can't adjust the volume of a sound that is playing without stopping it and starting again. That means that looped sounds would bork each time the volume was adjusted. There's also no way to see if a sound is currently playing. Again, that makes it very difficult to do looped sounds along the lines of "If this sound isn't playing at the moment, play it please". I might circle back at some point and see what I can do with the other prebuilt sound classes, but I think the only other one that offers what I want is at a lower level again than this, which means having to handle a lot more fundamental code to get the outcome I want.

In the meantime, this really is quite good enough for now. I'll eventually circle back once I have done more of the game to pick up things that I find along the way, and tweak them, but for now, it's good enough.

I think I'll try to tweak the landing page for new accounts so that it's an easier process to follow to set up a party and the like. That should hopefully be pretty quick and easy, then I think it will be time for getting server code ready in preparation for some alpha testing.

Friday, July 12, 2024

Sounds now working for effects

So it's a friday night, but I got some code in after work. I've been building out the different places I want sounds to happen, and I added in sound capability for Effects in the game, so there's the potential for effects (buffs and debuffs) to have a unique sound when they are first applied, when they tick over and when they finish up and are removed from the player/creature.

It's not a huge update, but it's another thing that's off the list - which is great. Creatures next, so all the random sounds and then attack/defend etc sounds next.

I would like to add in ambient sound at some point, so that walking past certain things will make them give off a sound - a fireplace can sound like a fire and so on, but there's a lot of work I think to get that right, and right now (at least tonight) my brains is not in the right gear to sort that out. Part of it is that I'm thinking about the problem scope. Something like a fireplace is easy, there's probably going to be one on the screen at a point in time. The closer you are to it, the louder you play the sound. Get far enough away, and you stop playing the sound. But what about say.... lapping water at the edge of a river or beach. And again, as I'm writing this, I'm thinking through the problem, so the right thing to do is process ALL the possible sounds by type, and then play each type at the highest volume that was surfaced in the surrounding area. So if I have a fireplace nearby, play that at the right volume, but if there's five places that emit a "waves on the shore" sound, play it once at the highest volume found. Good job for hanging about as I process this in real time. Thanks!

Thursday, July 11, 2024

Sounds work continues

Building on the generic sounds that I was starting to implement yesterday, I've managed to build out the app with some basics. Items now have an inventory sound and a use-item sound. I've picked up some sound assets too, though I'm having to tinker with them a good bit for my purposes. I've also added the code for using functions to get it to play whatever sound is attached to that ability. There's still some work to do with extended casting sounds - ideally I'd like to hear a background "casting mumble" until the spell is going off.

So, super short, but useful update. Gotten a good bit of productive work in this evening. Heading into a weekend on the back-end of a very industrious week is always a great thing to look forward to.

Wednesday, July 10, 2024

Sound, sound, glorious sound. And a load of other stuff.

So, there's been an utter flurry of activity here on my end. Most fantastically, I managed to implement sound in the game over the last two evenings. Not everywhere yet, but I have some generic sounds happening when they are supposed to happen - but more importantly, I think I've set up a framework to manage sounds that are loaded into one of Android's sound-playing-thiongy-majiggies. Given limited app resources, and sounds taking up a lot of space - and knowing that I actually want a LOT of different sounds, I've devised what I think is a cunning and elegant solution to manage when sound files are loaded up ready to be used, and when they are dropped back out of memory. Right now, it's super cunning as I haven't started to really use it yet, so there's no bugs. But I have good confidence. And I've got sound. It's utterly awesome for the first time hearing pages turn as you swipe through character screens, and coins exchanging hands when you sell stuff. With luck, tomorrow I'll start to set up some more generic and then item sounds. After that abilities and effects.

Now, that's the flashy thing, but I also did come back and fix up my character reset screen to look much better than it was before. I also managed to get in and tweak my editor to handle inserting them into the world. They now work in the app nicely too. Especially as I'm working on testing out classes, I'll need to easily access and reset characters - this will help me when I get there, but also I'll leave a few in the world so you'll be able to test out different builds with characters.

What else.... oh yes. I tweaked a lot of the lighting code and the way that the party light itself is rendered. Lighting that is in a world location, that is basically all the lighting aside from the party and character lights, as stationary, and therefore render exactly the way you'd want them to as you move about. Not so the party light. It was jumping about horribly and looked pretty trashy. I tweaked some code (again, using more memory and some extra processing power) but the party light now shines super smoothly and looks great. At some point, I might consider trying to redo the way I've done the graphics engine, but what's there is good enough for now I think.

So, sounds ahoy over the next few evenings, but generally progress that's really making me happy.

Sunday, July 7, 2024

Scratching the Itch

I've been buying various graphical assets for this game mainly due to the fact that I have all the artistic talent of a rock. One of the artists who I have purchased some assets from recently release his own game, and I thought I'd download it and give it a play. Going to be really honest. I don't know what I'm supposed to do in the game really, and I have no idea how to navigate around it. There's seemingly two sections, one where most th4e the "you're involved" stuff happens, and another where you sort of get to see the results of your efforts. And I tried. I really did. But I have no idea of what's fricken going on. The part where you're supposed to do stuff seems wishy-washy, but okay. Then there's the other part, but that's a nightmare. Nothing seems to make sense, and I actually (twice) had to restart the app as I could not find a way to get from the second part back to the first "doing" part. I've left that super super vague as I don't want to hurt anyone's feelings, but I re-learned a rather important lesson today.

If the user-interface doesn't make sense without any effort, it needs to be improved. The UI has to be intuitive and an action that the player wants to do both needs to be obvious, but also logical.

So, with that at the forefront of my mind, I circled back to the inventory screen and tidied things up. I have had a half-finished interface for splitting stacked items up there for ages, and it was always "not-quite-there" but also good enough not to crash if you did the right things in the right order. Time to clean up. I worked out a way to limit the values to split stacked items into numbers that made sense (can't split a stack into a larger stack than it is, can't split it to less than zero, can't split an item if you don't input a value at all) and added a lovely slider that makes splitting the item even easier. The most satisfactory part of that only just pipped the satisfaction of closing a few browser tabs I've had open for probably close to a year, that had direction on what I needed to code up to make that function. They've been open since I started that section, and somehow moved off it and onto other things. Anyhow. Done now.

We like this.

Friday, July 5, 2024

Character Resets Working

A quick update tonight. After work, I managed to get a Character Skill and Mod-Point reset working nicely between the app and the server. This means that I'm a short hop, skip and jump away from being able to insert trainers into the world where you will be able to reset level points used to grow particular stats, and also skills, so if you decide to change the way a character's skills are set up, that's able to be done. It's bare bones at the moment (ie, no confirmation or the like) but the important parts work - the character is reset and that is saved to the server.

Good night at the code.

Thursday, July 4, 2024

Money Continued and Party Organisation

So, the first part of the update is fantastic - I've gotten money working. I've fixed all the bugs that I know of with inventory, vendors and loot user-interfaces not being quite right. That means when you buy something, it appears properly. When you sell something it goes away correctly. When you combined items (like multiple stacks of the same potions) it does all that correctly. If you're trading with a vendor, it now updates your party funds correctly. I've also finally added coins to possible loot - which was a very amusing head-scratcher for a while, as I'd completely set up the code to only handle items - and it really, really wasn't set up for anything else. Currently, it will simple automatically pick up any coins and simply increment your tally without interaction when you click on a loot drop. I might change that in some way later, but for now, it works. I might even keep it that way.

I also spent a bit of coin the other day on fiverr and got some icons made up for inventory interactions, and then tidied up the code so that only the right interaction buttons show up when you try to do something with them. They're just above the Trade & More buttons in this screen and from left to right will "Split an Item Stack", "Combine items of this type on the character", "Combine items of this type in the party", "Use the Item", "Drop/Destroy the Item" and a "Cancel" button. So, as the first interaction I've had on fiverr, it was a mixed bag. On one hand, the art is much better than I could have done - and it was pretty cheap. On the other hand, I didn't really get what I wanted from the chap, and I think he didn't speak much english as he completely missed/ignored quite a few things I'd asked for in the work. Anyhow, it's in the "good enough" section for now. Certainly better than I could have "artisted" up.

The next part of the update is great too, and it was super super quick to implement. Currently my basic menu has a button to organize the party in it, as I didn't know where the heck to put it. It's a dumb spot, but it worked for me while testing. The plan was always to set up some NPCs through the world that let you modify your party - perhaps in an inn or guild hall. So, I added an interactivity type into the world that has the purpose of opening up that feature in the app. As I already had the code there to (ahem... poorly) handle the moving of characters about in the party, it ended up being under an hour of code all up, from tweaking my editor in a few places, to tweaking a few bits of SQL that loads the world into the app or editor proper, and finally an extra case in a few switch statements and bingo-bango-bongo it's suddenly working. That'll let me tweak up the front menu nicely so that it guides you through setting up the party at the start and then to get going.


Monday, July 1, 2024

Money, money, money!

What an utter maelstrom of a day. Work is crazy at the moment with a lot coming my way, there is a lot to get through at home as well, but I did manage to get some coding in over the last few days. Rather amusingly, even though I have placeholders for cash, and items have a sell value etc, I wasn't actually doing anything with that value. So, it is about time that money made it in. Took a bit to work out where to store it, and I am not entirely sure I've done it spot on in the way I implemented it, but I can work that out later.

Right now, I've been focused on getting some transactions working so that when I buy something from a vendor, it checks to see if I have enough money to buy it on the server as well as the app (I've implemented the server side so far) and when it succeeds, it then updates the party cash correctly. Tomorrow, I'll work on increasing the player cash when they sell something. That should be easier I think as a bunch of the logic exists now to leverage. At the same time, I'll circle back to a few bugs I've got in the code that don't quite get all the interactions right. If you read these often, you'll recall I had an issue with encumbrance when a player split an item stack (and the second stacked item wasn't visible until an app restart). Seeing as I am in the code for these sections, I should be able to find and fix that too I hope.

On the general money note, I am considering a few things which I am currently undecided on. Firstly, should money weigh anything when considering encumbrance. Secondly, if so, should the player have a separate bank and party fund. I do have to say, I am being influenced by one of the earliest MMOs about, namely Ultima Online - and I totally recall running back from one of the dungeons loaded with so much gold coin that my character could not move with it all, so you would literally "pick it up" with the mouse, move it a few tiles in front of you, walk past it, and repeat. Now, that process in itself was utter garbage, but having to manage that added weight was interesting. I've pretty much talked myself out of it as I write this though. It wasn't fun. And if money has no weight, there's no need to have a bank account AND what the characters have in their pockets, unless you lose some coin with a respawn.... which is certainly a possibility. So. Maybe.

In any case. Slow, but constant progress and getting closer and closer now.

Rendering Redux

I've been meaning to for a while now, change the way that sprites are rendered, switching from the current concept of "render and p...