So I’m fairly new to PHP, I’ve been working on a real-time browser-based game for the last couple of weeks. Everything with the graphics have been going great and I’m now ready to start working on the real-time aspect of the game. Here’s a picture of what I have so far, this is the main section of the game showing the map navigation page:
Since I’m attempting this project for the first time I need a bit of help getting started. In my game there are 4 types of resources - wood, stone, iron, and gold. These resources are generated by constructing resource buildings on the map. For example, when a player constructs a lumber mill on the map, he/she starts generating wood at a rate of 60 units/hour. What’s important here is that resources are generated over time, and it’s this which I need help with right now.
There are other browser-based games out there which use the same resource generation over time, I recommend you guys check them out since I’m trying to simulate the exact same concept in my website. Here’s some links for a couple of those games:
http://www.tribalwars.net/
http://cb1.castle-battle.com/
If you’ve noticed, these websites update the resources a player has dynamically, meaning that if a player is generating 60 wood/hour, the amount of wood the player has goes up by 1 every minute, without having to refresh the page. This is what I need to simulate in my game. Since the resource counter needs to update without the page having to refresh, I’m assuming I would need to use some form of javascript? I’m really not sure haha. It would be great if anyone experienced in this sort of thing can give me an idea about how to go about this, it’s been done in the other websites I’ve just showed you guys, so there must be some way of doing it.
So any and all input is welcome, thanks in advance.
