[PHP]How to create a RTS building countdown system?

C++, C#, Java, PHP, ect...
Post Reply
User avatar
Qunox
Posts: 64
Joined: Thu May 06, 2010 4:33 pm

[PHP]How to create a RTS building countdown system?

Post by Qunox »

I was woundering how to implement a live countdown timer for an RTS PHP game.
I googled and it seams like the best way to do this is with JAVA(or AJAX) and PHP.
But it seams that all topics i'v found says it's really demanding on the server since it's live updateing.

How would go go on about creating that scrips?
I want so whenever the countdown reaches 0 a script is then executed. I'm sure you all know what i mean.
Like Tribalwars or any other MMO where you can work for an amount of time.
Here take a bad computer/programming-thingy joke:
"The best thing about UDP jokes is that I don’t care if you get them or not."
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: [PHP]How to create a RTS building countdown system?

Post by Jackolantern »

The way to go is definitely not Java. If you use Java, your whole game will have to be a Java applet. You would want to use AJAX and PHP. I am not that good at JS/AJAX, so I don't really know where to go from there, but hopefully someone else could help out.
The indelible lord of tl;dr
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: [PHP]How to create a RTS building countdown system?

Post by Chris »

You would be using JavaScript, not Java.

What exactly do you need to do, I wouldn't recommend making it go too fast if you're reloading a big PHP script every time.

Here's my tutorial on how to check if a username is available. It explains how Ajax is used:
http://indie-resource.com/forums/viewto ... =26&t=1074

Another thing you will need to do is google; 'setTimeout' and 'clearTimeout'.

If you need anything just ask.
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: [PHP]How to create a RTS building countdown system?

Post by hallsofvallhalla »

i have a video in the urban realms section that shows you how to do this.
User avatar
Qunox
Posts: 64
Joined: Thu May 06, 2010 4:33 pm

Re: [PHP]How to create a RTS building countdown system?

Post by Qunox »

Ah i will check it out as sooon as i have time for it! I'm currently in school.
I thought Java and JavaScript was the same thing, but now that you mention it i guess JavaScript is for HTML? or Page Apps in general while Java is a standalone language? Did i get that right?
Here take a bad computer/programming-thingy joke:
"The best thing about UDP jokes is that I don’t care if you get them or not."
User avatar
PaxBritannia
Posts: 680
Joined: Sun Apr 18, 2010 1:54 pm

Re: [PHP]How to create a RTS building countdown system?

Post by PaxBritannia »

Javascript: Client-side scripting, does not need to be compiled. Used for web development.

Java: needs to be compiled, can be used as a desktop app, or run as an applet online. Has capabilities like C++.

Pax.
Post Reply

Return to “Coding”