Jump to content

[SOLVED] Game Dev.


3s2ng

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.