Want to see something that'll keep you up at night?
Here's some code from BrawlQuest's battle system, server-side. It returns the first mob in any given encounter for the purpose of sending the client to display in the overworld.
function getFirstMob(fscript) local firstMob = "unknown" if fs[fscript] then fightScript = atComma(fs[fscript], ";") --break down fight script, data/fights local k = 1 while firstMob == "unknown" do if string.sub(fightScript[k],1,5) ~= "speak" then firstMob = fightScript[k] else k = k + 2 end end end return firstMob end
Let's walk through what is happening here: encounters are stored as strings with a semicolon delimiter. The format is
mob;amount. If there's dialogue then a mob called 'speak' is spawned with this format
speak,Person,Hello!;5 (which would make an entity called Person say Hello! with a timer of 5 seconds.
Hold the heck up, strings?
Would you believe that the very first thing I got working in BrawlQuest was the fight system... 3 years ago. I had no idea how tables or OOP properly worked in Lua at the time and the result is a crutch that the game has had to bare ever since.
The obvious question is "Why didn't you just go back and fix it?" and the answer is that - at the time - I believed my solution to be pretty nifty so the rest of the game followed suit with this system.
The result is now, preparing for release, rebuilding the SDK and making everything work through an API rather than temporary text files. I'm spending more time recoding old features that creating new ones. That isn't exciting or fun to develop and in a month I'll be working full time. Oof.
136 days to go...
I've been fortunate enough to have received a grant from my Student's Union to help with marketing and server costs for the game. After many many months of focusing on university work and barely touching BrawlQuest's code I got a sudden resurgence of motivation.
The deadline I'd set was August 26th (after two delays, that is) as this was a date far enough away that I wouldn't need to worry about it for quite some time. A friend of mine pointed out to me that the problem with delays is that you stop working until you absolutely have to and this is completely the truth.
So, there I was, the BrawlQuest workspace open for the first time in months. And the code makes me want to die. I'm sorry but it had to be said.
I say "introducing", but it won't be a product. It'll just exist for internal use at FreshPlay and power BrawlQuest.
OpenQuest is a vision for a brighter, cleaner future. It's an engine built in LÖVE and PHP that will power a new, faster BrawlQuest. It's rewritten from the ground up to support everything BrawlQuest currently has and more. Things like...
- Steam works verification built into the client
- An infinite over-world without the need for loading in and out of separate maps
- Projectile attacks
- Chat channels (including guild-only chat and private messaging)
- A full SDK to build the game without any programming requirements
- NPCs and quests stored separately (rather than in the world!)
- Only time-sensitive tasks performed on the realtime server (everything else via the API)
- A totally restructured UI library that doesn't look awful on smaller screens
- Online character profiles
I figure the time requirement to be significantly less than would be just restructuring the existing code. I'm hoping to stick to the August 26th release date, too!
I'll be performing tests using OpenQuest in the coming months and continuing to post progress via this blog. Stay tuned for that!