Jump to content
  • Advertisement
Sign in to follow this  
graveyard filla

Where do I go from here?

This topic is 4661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have been working on a 2d action style MMORPG, for almost 2 years now. I worked on it daily for a while but lately have not been working on it at all.... mainly because of this... Anyway, there is one huge flaw in my code, and that is that the client and server don't share much code at all. For example I have a Player.h and a Player.cpp file for both the client and the server sources. Most of it is just cut and pasted from one file to the other... This is the same for all of my code really. I don't share much except maybe math functions and global constants. This is really holding me back because I dread maintaining and expanding this code. It sucks to mantain 2 copies and I feel like I am digging myself deeper the more code I write. Now, I know how to properly implement this, at least I am pretty sure. We have had these discussions here in the past, this thread is a great one. So, the real way to share code is to just have an "Environment" class that is fed into the every part of the engine which is used to define the behavior for that particular function / set up the state of that object, etc. The problem is that there is so much code written already, I just don't feel like refactoring my whole source. Not only would I have to change all the copy / pasted code, but I would have to change all my systems to fit into this "Environment" concept. I would literally have to refactor my entire source for both my client and server. This is around 20k lines of code in total. I am thinking about just saying screw it, and going on with cut and paste classes... but I am not sure. I am thinking of just making this game to be very basic.... However, then I think, once I have NPC's and skills and everything set up, that isn't basic, and it would be a huge shame to let all that code go to waste, since it would be a complete nightmare to maintain...... I also want to add, that besides this huge flaw, everything else in the game is actually pretty slick. The networking code for both the client and server and the rendering code for the client in particular are both very slick. I can place objects where-ever I want and everything will automatically sort, etc... It uses OpenGL and I have a crap load of cool explosion partical effects (yo lev), etc. Also, the networking code is also pretty slick. Visibility filtering, zone based (so can be expanded to support multiple servers running one simulated world), movement, bullets, etc. This stuff is all very smooth and I share all the needed code here (really just constants and typedef's). Of course some of the bad code indirectly effects this - for example the network code will call player->I_Want_To_Move(x,y), where that function is a cut-paste function. Anyway...I guess I'm just looking for suggestions on what I should do... should I bite the bullet and sit down and re-factor everything? Should I just go on and do the cut-paste thing? Sometimes I want to just throw it all away and re-write the bastard in C#... but then I dread re-writing the rendering code, in particular. I also don't want to have to re-write the networking code ,because it is already as good as it needs to be (I have re-factored this code millions of times). Although re-writing network code is fun in my eyes, messing with OpenGL is not [grin]. Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
I don't expect I know enough of your code to give you an informed decision. It totally depends on how much time it will take to refactor vs how much time will be lost to future expansions which take longer to implement.

You have to factor in risk into those times as well. Is it riskier to refactor now and possibly introduce new bugs or is it riskier to let it sit and possibly introduce bugs because of poor architecture. If you are going to refactor I would suggest being very sure of what it is that you are going to be doing to resolve your current issues.

If I were you (but I'm not) I'd probably sit down and map out the things I would have to do to get my game architecture set up properly, figure out how long that would take, guess on the relative complexity of the change and try to figure out what possible bugs could occur (very tough) and then determine if it is worth it or not. I would stew over it for a day or two at least before actually coding anything. Your best bet is a system that allows the server code to update the client properly as well. I'm kind of wondering why you don't actually have a shared set of headers and source that you use instead of copy/pasting directly. It seems like the best way to work on it. Are there actual differences in the two copies? If not, why are you not linking the same files for both projects?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!