Hey guys

So at the moment i'm making an online strategy game a bit like tribalwars.net.

I'm having a problem with building construction, unit recruitment, travel times etc.

For example..

When a user clicks "build" for a building, the building will be added to a queue and will be completed in X seconds.

How will i do this server-side? How does tribalwars.net and other games do these queues?


Thanks very much :]
-Ollies

what language are you using?
If you are using php you can use sleep() function

to make the pphp stop for x seconds and then start again when the building time is complete

Member Avatar for diafol

Doing this via php can be tricky. Using Ajax also poses problems, as it is asynchronous - queuing requires extra coding. Using the server for this can be a little intensive - Perhaps having data updated immediately in php and then using js (if that's what you're using) to sort out the delay?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.