Mysql/SQL vs. XML

C++, C#, Java, PHP, ect...
Post Reply
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Mysql/SQL vs. XML

Post by hallsofvallhalla »

I have worked with SQL quite a bit but I need some professional opinions on what to use for game. I have very little experience with XML.

If I have a browser based game that updates everyone's screen every time a player moves or performs a action will it be better to use XML? I have never seen a full test on how much SQL can handle at a given time but I would think if you had say 50 players online and 14 of them were on the same map that that would be hard on the server to do a constant update to everyone. I dont mean a point click refresh style game. I mean real time. I would be using VB.Net so it would be a client side update to the browser yet still have to tag the server for every update or even every second.

Anyone have any useful experience or info on this?
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Mysql/SQL vs. XML

Post by Noctrine »

It really depends, on how many ways you want to make use of the data imo. SQL is good at scaling up, and the queries make work quick and efficient. File Writing on the other hand, can turn into a pain really quickly.

If I remember correctly file writing is faster. I don't recommend running update sql queries every second, SQL can be quite a resource hog.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Mysql/SQL vs. XML

Post by hallsofvallhalla »

Thats my major concern. If I am making it update the screen for a real time play. If a user moves then everyone who can see that user must get updated. That could be a lot of queries.
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Mysql/SQL vs. XML

Post by Noctrine »

That will be alot. 50 people every second is 3000 queries a minute. 180,000 an hour, 4,320,000 a day.

Just think, what if 10 more people joined :p
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: Mysql/SQL vs. XML

Post by Falken »

SQL is quite fast. But you would maybe want some custom script/program that is collecting all data and then lets say each minute writes to the SQL database.

XML was mainly made from what I know to be used to transfer data between different systems in a good way. So XML and SQL are 2 different things, that both is powerful when combined :)

And as someone else said, writing to a file may be quick. But what about finding specific info in a huge XML file? That would be quite slow compared to just selecting a few rows using SQL ;)
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Mysql/SQL vs. XML

Post by Noctrine »

Its fast, but it can be a resource hog. When it comes down to it, it all depends on whats most important to you. I still wouldn't recommend querying every second though.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Mysql/SQL vs. XML

Post by hallsofvallhalla »

well i will be using sql through asp.net and not mysql so that will be generally faster, i am going to research and do some tests. I am trying to figure out how to take the asp.net login control login name variable and use it in a query. Quite strange.
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Mysql/SQL vs. XML

Post by Noctrine »

meh, sql is sql in my book. +10 to mysql for being free though.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
xezero
Posts: 47
Joined: Fri Jun 19, 2009 1:35 am

Re: Mysql/SQL vs. XML

Post by xezero »

NEITHER is a promising way to go based on your game description..why would you want to save ANY type of realtime data if they're gonna be updated again on the next frame..it'll be much better if you save this information in in-memory data structures and THEN stream-save the data every minute or so (preferably on a separate thread as to not stall the real-time game)...

this is what all mmos basically do (which is why rollbacks can occur if the server crashes before the next save...albeit, you can remedy this if you have error-catching mechanisms...AKA try/catch/finally)...
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Mysql/SQL vs. XML

Post by hallsofvallhalla »

hmm yeah that makes sense, thanks
Post Reply

Return to “Coding”