Simple MORPG project planning

Started by
23 comments, last by Sky Warden 11 years ago

Hi everyone! My name is Herwin, and I'm new to the community. I'm not very sure about which forum I should post this topic in, so the "For Beginner" it is.

I'm sorry if the title is too annoying to see. I understand that an MMORPG project is a dangerous topic, but it's not a real MMORPG project, seriously. Just like the title says, it's just a simple MORPG (without 'massive') project. Recently my friends and I decided to make a project to practice. We're looking for some experiences in working as a team, and because we have various interests and skills, we decided to make a small MORPG project. We already have the network guy, programmer, sprite artist, and we can just use a humble *bip* *bub* *bub* *bab* which is generated randomly for the music since none of us is a musician. I'm one of the programmers, and I got the server-side part.

We're aware that an MMORPG is kinda insane to make, especially for a group of students. We're just planning to make a 2D RPG with three maps, simple hunting and leveling system, chat, database, and can be played via Internet with a server that only runs when we're going to play the game. We took MORPG because working on one may give some interesting experiences. For me, it's the network programming. I'm pretty new at it.

For an unknown reason they voted me to be the project leader, so I need to make the planning and assign the jobs for the team. The thing is, I've never done this before. Here's the summary of my current plan :

  • I code the server. It will handle the math (counting damages, etc), sharing information about world objects to the players, handle the connection between players, do things with the database, and other server thingy like encryption. I will write the code for accessing the database, count damages, etc.
  • While I'm coding the server, the other programmers work with the client. They will handle physics, player input, loading sprites, sending player input to the server, receiving information from the server. The client only acts as an input device, while the serious game process is done in the server.
  • The sprite artist works with the the client-side programmers and make sure that the client can load sprites perfectly.
  • After the client software is finished, we connect the server and the client.

That's just the summary of my to-do list. Of course there's more, but that's my whole plan in a nutshell. Do you think I miss something? I have no exact idea if my steps is correct. If you have some suggestions or tips for me, please share it.

By the way, I'm planning to have a login server which handles user login and gives a kind of 'ticket' after the player login successfuly. Without this 'ticket' the player won't be permitted to access the world server (announces the world objects) and the server which handles counting like damage, etc (I don't even know what is this called). Is it correct?

Also, what's the best way to handle NPC dialogue? At the moment, I store it in the database.

A bonus question. Do you think 42 tables in the database for such small game is too many? I was just trying to do that normalization thingy, but I have no idea if I either overdone it or underdone it.

I use Python and MySQL. Oh, is it necessary to write the client and server with the same language?

Thank you, and nice to meet you all guys. smile.png

Advertisement

2 small things:

All NPC dialog should be stored fully within the client and referenced with an ID or something along those lines.

Unless you are planning on having constantly changing server controlled NPC dialog, even then you could just update the client with a server message containing the replaced dialog.

Figure out your packet structures etc before hand, having seperate teams working on client and server can be a huge nightmare if you are not working on the same concrete information.

Yes, you definitely want to work closely with your client/network programmer(s) on that. If the clients input/physics/animation is not coded with the networking in mind, you're going to have bad times down the road. Building the client and the server each in a vacuum and then "Connecting" them after they're done is... Well, that's probably not the safest approach, we'll say.

Having a log in server to supply an auth ticket is not a problem, but be mindful of how many distinct "Servers" you have. For something small, as you are proposing you probably shouldn't need more than one server application.

I don't see a problem with having the dialogs in the database, but you'll definitely want to keep that stuff cached on the client in some sort of data files so you don't need to stream it constantly.

Your client and server do not need to be written in the same programming language. What's important is that they speak the same "language" over the network. What I mean mostly is your packet structures and protocols (TCP, UDP, HTTP[Probably don't do that], etc...).

Without knowing what sort of data you're storing in your DB, we can make no judgments on it's structure or table counts. So long as it's intelligently designed, and your queries don't have performance issues, you're probably going to be fine.

My Games -- My Music 

Come join us for some friendly game dev discussions over in XNA Chat!

First I want to say that I have done something similar and it was great, I learned a lot with it.

On topic:

1) Language:

Python is a slow language, so, unless you are using an engine that provides you with binds and code written in c/c++, the project won't scale really well. You can use an optimizer to improve your performance (cython and pypy are good places to look at).

Python network layer to send variables that are not string is pretty annoying, so you probably want to take some time to read a little about it. I would recommend you take a look at this: http://docs.python.org/2/library/struct.html

2) World representation:

Assuming your game is a top view world (like Secret of mana or chrono trigger), you should probably use a tile map to represent it, using a grid to store the data. This will make some operations easier, such as rendering and path finding.

3) Client/Server:

In my implementation, both server and client used the same classes, the client had an HumanInterface class that would translate the actions into messages and send it to the server, that would have nearly the same objects (for instance, servers wouldn't load graphics or animations) and call the objects methods.

or instance, if the client clicked the "w" key, the HumanInterface would translate it into a start moving message the server would call the move method of the player and reply to the client with its new position.

4) Authentication:

This is probably a good approach, maybe you should use a ready solution, such as radius? Also, you should be careful how you are sending the information by the network and how you store it. I used pycrypto for my authentication needs.

5) Dialog:

Saving it on a database is probably the best approach, this way you can easily implement multiple language into your game. Python comes with sqlite by default, you could take a look at it.

Currently working on a scene editor for ORX (http://orx-project.org), using kivy (http://kivy.org).

I remember making a 2D Mario Platforming game in 2 weeks.

I'm just now finishing a 4-player Everquest (MORPG style) game in 1.5 years.

Sadly, I doubt my 2D platformer will never get old. and the joy of knowing it only took a few weeks. and a small amount of code. You might want to aim lower if this is your first game. If you start smaller, you can reuse your code and it might help before going into an RPG. (And by lower, it doesn't have to be pong.)

That's what I did, since I am the only one in my hobby projects (programmer, designer, artist, musician). But I started with smaller projects and gradually finished my goal (RPG). Though I wanted one that required no server, so 4 Player LAN setup to play with friends, or solo.

I progressed in difficulty by making the following games in order
3D Arcade style game (Guide a rocket through a level) (C++ DirectX)
2D Platformer (c++ direct X)
2D Tower Defense (C++ DIrectX)
3D Fleet Battle (strategy, C++ DriectX)
3D RTS (XNA C#)
3D 4 Player Action Pirate ship Simulator/battle ( C++ DirectX/HLSL)
3D 4 Player MORPG ( C++ OpenGL/ GLSL)

Notice that I started small, learned things, and general each new game added a new programming concept. Be it tiling in 2D, or A* pathfinding in Tower Defense, or Networking in my pirate game.....

Now to answer your questions.

Choose a language everyone is comfortable with. XNA and C# was really easy. You might want to look into that as a choice, i've never used python.
But now I'm going to share a lot information, sorta a post mortem on my 4 player RPG i just finished. I understand yours will be easier as it's 2D, but a lot of this applies.

Obviously the fun part is making classes, spells, enemies, designing the game. But Soon when you want your game to have a good amount of gameplay and reatures. There are a lot of subsystems you need to implement in an RPG. I'm going to blast a ton of questions relating to these subsystems so you can start thinking now.

How are you going to render terrain (probably a tile map). How are you going to make the tiles and design the world? You will probably want a tool for that. Some world editor that lets you paint maps and export them into the game. That's work to do.

How are you going to handle Quests, Loot, Dialog? Well it sounds like you have a database in mind, which is similar to what I did. But then I made a tool to generate and edit items. One that can create Quests or edit them. Assign loot as rewards, Assign dialog to the start and end of the quest. Having a tool made it easy for whoever was DESIGNING the game to just use the tool. It connected to the database, so everything was content driven on the game. How do you map dialog to NPCs (maybe tool)?

How are you going to handle combat? Is it real time? If so, how to you handle Groups. How do you update only the players you care about as a server when someone makes an attack. Can your server handle updating all the AI for every enemy? and for ones that are fighting players? If someone casts a spell, you need to alert every player where that spell might exist so they can render it. How do you display the damage? do you show other players damage? Do you animate sprites if someone is attacking? what if they miss? can they miss? What if they are in casting state? what if they just got hit? or finished casting a spell? These are all events you need to handle for all connected players. And handle any lag if this is all real time as well. Combat was not a trivial system and I limited my game to just 4 players! How do you handle Agro so that the monster will attack the correct person. Do you impliment some sort of holy trinity (tank , DPS, Healer) paradign? What about buffs? ist there a time limit on buffs? who can give who buffs? do they scale? do you have special buffs like HOTS? or Torns(attacker recieves damage)? Do you have stealth? What about Bladeturn to absorb damage/ buffs that remove after use?



How to you handle the merchant. Querying available items for sale. Implementing some sort of economy system with buy/selling. I didn't even touch crafting lol. Is there trading? How to you stop people from equipping powerful items and breaking the balance of a game.

Moving your character around can be a challenge in a network game as well. How do you get the character to move fluently, with minimal ruberbanding for both the user, and other players. Handling collision detection with the world (terrain tiles). Maybe handling collision detection with players/enemies/spells (up to you)? Is it a persestant world like WoW, or instanced like Guild Wars? (obvsiously 2D).

What if a high level helps kill with a low character. What if this happens when they are in or not in a group. How do you stop griefing? How is exp Awarded? What defines "progress" in your game to keep someone from not playing. Is there Raids or group only content? Guilds? What kind of Social Interaction are you expecting in your game

Then the subsystem that threw me for a loop. I didn't realize 50% of my time would be programming the UI!: What are you displaying on the vitals (hp, mp, xp)? Do you have a group window? a Cast bar? A spell bar for spells? How do you handle mouse clicks? How do you handle targeting (Both UI and click on the model)? What menu system do you have? I had lots of tabs like: Personal infomration about their stats, Equipment menu, Inventory menu, group menu, spellbook menu, trading menu, a WOrld map, Game settings. Do you allow them to change game settings (size of screen) sound ? (for me it was also optimizations like shadows, adv water reflections, render distance, but maybe not needed in 2d). How do you program the act of someone moving things around in an inventory? How do you program equiping items? How do you handle Assignign skill points or spells? Do you have a Quest menu? How to you show the statuses of quests? which items they need to collect or enemies they have to kill or what reward they will get, or how much exp they will recieve. UI was the longest part, and I never realized how much of a chunk RPGs UI is.

What happens if someone disconnects or dies. do you have a bind system? are they penalized? How do you handle respawning enemies if its a persistant world. Are there zones?

.........................
.........................

I'm not trying to put you down, I just want you to be aware of all these situations you need to program and take care off. Of course you can always simplify your game, but I was just relating my own experience. I thought it would be as easy as :

Implement Chat system - > Network host/join code -> move character -> combat.




An RPG is really a lot of work. And I spent a good 3 to 4 hours a day for a 1.5 years coding tools, making the game. My game has content enough for 60 hours of game play, but it probably couldn't handle Massive players. It was built and designed around 4.


Hopefully you don't take this the wrong way. But damn, was it a lot of work. I'm not saying you can't do it, I'm saying I could not do it if I started even 4 years ago, not knowing much game programming experience.

Sorry for long post.


Your client and server do not need to be written in the same programming language. What's important is that they speak the same "language" over the network. What I mean mostly is your packet structures and protocols (TCP, UDP, HTTP[Probably don't do that], etc...).

I see, thank you. I did feel like I have to work directly with them for writing the client. That means the client sends the data like user_id, the server receives it and then uses to do tasks like getting the user information based on the user_id. Is that correct?

1) Language:



Python is a slow language, so, unless you are using an engine that provides you with binds and code written in c/c++, the project won't scale really well. You can use an optimizer to improve your performance (cython and pypy are good places to look at).

Python network layer to send variables that are not string is pretty annoying, so you probably want to take some time to read a little about it. I would recommend you take a look at this: http://docs.python.org/2/library/struct.html

The client programmer decided to use C# to code the program. The Python is used only in the server. Therefore, I think the performance issue won't be so big right? Or it will? I heard it will be fine as long as I run it in its realm. Sorry, I don't really understand why Python is a slow language. Is there a way to optimize it? I know it's something about the compiler and the way Python runs.

Obviously the fun part is making classes, spells, enemies, designing the game. But Soon when you want your game to have a good amount of gameplay and reatures. There are a lot of subsystems you need to implement in an RPG. I'm going to blast a ton of questions relating to these subsystems so you can start thinking now.

Oh thank you. They're really important indeed. I will keep them in a list. The client-side programmers want to work with Unity 3D along with the spriters.

By the way, I'm not very sure about the way I handle things like buff. At the moment, I handle it like this :

  1. There are some tables in the databases which store information like "Thing A has effects X, Y, Z, etc."
  2. The program looks for the effects the triggered thing (just say magic or buff) has with the database. Maybe it has damage reduction by X percent.
  3. The result will be a list of effects. I have functions which represent every effects. The function name is the same name which is stored in the database. Like a function to count the damage reduction, etc.
  4. From that list of effects, I will do a loop to call the effect function one by one according to the effect name, and then count the total damage.

Is it good? Maybe you have a better way? :)

Thanks for the reply guys.

Python is a slow language, so, unless you are using an engine that provides you with binds and code written in c/c++, the project won't scale really well. You can use an optimizer to improve your performance (cython and pypy are good places to look at).
Python network layer to send variables that are not string is pretty annoying, so you probably want to take some time to read a little about it. I would recommend you take a look at this: http://docs.python.org/2/library/struct.html

Say that Python is 'slow' a broad generalization which is not useful. Scalability of a system is not simply a matter of language choice; it's more often a matter of design. It also depends on what your definition of "scale" is.

The client programmer decided to use C# to code the program. The Python is used only in the server. Therefore, I think the performance issue won't be so big right? Or it will? I heard it will be fine as long as I run it in its realm. Sorry, I don't really understand why Python is a slow language. Is there a way to optimize it? I know it's something about the compiler and the way Python runs.

Python should be just fine for your server. Python is technically slower than a compiled language because there is additional execution overhead in the Python interpreter. But don't worry about that. It's fast enough for many things.

Also, don't worry about optimization until you have _actually_ profiled your code and have identified _real_ bottlenecks. Read that last sentence again. Resist the temptation to guess about where bottlenecks exist in the present or future, and instead learn to use a profiler. See http://docs.python.org/2/library/profile.html. Often bottlenecks you find are caused by redundant computation or a poor choice of data structures or algorithms; these issues have nothing to do with your language choice. As a last resort, if you *really* need blazing speed for number crunching, etc. (_after_ you've profiled your code), you can always write C extensions to optimize those keys pieces.

If you're dealing with a database, you may find that some bottlenecks are caused by the database (inefficient queries, latency, etc.). These sort of issues also have nothing to do with your language choice.

So if you're already familiar with Python, stick with it. It's a fine choice. =)

So if you're already familiar with Python, stick with it. It's a fine choice. =)

Whoa. Thanks! That reliefs me. I've asked some seniors and they say the same. "You should pick a programming language based on your own skill set and the needs of the project." Also, that's a very useful link you gave me there. I will have it a read soon. I'm writing the database class at the moment.

Yes. I choose Python because it's easier to develop and therefore, will make it easier for the team if a new programmer comes to the team.

As for the client-server play, I later decide to separate the client-side team into two parts. One part handles the resources along with the spiters, while the another one handles the sent data with the network guy and server-side programmer (me).

About database, I'm concerning about the normalization. It's good for some reasons, but it slows down the reading process a bit. I think I need to denormalize some of them, but not sure about the best way to do it. I can decrease the writing performance if I do it wrong. Some ideas or links will be very appreciated.

Thank you everyone! :)

Love getting voted down for telling the truth on python.

Python is slow comparing with other programming languages. It is slow because it is an hybrid language model (instead of purely compiled) and it uses dynamic typing (this is a perform killer). PERIOD.

This doesn't mean that it won't be fast enough to run your project, but you should know that this may become a problem and that you have optimizers. This is a simple example on how it can be a problem:

Let's say you want to calculate the distance from one point to another. This is a very simple problem and it will be used thousands of times every second on your game, specially because it is used for collision tests. The algorithm is really simple, just this formula:

sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2)

So I wrote this code and run it in a 10000 times loop, here are the results (I run the program 10 times, got the lowest result):

Python: 0m0.031s

C: 0m0.002s

That is a simple algorithm, that depends a lot on the python sqrt implementation, still it was 15.5 times slower than a C version. If you take more complex algorithms, specially the math based ones (see the example on Cython site) you can end up with 1000 times slower code.

Also, I never said to blindlessly optimize your code, instead I posted a reference, cython. If you had lost 15 minutes of your time to take a look at the cython site (and maybe learn something), you will find a profiller section that will show you how to indentify bottlenecks and how to optimize it.

So, you may negativate me all you want, but that won't change the fact that python is slower than most other languages and that you may need to optimize some parts of your code by exporting C code or using cython.

Sorry if this may seen aggressive, but I post all my references and I get really pissed when you post references and people don't read it.

On the communication, as I said in my first post, it is possible, but you need to take some precautions. Sending binary data via a socket with python means that you will need to use the structs module, where you passa a formatted string and pack variables into a buffer. Your variables must have the same size on both sides of the network, otherwise you will have problems.

In the link I posted there is the description of size of each variable, you should look for the size of variables of C# and create a simple communiaction example between them. Also it would be wise to test on both 64 and 32 systems.

Currently working on a scene editor for ORX (http://orx-project.org), using kivy (http://kivy.org).

KnolanCross, I think you are confusing Python the language with cPython, _one_ implementation of the Python language.

This topic is closed to new replies.

Advertisement