Refactor!
Wow, what a mess! As I continue on this journey to create an MMO template that others will be able to use as inspiration to create their own multiplayer games, I struggle at times with my lack of experience and skill.
Take the past few weeks, for instance. I had the best of intentions when splitting code off into separate classes according to function. The problem was that I was using the wrong type of class for what I was doing and things that were supposed to run only on the server were running on the client instead. Keeping certain functionality solely on the server is what protects data from being visible to the player, thereby reducing the chance that they can alter that data and cheat. So, it's taken me weeks to migrate the data over to the appropriate class type (I hope) and keep server data on the server where it belongs.
So, I spent a lot of time reworking the Inventory, Party/Group and monster loot sections. You can now kill a monster and take whatever loot they drop. It's based on a random chance system that takes a number of parameters into account instead of just a simple roll of the dice. The loot has to be level appropriate for the monster, with a possible rare or junk item chance to drop as well. Few things are simple in coding.
Since I'm largely self-taught, some things are more difficult than they need to be, but I eventually gain a level of understanding to where things function somewhat correctly. It's an arduous process learning to code, and actually creating something while you're learning is even more challenging. The cool part of that is I can look back on previous code and see the progression of my knowledge and skills. It also means I have to go back and fix that mess, lol.
Regardless, it's still a lot of fun and I think I'm making great progress, both in skill and program functionality. It still amazes me that something as simple as picking an item up off the ground and putting it into a player's inventory has so many moving parts that have to be accounted for before the action can be completed. Is there enough room? Is there already another of that item in inventory? Can it be stacked or not? Is it a quest item? Is someone else already trying to pick it up? These questions, and many more, must be answered before removing the item from the world and adding it to the players pack. In video games, nothing is as simple as it appears to the player. They just press a button or click on it and it magically travels from the ground to their inventory.
A friend and neighbor once commented, when I told him that I was a game programmer, that programming is easy, right? I kinda laughed and said no...it's not easy. Sure, some game engines make creation easier but I had to choose the big daddy of all game engines, Unreal Engine. You get a game engine that does nothing special by itself. It's just an empty template, waiting for you to bring things to life. My MMO template, built on top of Unreal Engine is designed to give a programmer an extended framework of MMO features with which to create their own game. Nearly anything is possible if you create the code for it and have the right art assets. Want a waterfall? Code it. Want a monster? Code it. The limit is your imagination and your skill to make that dream a reality. This is my goal, to dream it and achieve it.
And that wraps it up for this post. See you next time!
Comments