Jump to content
  • Advertisement
Sign in to follow this  
Sky Warden

Simple MORPG project planning

This topic is 1918 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 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

Edited by Sky Warden

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites

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.

Edited by KnolanCross

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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. =)

Share this post


Link to post
Share on other sites

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! :)

Share this post


Link to post
Share on other sites

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.

Edited by KnolanCross

Share this post


Link to post
Share on other sites

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

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!