Published on

Devlog #47 - Redux

I spent a large amount of time the last two weeks refactoring Java code. At this point about 80% of the current server code is now squeaky clean. And by squeaky clean I mean well structured and bug free.

I’ve been staring at Java code on and off for over 15 years now. It was January 2009 when I first started to prototype what would become FO and that was also my first time ever writing Java. Up until that point I had mostly worked with C/C++ and had never worked professionally with multithreaded or networking code.

At that time I was working on movie tie in games for the Wii. The 2008 stock market crash had just happened and it was obvious the company I was working for was going to go under soon. So FO was my plan to survive the storm that was coming. It would take 1 more year for FO to launch and 2 more years for it to provide an actual income. Game development is a very unstable job. I recommend not choosing it as a career.

We have a new Mirabella Cove map that looks amazing courtesy of Dino.

“Hey, everyone! 

Dino here, to bring you some news and insight on the updated Mirabella Cove map. I’ve been hard at work bringing the tiles up to speed with the likes of Noob Island and Crab Coast.

From adding the little things like the different variations of grass, revamping some areas with a little more love, introducing a beach for the clams to hang out on, overhauling the main town area and even adding some new areas to explore.

So how did I make the map? Well, I used a program called Tiled to construct layers of images to be displayed to the player. For example, the layer named Coastline holds all of the border tiles anywhere the land touches the ocean and allows me to animate the tile. The animations you see in game are created using anywhere from 4 to 8 tiles that have very small differences but enough to make the animation come to life, like the beach front area.

Tiles that are drawn over the player, like tree tops, are placed in a group folder. This allows for the illusion of the player walking behind the tree and not colliding with the top of it. All of these layers are built from a mastersheet file that allows me to grab each of the images and draw them like a pen would draw on paper.

This has been some of the most fun I’ve had working on things in FO2 and hope you all enjoy it! 

— Dino”

Great job Dino!

I also did a lot of work hunting down performance issues in the client code. I’ve been using https://sentry.io/ to monitor for bugs. It turns out sentry has a replay feature that records video to help with debugging. This replay feature has been slowing down rendering for as long as we’ve all been playing FO2. I’ve turned it off and seen huge performance gains. 120 fps on my dev MacBook Pro is buttery smooth now.

This is a purchase order for an Amazon AWS EC2 Instance c7g Family Savings Plan. We now have a reserved fully paid for game server for 3 years. That means we now have one MySQL server and one game server fully paid for until 2027. 🎉

I've also been working on setting up the game's public api. Public API endpoints are currently rate limited to 5 requests every 10 seconds and can be called from any domain as I've turned off CORS for the /api/public/ directory. All public api requests will be under the url:
https://fantasyonline2.com/api/public/

The first endpoint is:

https://fantasyonline2.com/api/public/guild/members

Which is a POST endpoint that takes a guild name.

Above is a tool called postman https://www.postman.com/ which I have been using to debug web api endpoints. As you can see, when I send in the guild name Monkey Time as a name property in JSON then I get back an array of character infos that are in that guild. I will be using this for the upcoming guild window in order to move as much processing from the game server to Vercel's serverless edge functions as possible. The more I can move over to Vercel, the faster the game server will be under heavy load.

This Typescript file middleware.ts is all that's required in a NextJS project in order to disable CORS and rate limit /api/public/*. Pretty cool. The upstash rate limiter runs on Vercel's Redis kv serverless database. https://vercel.com/integrations/upstash It's quite nice and easy to use. It looks like this won't cost any extra but I'll have to monitor my Vercel account to make sure. So I guess we have our first Redis instance by way of this Vercel wrapper.

“Perseus here:

Over the past few months, Gamer has been slowly teaching me how to be more independent and push content on my own. This means that my work flow now includes making pixel art assets, adding to the many databases, hooking up quests, creating crafting recipes, NPCs, and a whole lot more. There's quite a lot going on behind the scenes!

It's all really fun and I've been glad to have Dino now onboard helping with tiling / map creation.


Putting out the Stout set was a good introduction to crafting and I'm excited to start implementing more crafting into FO2 such as the Undead Rings which I know everyone is waiting for lol.

Mirabella Cove mobs have been the top priority and we have only 2 more mobs that need to be done before the final mob, the cat, can be put in. Who’s excited for that?

I'll be adding mobs and drops throughout this week so stay tuned for some patch notes. The next T1 set will also be following shortly.

On another note, one thing that has come to our attention recently is the drop rate discussion. 

How should we balance drops in future mobs? Should only cosmetics such as the 1337 items be the only ultra rare drops or should armor / craftables be included in that realm as well? How can we balance the new player experience while also providing the grind seasoned veterans need to stick around?


-Perseus”

In the next two weeks we’ll all be getting stuff done.

Have Fun & Keep Gaming!

See you next patch notes!