Published on

Devlog #7 - Stats & Skills

Starting off the week by setting up xp/leveling on the server side. Thankfully this is code that has been used and tested thoroughly between two games and it doesn't depend on any libraries so I can mostly just copy it over. That said, I need to read through both versions and see if there are any issues I notice. Hmmm, seems like AO has a bit more xp per level than FO. Interesting. Ok, all of that is now moved over and the server now pre-calculates xp<->level values so it's a quick lookup in-game.

Now I'll move on to player stats. We've got xp, level, rebirth, current health, max health, current energy, max energy, stat points, time created, last logout time, time played, a bunch of counters like times looted/kills/etc, and that's enough to get us started. Adding those server side and then hooking things up to deal with them.

Stat points were very different between AO and FO. In AO they were given out automatically based on job and level with the only assignable stat points coming from achievements. This system was very boring. We're going back to the FO system that will give you stat points per level which you then assign however you want. Setting that up now.

Ok, I've got the basics of stats on the server working. Now I'm going to switch gears to the bottom middle skill hotbar. Ok, all setup with the xp bar above it. I'll add buttons for changing hotbars and xp text later.


I took a detour again and made a couple feature requests for BabylonJS 

https://forum.babylonjs.com/t/add-a-way-to-play-an-array-of-animation-frames/39206

https://forum.babylonjs.com/t/add-markup-to-textblock/39207

This team at BabylonJS is so fast. They've already fixed one of my bugs:

https://forum.babylonjs.com/t/sprite-pixel-art-artifact-issue/39123/7

Ok, back to skills. We need to define skills and add a skill book to the player on the server side. That means SkillDefinition, SkillDefinitionTranslations, etc like all the other MySQL tables. Let's set that up now.

SkillDefinition needs id, icon filename, rank, level required, stats required, cast time, cooldown type, cooldown length, aura type, energy cost, vendor sell price. AO used auras and they worked nicely, so let's bring the concept over to FO2. Then we'll need SkillDefinitionTranslations which will look exactly like ItemDefinitionTranslations. And now let's insert our first skill which is Attack. And done! Now we also need a SkillEffectDefinitions table that contains all the effects of the skills. And now that's setup, so let's add Thick Skin and Lick Wounds to start things off. Done!

Now I need to load all that into the server and add a skill book to the player data. And many moments later that's what we've got. All skill data loading into the server, the player has a skill book and skill hotbars, and now all that is being sent to the client. Time to create all this stuff on the client.

Created and loaded SkillDefinitions and hotbars on the client and now I can turn on the hotbar icons. Let's see how it looks.


Well, hello there Sucker Punch and Lick Wounds, nice to see you again. There's still a lot to do for skills but it's nice to see them. Now let's leave skills for a bit and work on the top left player info.

For player info we need to make a progress bar, which will also be used for the xp bar, we need to fill out the name, level, health, energy of the player. We'll do the player portrait later. Oh and need to fix that background. Tinkering noises and voila here it is looking nice.


The fonts are still a bit wonky as I'm waiting for a bug fix, but it's coming along nicely.

I took another detour to look at user management/authentication options. It looks like I'm going to go with https://supertokens.com/ which allows for username/password and social logins which is ideal. I have to learn how to set that up on AWS which will be fun but will take a bit. Other easier to implement auth services like https://auth0.com/ are just really expensive and not realistic for FO2 so supertokens being open source and hosting it being cheap on AWS looks like a win. Will have to spend quite a bit of time setting that up in the near future.

But for now I'm going to jump to setting up the in-game mail system. I'm going to use a MySQL table to hold the mail and mail with be able to be sent/received to accounts. This means all characters on an account will have access to the same mail. It can act as a kind of shared bank I think, but we can also add a shared bank at some point. This will be used to distribute rewards, to send results from the market/broker, and I think it's how we'll deal with player to player trading. There will be a fee to send mail but I haven't decided how that will work yet. Maybe based on how long the message will live like an increasing fee for 7, 30, 60, 90, 356 days etc. We'll see. And voila, the MySQL tables are all set up for mail.

Now because my brain has turned to mush I'm going to work on moving over some more items. There are around 3,000 items I need to move over after removing all the items that will not be returning. It's amazing how many Kong/FB items there were. Let's not do that again. I'm moving the items over manually to look for any issues so I can correct them. If I do a few a day it will get done in no time.

And that's it for this week. It seems I've been posting devlogs on Friday so from now on that will be the tradition. This upcoming week I will work on buffs/casting and either the beginning of mobs and or quests. See you next Friday!

Have Fun & Keep Gaming!

P.S. - There are 422 quests to start us off.