|
So I've done a bit of javascript and php programming and I'm fairly comfortable with both now. I've used AJAX a few times - but never really focused on it. I assume I'll need to use PHP/JS/AJAX for what I need to do.
I'm making a program, multiple users will be able to join one lobby in my program. I will need to allow each user to use different tools and create different objects, and send these to every user in that lobby.
It sounded easy at first, I would just send "Create new [object]" using AJAX to the web server. But I'm not sure where that should go... I don't know how you would send commands to each client with PHP.
In a perfect world, I would send a formatted array like so:
object Soldier {
int HP (300)
string Name ("Somebody")
}
But thinking about how PHP works, I would need to send this to a random page, which the client would read from constantly to find new data. Then I'd have to make a framework to interpret the commands.
Is there an easy way to accomplish this? And is there a term for what I am describing? I've done several google searches, and found some things about CGI and flow charts about how PHP is a server-side language. But nothing was what I was looking for.
|