Here we go! Creating an MMORPG template as a solo dev
Since 2016 or so, I have completed literally hundreds of UE4 tutorials on YouTube, as well as several courses on Udemy. All were effective, to a degree. It’s hard to absorb data at the speed of video but over time I picked up more of the meaning of what I had been blindly typing as I frequently paused the videos to take notes. Eventually, I would go on to comment the C++ and Blueprint code heavily as I went, which helped reinforce the concepts being taught and allowed me to revisit a concept and find previous comments. I took those lessons and newfound knowledge and applied them to my coursework at UAT in the process of obtaining my Bachelor’s Degree in Game Programming, from 2020 to 2022.
When I first decided to embark on this MMORPG template project, I figured I was nuts for even trying since so few have ever made a multiplayer game as a solo dev, let alone an entire MMO framework as one. There was one fellow, I think from Germany, who made an “MMO Starter Kit” and it was…challenging to understand, to say the least. Not only because I was still very new to Unreal Engine and C++ but because it was complicated, yet simplistic in features. So, I took what little I knew and dove in headfirst, deciding I would learn more as I went, and boy did I ever. I quickly learned that making game features isn’t as simple as adding a monster, killing that monster, and giving the player loot and experience. Also, I would be remiss if I didn’t give a huge shoutout to Sneaky Kitty Game Dev (Thanks, Cody!), Ryan Laley, and UnrealGaimeDev, from YouTube. Their videos unveiled the mysteries surrounding Blueprint and C++ as it pertains to Unreal Engines 4 and 5. One of the series from Sneaky Kitty included creating a MySQL server and an ASP.NET web server to handle data transfer and storage, and since I was doing this without using any established platform services, like Epic Online Services (EOS) or Amazon Web Services (AWS), I thought creating a MySQL and ASP presence locally was a good way to begin this odyssey. Mind you, this was without installing any one of hundreds of available Plugins from the Unreal Marketplace that would make things much simpler. Nope, I was doing this from scratch, and I meant it!
Getting Unreal Engine to talk to the ASP web server and then have ASP talk to MySQL in turn was, initially, a nightmare. While I figured out how to install each of them easily enough, making them listen and talk was the first huge hurdle I had to overcome. Sure, the video tutorials were helpful, but only so far as making their code work. Altering it to suit my needs to pass several different types of data required tons of “Googling” and many colorful words. Once I had them talking, however, things became somewhat easier, at least in that realm, since adding new functions mostly meant copy/paste and changing the names. Not being a professional game developer means that a good portion of my code and methods probably aren't considered “correct” or to industry standards and naming conventions. Still, I did a lot of reading and feel like I’m in the ballpark of what might be considered acceptable, and the code does work, so that’s something. I've yet to implement security or encryption for the communication between them but it's on my list.
The first feature I tackled was creating a main menu, including a simple login, character creation and connecting to a dedicated server, either locally or across the internet. Once that was complete, I was able to begin adding various systems to the framework. I decided to create the chat system first, since it was basic, type a message and everyone sees it. Piece of cake. Next up came the group system. Want to sign up for a dungeon? I made a system that did just that. It allows players to start a group for a particular dungeon, and once enough players join it fires up another dedicated server for that dungeon, loads the map and transfers the players to that new server. Want to leave? Drop out of the group and it takes you back to the main server. The leader can assign someone else the position, or if they leave the group, a random person will be chosen as the new group leader. The leader can also kick players and send them back to the main map. When the dungeon is over or when the last person has left the group, the last player gets sent back to the main server and the group server is shut down. Getting the server/client functionality working was difficult at first, then very difficult afterwards, lol. I think that one system took me a good 2 months to create, and it was still quite simple, the map was empty and there were no goals to accomplish yet. Close enough to move onto the next system.
Next was an item spawner system. Place a spawner in the world and tell it which items to spawn and upon server start it will spawn them in a random area around that (hidden) spawner. As each item spawns, it checks for obstructions as well as finding the ground height since spawning randomly on uneven terrain means items must spawn exactly on the ground. I’m using a mixture of Unreal Engine Data table and a MySQL table for the items that get spawned or created (axe, food, backpacks, etc.). The database holds the sensitive information while the Data table only holds the image of the item as well as the physical representation of it in the world. This should make the game more performant while protecting from cheats, at least as I understand it.
After finishing up the first pass at item spawning, I moved on to a player inventory system to hold the items when picked up. This was many times more difficult than the group system since there were so many moving parts. As an item gets picked up, many checks need to occur to ensure that they can pick it up at all, have room for it, add it to an existing stack, or stacks if they are picking up a large quantity, etc. Then, I had to implement an expansion slot feature to allow players to pick up a specific type of item and drag it into an expansion slot, thereby increasing the number of inventory slots they can use. Keeping track of the slots, what’s in them, dragging and dropping items to other slots all gets very complicated very quickly. Done, and done, at least enough to say it was a working inventory system.
Then came a vendor system. This meant creating NPC’s of various types and displaying it over their heads to show the player what type of NPC they were trying to talk to. Once the Vendor NPC type was in the world (Yep, had to create a spawner system for that, too), the player could then walk up, initiate a conversation, and see what items they had for sale. Once a purchase was made, the item had to be placed in the player’s inventory, again checking for space, stacks, etc. Joy!
Now that the player could chat, join a dungeon group, pick up items on the ground and purchase items from a vendor, it was time to create a quest system. No good gear comes for free, they need to go earn some credits to purchase more stuff! That means working for the man, doing their dirty work. The quest system is the most intricate thus far, including a great many variables to keep track of quest chains, progress, and rewards. If the previous systems were like drinking a Big Gulp, the quest system is like trying to drink a swimming pool. See how it worked out in a future post!
Comments