Monday, July 24, 2023

Account Login, Quests and Events

I managed to finish up work on time today, so I got stuck into a coding side-quest which has been bugging me for a while. When you take on a quest in the game, it does save that info to the server as it should, but as I've been testing, it didn't seem to be working as expected when I logged back in. The NPC's didn't seem to know that I'd accepted their quest, and secondly, what we'd talked about already - so it was time to fix that.

When I started to dig into the code, namely the parts that sync progress to the server, I worked out that indeed, things were saving correctly to the server - and the server did in fact know where each player was up to. It just wasn't ever being asked for that information back when the player logging back into their account and never processing it all back once you logged back into your game. So.... a few quick interfaces later, I had the IDs of events and quests loading up along with the basic account into when you log in... and realised that I'd written some clever code to pull up quest data when you accepted it - but not when it was being loaded in a state where it had already been accepted. So another interface later, the game was correctly picking up when you accepted a quest, the game was correctly updating the server when you progressed a quest - and finally the game was correctly updating all that again in your app when you logged back into the game. Huzzah.

Now I suppose I need to finish off the first (and only?) quest in the game in terms of being able to actually complete all the stages and then tick off that it is in fact done - and have the NPCs know that you've also done that the next time you log in. That'll need at least another interface I think, and also at least a screen or version of a screen in the game to let you accept the quest rewards and select items if you want them as a reward.

It'll be easy they said. It'll be quick they said. THEY had clearly never tried to code a reasonably complex game from start to finish.

No comments:

Post a Comment

Inventory, Loot and User Interface

So, I've been basically doing another side-quest with the code over the past few evenings and Saturday, writing up all the code for the ...