Advertisement

Mixing PHP and Javascript for Base building type RTS games

Started by May 09, 2022 10:52 PM
3 comments, last by felix.speagel 2 years, 7 months ago

I am interesting in making a simple browser RTS game - the type that has timers on buildings and mats. So my main question is how can javascript timer and vars be mixed with PHP?

I am aware of the serverside (php) and client side (JS), so if these games do not use javascript, what other methods are used to create a live timer and then show results?

Thanks!!!!

This is not a Writing question. Moving to a more appropriate forum.

-- Tom Sloper -- sloperama.com

Advertisement

thanks - sorry.

Well, one simple method which comes into my head is: when a player makes some decision which launches some action that requires some time to finish, it is best to mark its time of completion on the server side. Then, I think, your JS could just store that time and show to the player a timer.

Although, it is simple what I wrote here, I have to emphasize one thing: time of completion MUST be stored on your server. I have seen some games like the one you described (my dad once played one of such a game), and I saw that many players search for some “hack” to speed up their building process in a game. If, for example, you would chose to place all that time counting system in JS then a savvy player may simply ignore your JS program and write his own and then use it to force your server-side program to finish building something before time.

None

This topic is closed to new replies.

Advertisement