Page 1 of 1
[PHP]How to create a RTS building countdown system?
Posted: Sun May 09, 2010 2:08 pm
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.
Re: [PHP]How to create a RTS building countdown system?
Posted: Sun May 09, 2010 5:50 pm
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.
Re: [PHP]How to create a RTS building countdown system?
Posted: Sun May 09, 2010 7:59 pm
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.
Re: [PHP]How to create a RTS building countdown system?
Posted: Sun May 09, 2010 10:19 pm
by hallsofvallhalla
i have a video in the urban realms section that shows you how to do this.
Re: [PHP]How to create a RTS building countdown system?
Posted: Mon May 10, 2010 12:57 pm
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?
Re: [PHP]How to create a RTS building countdown system?
Posted: Mon May 10, 2010 1:54 pm
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.