Jump to content

  • Log In with Google      Sign In   
  • Create Account

Simple MORPG project planning


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
24 replies to this topic

#1 Herwin P   Members   -  Reputation: 645

Like
0Likes
Like

Posted 11 April 2013 - 08:02 AM

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, 11 April 2013 - 08:09 AM.


Sponsor:

#2 yewbie   Members   -  Reputation: 665

Like
0Likes
Like

Posted 11 April 2013 - 09:26 AM

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.



#3 Jutaris   Members   -  Reputation: 478

Like
1Likes
Like

Posted 11 April 2013 - 09:47 AM

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 Site -- My Music  -- My Ramblings -- My Game

 Basic Flying Rules:Try to stay in the middle of the air. Do not go near the edges of it. The edges of the air can be recognized by the appearance of ground, buildings, sea, trees and interstellar space. It is much more difficult to fly there.

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


#4 KnolanCross   Members   -  Reputation: 1369

Like
0Likes
Like

Posted 11 April 2013 - 10:39 AM

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, 11 April 2013 - 10:41 AM.

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


#5 wizardpc   Members   -  Reputation: 282

Like
6Likes
Like

Posted 11 April 2013 - 05:52 PM

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.


 



#6 Herwin P   Members   -  Reputation: 645

Like
0Likes
Like

Posted 11 April 2013 - 10:22 PM

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.



#7 thok   Members   -  Reputation: 693

Like
2Likes
Like

Posted 12 April 2013 - 06:59 AM

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



#8 Herwin P   Members   -  Reputation: 645

Like
0Likes
Like

Posted 12 April 2013 - 07:48 AM

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



#9 KnolanCross   Members   -  Reputation: 1369

Like
-1Likes
Like

Posted 12 April 2013 - 08:31 AM

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, 12 April 2013 - 08:32 AM.

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


#10 Steveway   Members   -  Reputation: 302

Like
0Likes
Like

Posted 12 April 2013 - 08:38 AM

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



#11 thok   Members   -  Reputation: 693

Like
0Likes
Like

Posted 12 April 2013 - 09:11 AM


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

About the database, and this database class you're working on:

First, if you already have 42 tables, but haven't started coding yet, you're doing it wrong, in my opinion. You're also likely to run into surprises once you start using the database. Perhaps for the moment the best approach is to use your schema as a design guideline, but build the actual db from scratch, adding what you need as you go along. It's good to look ahead and try to anticipate, but don't try to look too far. :)

Second, are you using an ORM? If not, do it, especially if you're dealing with 40+ tables. If you don't use one, you're going to end up basically writing one yourself--and it's going to suck. That's not a criticism of your programming skill, it's just that these things already exist. Use them. Sqlalchemy is nice, and you can also use Django. Django includes a bunch of other stuff you won't need, but the ORM is quite good. This will make your life easier, especially when you find yourself writing generic insert, update, and delete code. There is a learning curve, but please, for the love of god, use an ORM.

Finally, about normalization. My favorite quote about this is, "Normalize until it hurts; denormalize until it works." This goes back to my previous point: try to build what you need, as you go. Change when necessary. Iterate.

Hope that helps.

#12 thok   Members   -  Reputation: 693

Like
1Likes
Like

Posted 12 April 2013 - 09:21 AM

Oh, slightly off topic. Learn to use a version control system, if you haven't already. This is necessary even for solo projects, in my opinion, and absolutely critical for a team.

If you already are, great! And sorry for the assumption. If not, git and svn are good choices. I prefer git for several reasons, but I will stop now before initiating a tool choice holy war.

#13 wizardpc   Members   -  Reputation: 282

Like
0Likes
Like

Posted 12 April 2013 - 10:10 AM


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? smile.png

 

Thanks for the reply guys.

 

I'll Show you my Buff table I used in my Database.  I actually grouped spells as buffs so they had a type.  (note statement is for a SQLITE3 database)

 

 
CREATE TABLE Spells (
 spell_id INTEGER PRIMARY KEY AUTOINCREMENT,
 school_id INTEGER,
 school TEXT,
 class_id INTEGER,
 name TEXT,
 desc TEXT,
 attack_value NUMBER,
 range  NUMBER,
 cost  NUMBER,
 cast_time  NUMBER,
 recast_time  NUMBER,
 spelltype INTEGER,
 duration INTEGER,
 stuns INTEGER DEFAULT  0,
 mezs INTEGER DEFAULT  0,
 tick INTEGER DEFAULT  0,
 forever INTEGER DEFAULT  0,
 passive INTEGER DEFAULT 0
);
 
Notice this is kinda denormalized because I only have 36 spells in my game so I lumped things into one table, for easy querying at the start of the game. I ended up have 3 types of spells.
 
1. Target is Hostile
2. Target is Ally (friendly) for heal spells
3. No Target.
 
So obviously any Damaging spell needs to be type 1 because those spells require the user to be targeting an enemy.  Can be damage, or a stun, etc..  If I want a spell that heals or a buff that you must click on people i set that type to 2 in the database.  I also made a rule about type 2 spells.  If targeting noone or an enemy, the spell will still cast but the allied target will be yourself.  So you can self heal without having to click on your avatar/player etc...  Type3 is where any group spells came in to play.  No target is required, and it uses the range value in the database.  Again, another rule in my game was all type3 spells casted work on yourself.  So If I wanted a self buff I would make it range = -1.  
 
THen I had various flags for all the buffs I wanted:
 
Tick- calls the buff to do something every tick amount.  Lets say I have a power song that my Bard class can give to the group.  But i want it to chant every 5 sec so they have to stay near him.  This tick value is set to 5.  I set the type to 3, and the range to 20.  Now this is a group pulsing buff that will pulse every 5 sec, and i set the duration to 30, so if they leave the presence of the bard the buff will fall off in 30 sec.  Notice the bard spams the buff everytime because I will set the Forever flag to true (see below).
 
Amount - If type 1 spell this is used as a base number for damage.  If type2 I use this for healing amount.  If type3, depends on buff but could be stat increasing, torns amount, an HP/MP regen rate, etc....
 
Stun/Mez - Will this spell stun or mez the enemy.  Use Duration (in some formula of the game) to figure out how long.
 
Forever - This tells the buff to RECAST itself to the owner.  I used this for my bladeturn ability.  If bladeturn buff is on, then the next time you get hurt from an enemy, the attacks damage is reduced to 0. The buff comes off, but the Bard's bladeturn will reapply itself every (duration) secs.  That way you have to BE near a bard to get the benifits of the buff.  The buff will last until you logout, but it won't get reapplied unless you are near him.
 
Passive - This flag tells the game to ignore duration.  The buff will stay on forever.  I used this for buffs that increased stats.
 
cast_time - How long does it take to cast the spell.  Can be zero for instant cast spells
 
recast_time - How long till you can recast this spell. Can be Zero (but you shouldn't have cast time and recast time = zero or someone can cast a lot of spells in 1 sec!)
 
Things like amount and duration are actually base values that get thrown into a formula so the spell scales with INT and Level etc.....    Maybe this can help you out, but at least it shows one approach to spells.  Also, having all the datapoints in a database made it easy for me to give the game to my friends to play, and I can make quick database changes while attempting to balance, without having them redownload the game, or recompile it, etc.  So remember to try and avoid any hardcoded values in your source code. 


#14 KnolanCross   Members   -  Reputation: 1369

Like
0Likes
Like

Posted 12 April 2013 - 10:33 AM

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

 

Why? I do know the difference between the multiple implementations.

 

Can anyone point me where I am wrong? I just would like to know why people are giving me negative posts, I am not saying anything wrong in my posts, If I am, I want to know it.


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


#15 Herwin P   Members   -  Reputation: 645

Like
0Likes
Like

Posted 12 April 2013 - 10:37 AM

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

So... it's fine to use Python for the server?

 

First, if you already have 42 tables, but haven't started coding yet, you're doing it wrong, in my opinion. You're also likely to run into surprises once you start using the database. Perhaps for the moment the best approach is to use your schema as a design guideline, but build the actual db from scratch, adding what you need as you go along. It's good to look ahead and try to anticipate, but don't try to look too far. smile.png

 

Actually I've designed it on my papers (a poorly-drawn schema with lines, squares, and pieces of script here and there). What I meant with writing the database class is putting those script pieces on that papers into text editor in files. I hope I can merge it right. Hmm... maybe I do it wrong indeed. XD

 

Second, are you using an ORM?

Yes, SQLAlchemy, but I'm still learning about it.

 

My favorite quote about this is, "Normalize until it hurts; denormalize until it works."

I like this. By the way, this sounds promising to me :

 

"Keep the logical design normalized, but allow the DBMS to store additional redundant information on disk to optimise query response."

 

But I don't know how to implement it with Python.

 

Learn to use a version control system, if you haven't already.

Oh I will! Please list the things I need to learn and throw it to me, sir. I really am eager to learn as much as possible. :)

 

I'll Show you my Buff table I used in my Database. I actually grouped spells as buffs so they had a type. (note statement is for a SQLITE3 database)

That's interesting. I will keep them in mind.

 

By the way, what do you think about the way I handle buff? I store the spell information in one table (name, description, mana_cost, etc) and store the effect in another table (contains the spell_id and the value for particular effects). The effect table stores the function name in string. The program will look for the effects the casted spell has (select bla from effect where spell_id=bla), then save it and the value for each effect. Then from that list of effects, I do a for loop and call the functions dynamically (about the function math) and insert the value as the argument.

 

Like spell with id = 1 has effect A with value a and effect C with value c. Then from that list with A and C in it, I do a for loop. For each loop I call the function using the string name, and use the value. In this case, the first loop will call A(a). Then in the next loop, C© will be called.

 

Am I doing it wrong? I love this kind of discussions. :)



#16 KnolanCross   Members   -  Reputation: 1369

Like
1Likes
Like

Posted 12 April 2013 - 10:47 AM

@skywarden

 

Yes it is possible to have a server using python, I use it on mine!

But I use binds for physics/collision so the math is made with C++ and I profile my code and improve performance using cython (an optimizer).


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


#17 Herwin P   Members   -  Reputation: 645

Like
0Likes
Like

Posted 12 April 2013 - 11:01 AM



Yes it is possible to have a server using python, I use it on mine!

But I use binds for physics/collision so the math is made with C++ and I profile my code and improve performance using cython (an optimizer).

Thanks for clearing that up. By the way, the collision detection is done by server right? Or the client?



#18 KnolanCross   Members   -  Reputation: 1369

Like
0Likes
Like

Posted 12 April 2013 - 11:18 AM

I execute the algorithm on both sides.

The client uses the information to be more responsive and results on better gameplay, still the server has the final decision (to avoid hacks).


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


#19 wizardpc   Members   -  Reputation: 282

Like
0Likes
Like

Posted 12 April 2013 - 11:18 AM

@skywarden

 

That sounds like the buffs might work.  You might want to have 3 tables.

 

-Spell table

-Effect Table

-SpellEffectJunction Table.

 

 

 

So you can customize your spells with different effects.  I'm not sure if yoru effects are what the spell does (like damage, heal) or the graphic elements of the spell (what particle system to use).  But I guess this would work for either way.  If you have three tables, you can define your spells, define your effects, and then the junction table is a simple 2 column table with a spell_id and an effect_id (forgive me if this is what you had in mind).  Then you can add as many effects to a spell by inserting them in this table.  A query will return all effects related to the spell in the query.

 

Also, is this a client side database or on the server?  Because the client will need to load all of this from the server before they start the game (i'm guessing).  But you want the values to be controlled on the server so you can easily apply server side patches to balance the game.



#20 Herwin P   Members   -  Reputation: 645

Like
0Likes
Like

Posted 12 April 2013 - 08:46 PM

You might want to have 3 tables.

 

Aye. That's how I do it. I have a table to store the effects, then magic table to store basic information about magics, and magic_effect to store the effects of magics and its value. That way, I can use the effect table for other tables like buff, items, etc and make a pivot table to relate them. For magic, I have these three :

 

-effects

-magics

-magic_effect

 

Magic elements, etc are stored in other tables. Like you said, if I want to add a new kind of effect I can easily insert it in the effects table and relate them in the magic_effect. I do it this way because I think not all magic has stun effect, and filling it will null doesn't feel just right. smile.png

 

The database is on the server. I think it's more secure. I mean, if it's a client-side database, the client can hack it right? To make sure that everything is secured, I make the client to act more like an input and display device, and the server do the game. I don't need to patch the client engine frequently that way, right?

 

What I put in the client are just the physic (I don't care about physic hack), sprites and models (who wants to hack them anyway?), and things to handle user input. My plan is to make the client engine detect input like 'move forward' then send the vector to the server. Then the server read that vector and see if it will make collision or not. The server later announce the result to the world.

 

I'm still rather confused with this actually. From what KnolanCross said, I assume that this kind of math is slower to do in Python, and the colission detection will be faster if it's done in the client. Do I get it wrong? Maybe you guys have an alternative? I really want to know the best way to do everything. biggrin.png


Edited by Sky Warden, 12 April 2013 - 09:09 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS