3s2ng Posted June 25, 2009 Share Posted June 25, 2009 Hi Freaks, I'm abit confused right now on where and how to start. Currently I'm in the planning to create a simple real time turn-based game. I'm already familiar and have a good grip on Php/MYSQL/Jquery. What I want to do is a 2 player battle game in real time. SO both players will take turns on attacking each other without any page refresh. I know this is possible in Ajax. But I'm abit lost on how can I make the battle container (<div>) on the other player to update without any page refresh when I made an attack. I dont want any page refresh just to check the current status or check if your opponent already made his move. All I want is real-time. Hope you can help me with this little experimental project. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/163642-solved-game-dev/ Share on other sites More sharing options...
xtopolis Posted June 26, 2009 Share Posted June 26, 2009 This is the basics of Ajax. You can do it the lazy/common way and make the .innerHTML of the <div> contain the new data, or the proper way (creating DOM elements). One of the key things of Ajax is only asking for the data you want to update and using javascript to manipulate the existing content with the new content. Google some basic Ajax (or JQuery ajax) tutorials and you will soon see how easy it is. Quote Link to comment https://forums.phpfreaks.com/topic/163642-solved-game-dev/#findComment-863889 Share on other sites More sharing options...
3s2ng Posted June 26, 2009 Author Share Posted June 26, 2009 Hi xtopolis, I appreciate your reply. But I'm still lost. How will I know that the other player from the side already made a move? This is easy if the players are in 1 window only. Its easy to just update the container once an action is made. To sum it up how can I remotely update the other players container? Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/163642-solved-game-dev/#findComment-863901 Share on other sites More sharing options...
Daniel0 Posted June 26, 2009 Share Posted June 26, 2009 Repeatedly poll the server until something happens (pull technology) or have the server tell you when something happens (push technology). Last one is more difficult to implement, but also better on your resources. Search Google for implementation examples. Quote Link to comment https://forums.phpfreaks.com/topic/163642-solved-game-dev/#findComment-863936 Share on other sites More sharing options...
3s2ng Posted June 26, 2009 Author Share Posted June 26, 2009 Hi Daniel0 , You saved my day. That was the term that I'm looking for. I'm started reading now about the Comet techniq. I'll be going for the push technology. Cheers mate. Long live the freaks! I will be updating you guys about my small project once I'm done. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/163642-solved-game-dev/#findComment-863964 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.