0

Hi,

I've just created my first 2d game (c# XNA) - a car racing game. My problem is how to perform a multiplayer mode. I wanted to use MySQL server. I decided to try with a local database (SQLite) first. As i suspected it didn't work. The thing is that my game displays about 20 frames per second. It gives at least 40 queries to database each second. (in case of collision it may be even more). The game takes the data from database before calling the update function, than executes player's actions and finally updates database. The problem probably is the time a database needs to process queries.

The data which is sent is just a few variables ( x and y coordinates, rotation and 6 other integers related to damage)

Simple streams would probably be fast enough but they don't work without external IP.

Do you have any ideas how to fix the problem?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by 0x69
0

As about SQL problems i could suggest only 2 things, because main perfomance problem is disk IO:

1. Read/write from/to SQL server as rarely as possible. (Maybe you can cache data localy for some miliseconds or so and after reaching cache limit - send data for update to SQL server. Reads you can perfom more frequently, but also should be lowered as possible)
2. Put all database files on RAM disk (transaction journal and temp files including) or use in-memory database (also may try other than SQLite.).

Edited by 0x69: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.