Jump to content

Recommended Posts

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,

 

Link to comment
https://forums.phpfreaks.com/topic/163642-solved-game-dev/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/163642-solved-game-dev/#findComment-863889
Share on other sites

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,

Link to comment
https://forums.phpfreaks.com/topic/163642-solved-game-dev/#findComment-863901
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/163642-solved-game-dev/#findComment-863964
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.