View Single Post
Unread 28 Aug 2007, 15:51   #11
Hude
self-entitledly superior
 
Join Date: Aug 2004
Location: Finland
Posts: 341
Hude has a brilliant futureHude has a brilliant futureHude has a brilliant futureHude has a brilliant futureHude has a brilliant futureHude has a brilliant futureHude has a brilliant futureHude has a brilliant futureHude has a brilliant futureHude has a brilliant futureHude has a brilliant future
Re: Fix the roiding to be independant of user id

Quote:
Originally Posted by Hude
Duh, updating the roids after all the battles can be done in a single SQL query. If there was 1000 battles, it affects 1000 rows. That should be executed in a fraction of second.
Ok, maybe I over simplified a bit but here's how I would do it:

- Create a temporary table with target and attacker coords and roids captured.
- At the beginning of the tick reset temporary table.
- In the battle engine, instead of updating target and attacker roids, store the coords and captured roids in temporary table.
- After battles, update target and attacker roids with a query from temporary table, no looping involved.

I wanted to add a sarcastic remark about the performance here but I'll behave myself.
Hude is offline   Reply With Quote