Database/hosting help

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

LockNLoad
Forum Newbie
Posts: 7
Joined: Sun Mar 01, 2009 3:41 pm
Location: Balad, Iraq

Database/hosting help

Post by LockNLoad »

Hello everyone,
I need some help concerning databases and a hosting plan to support them.
I am creating a simple text based MMO war game. The way it is going to be set up is:
World
14 Planets within the world
8 civilizations within each planet
8 players within each civilization

I am new to databases and was wondering if, based on that, anyone could tell me (about) how many databases I would need, or if it is just 1 large database. (I have heard both) I am trying to set up my hosting for this and I found a good plan that offers only 100 databases, so I want to be sure before I pay.
Which leads me to... For a simple text based game, do I need a dedicated server? Or can I get away with a decent hosting plan?

Thanks for the help in advance
Cheers
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: Database/hosting help

Post by omniuni »

Most of this depends on what language you plan to use to write your MMO. If you are using PHP, then a basic shared hosting setup would work fine. You could use either MySQL or if you don't plan on your database exceeding a few gigabytes, you could use SQLite as well. If you are using another language, like Ruby or Python you will need either hosting that supports the language, or some kind of VPS or dedicated hosting.

Your larger challenge will be designing your database correctly, and writing a command parser for people to use to interact with your game.

Good Luck!
-OmniUni
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Database/hosting help

Post by califdon »

Let's get some database terminology clarified, right away. A database contains an unlimited number of tables. Ordinarily you never have more than one database per application, so the hosting limitation of 100 databases effectively means that you might be limited to 100 different games, which you probably will not live long enough to program! :?

I know nothing about programming games, and I have no way to guess how many simultaneous players you would be likely to attract, but generally I would think you don't need to run a dedicated server until you start having thousands of hits per second. If you are just starting out in this, I would advise you to go with a shared hosting plan and see if you experience any performance issues. My guess is that you won't, but in case you do, it's usually pretty easy to shift over to a dedicated server, perhaps only requiring the renaming of some server names.

Back to the database, you will surely need several tables in your database. How many depends 100% on how you design your database. It's of critical importance that you do this in accordance with the very strict rules of relational database design. There are many tutorials on this online. Search for key words relational database design or relational database tutorial. The place you must start is determining what entities you want to represent in your database. Each entity will result in one table, then you may need to add other linking tables for many-to-many relationships. But don't even start to think about the database until you have read and understood the fundamental principles of relational databases. It's quite a precise science, not a hand-waving art, believe me.
LockNLoad
Forum Newbie
Posts: 7
Joined: Sun Mar 01, 2009 3:41 pm
Location: Balad, Iraq

Re: Database/hosting help

Post by LockNLoad »

Thanks for the great information. I will start reading!

I am using php, but being new to databases, I wasn't sure and have received conflicting information. Thanks for clearing that up. @ the server, I just wanted to be sure that if x amount of people were logged in, it wouldn't lag etc. But with basic text, common sense told me that I should be fine with a shared host.

Again, many thanks :)
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: Database/hosting help

Post by omniuni »

Unfortunately, it's not the text that really should be an issue. 100 databases could mean 100 different games, but only it it's set up that way. A database could have a table for each game, you may have one database per planet, with a table representing in a grid-type layout, the "land" with each cell having a reference of who is "standing" in it. There may be another table with information about what objects are in each "cell". How you design the system itself, is up to you. Will you need an entire database for each person playing? Will everyone exist in the same "universe"? How will you actually have players move around and perform actions? Start by seeing if you can create an environment where you and a few friends can "walk" around a "room" and interact in some way. Once you have achieved that, I would say, you should be ready to start making something bigger.

Good Luck!
LockNLoad
Forum Newbie
Posts: 7
Joined: Sun Mar 01, 2009 3:41 pm
Location: Balad, Iraq

Re: Database/hosting help

Post by LockNLoad »

Now I am confused again. First it was said I can use many tables within one database, and now you're asking me if each person will need their own LOL

The way it is set up is:
Each person will build up his or her account. They share a civilization with 7 other people, where they can contribute their money, goods etc into 1 bank if they so choose. 8 civilizations make up a planet which everyone in the civilizations can contribute seperately, by donating weapons, money, goods etc. Each planet will be able to barter with other planets but the main goal is to fight and be the best in the universe. There will be a goverment, like a king or something for each planet. I would like to set up some sort of central marketplace so people can put their goods up for sale, or they can buy.

There won't be any "moving around." Fighting takes place by scanning through planets and civilizations and looking at individual players and attacking them. Planets can attack as a whole also.


I think that is about all I can think of right now. Maybe you can visualize it and let me know what you think in regard to the database structure.
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: Database/hosting help

Post by omniuni »

I would try to imagine a schema, but I'm afraid it makes me feel somewhat nauseous. :dubious:

I'm afraid this is really all up to you. Good Luck!
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Database/hosting help

Post by califdon »

LockNLoad wrote:Now I am confused again. First it was said I can use many tables within one database, and now you're asking me if each person will need their own
I know almost nothing about programming (or even playing) computer games, but the fact is that, normally, one application uses one database. I wouldn't rely on any advice to the contrary. Most non-trivial databases have many tables, one for each entity represented in your database.
LockNLoad
Forum Newbie
Posts: 7
Joined: Sun Mar 01, 2009 3:41 pm
Location: Balad, Iraq

Re: Database/hosting help

Post by LockNLoad »

OK thank you calif, that does make sense from what I have been reading.
I really appreciate it.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Database/hosting help

Post by onion2k »

I can't think of a single example of an application that would be better off using more than one database. This game is no exception.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Database/hosting help

Post by califdon »

onion2k wrote:I can't think of a single example of an application that would be better off using more than one database. This game is no exception.
The only thing that comes to mind would be a distributed application with many servers, perhaps on different continents, or in the case of absolutely immense databases, like Google or Yahoo! or Amazon, where their data storage is so inconceivably huge that they need to partition the data for performance reasons.
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: Database/hosting help

Post by omniuni »

Agreed, although it is possible that if you require your data to be separated for some reason that you would want to use multiple databases. With programming a game, it may be that you would prefer for all the data about the "layout" of your "universe" to be self contained, that way if you decide to expand in the future you could move that DB onto a different server. It does not sound like in this case that would be required, though.
LockNLoad
Forum Newbie
Posts: 7
Joined: Sun Mar 01, 2009 3:41 pm
Location: Balad, Iraq

Re: Database/hosting help

Post by LockNLoad »

Hey again everyone,
I have been doing a lot of studying up and I feel a little more comfortable with this whole issue. However, I am still very confused as to how I should set up all these tables etc.
If someone would be willing to talk with me to help me sort this out, I would greatly appreciate it! I am not asking anyone to do this for me, I just want to be pointed in the right direction and make sure the layout will work since I am confused.
I will gladly pay you for your time!!!
I am not sure if there is an email link here or not, but please pm me.
Thanks
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Database/hosting help

Post by jayshields »

You need help setting up the tables or deciding what tables you will need?

Setting up tables is done with the SQL query CREATE TABLE. Choosing appropriate tables is more complex. It is usually done by identifying entites like califdon said. So you might want a table for players, worlds, civilisations, planets, etc. If you have many-to-many relationships between entities then you might need a cross-over table (one which only contains the primary keys of the related tables) depending on which RDBMS you choose.
LockNLoad
Forum Newbie
Posts: 7
Joined: Sun Mar 01, 2009 3:41 pm
Location: Balad, Iraq

Re: Database/hosting help

Post by LockNLoad »

I need help deciding which tables I will need to create. I have an example site for someone to look at, so they can get a better idea of my set up. I just can't figure out how they should be set up according to planets, civilizations, and/or each player(being that each player has an individual account, but it's within a civ. which is within a planet)
Sorry, I know I am confusing - I can't think of how else to explain my own confusion.
Post Reply