Game Client
Although the game is displayed on the big screen, players interact with their local game client. The game client provides the players with the form they use to create their character. Once the player is logged in, the JavaScript code executing within the game client's browser intercepts input in the form of keystrokes or clicks of buttons found on screen.
The input is passed asynchronously using AJAX to the server side code (PHP) that places it into the database. As mentioned previously, the game client framework requires a web browser that supports JavaScript and creation of asynchronous objects.
Besides processing player input, the game client is in charge of player creation and destruction. Player creation internally creates a unique, session-based player ID that is used in the game to track corresponding player input -- each AJAX call and each entry in the database contains the player's unique ID.
In addition, the game client receives notification of game restarts. When such a notification is received, the game-specific code is expected to take the appropriate actions (e.g., joining the new game or providing the user with the initial screen to create a new player).
Figure 3. Flow of players' input into database.
Game Server
The complement to the game client framework is the game server. The game server consists of the game UI and the server code that retrieves player input from the database. While the game server code operates much like the game client code, only in reverse, the main hurdle to overcome with the game server was processing user input and updating the game shared screen with minimal delay.
In web applications, a common way to retrieve updates from the server using AJAX is to poll the server on a set interval. In our case, we had to create an environment where the players' input would seem to flow directly from the players' side to the shared game view as quickly as possible. Using an asynchronous call to poll the server would be inefficient because the asynchronous object is created each time we make a call to the server.
Instead, we put a small twist on the asynchronous call to make better use of the existing object. An asynchronous object goes through five states when making a call to the server, results are processed on the last state, and the object is destroyed. In our case, we created collaboration between the server script and the asynchronous object to retrieve results continuously.
On the server side, we created a script that retrieves players' input in a loop and flushes its output buffer on each iteration. Flushing the output buffer makes the current results available to the asynchronous object without waiting until it reaches its last state. Once the server side loop is done, the asynchronous object changes to its last and complete state where it does nothing more than destroy and recreate the asynchronous object. With this setup, we are able to simulate multiple calls to the server in order to retrieve players' input with a single asynchronous object.
Another major function of the game server is to maintain the game instance. The game server deals with game creation and destruction. The game instance identifier used by players is created by the game server and made available to players via the database. In addition, the game server processes the players' input after retrieving it from the database.
|
http://video.google.com/videoplay?docid=-1651221202388387390
ProjectorGames has been almost exactly the same idea for some 5 years now - and we're for hire ;-)
It's hard to tell from the video, but it looks like you have multiple XBox controllers hooked up to a USB hub, is that right? If so, I would say the ability to use any Internet capable device as a controller is an important difference (along with the fact that we're giving away code).
However, I wish we had known about your work while we were working on this article. I'm still interested in comparing notes & sharing work. Is there any place we can learn more about the technology behind your work?
Thanks,
--Scott
We've tried a number of different ways of getting people's input up to the main screen, including DS, PSP, mobile phones + bluetooth. Internet-enabled devices isn't something we tried, simply because people almost never have these at LANs (or they have massive alienware laptops that will singe their laps)
As for technology, well, the PG system is a custom game engine, built around a DirectX renderer, and has support for lots of abstract controllers, player naming, cross-event scoringkeeping, but there's nothing overly original there - all the cool stuff's in the game design. Feel free to grab me at djarcas@hotmail.com if you'd like to ask anything else tho.
Did I mention we were for hire for lan parties and corporate events? ;-)
I think we have a great pairing here. You say "all the cool stuff's in the game design" and we know our games are nothing special...indeed the games we created are just to show the usage model and the technology we used to hook it all together.
With more and more "mobile Internet devices" in the world every day, at some point it might be worth you checking out putting your games on our code (which we're giving away).
And I'll definitely keep you in mind for parties and corporate events. :)
--Scott
I'm trying to get this to work, but I keep getting an error that says that the MDB2.php file was not found and then it gives me a fatal error. I have it uploaded at www.brandonbarnes.us/game/index.php . I noticed in the readme that it required Apache 2, but my server is only running 1.3.41. Could this be the problem, or am I totally wrong?
Thanks!
The reason the README file lists Apache 2 as a requirement is because I had Apache 2 installed when developing this project. I would say it couldn't hurt to try it on Apache 2 if you can. However, the error you are getting seems to be related to the MDB2 PEAR package. What version of MDB2 do you have installed? I used version 2.4.0.
Thanks for trying it out...I would like to help you get this working.
Can you shoot me an email at freelance.brandon@yahoo.com ? I would love to get this working.
I've got the MDB2 PEAR package installed, but it still doesn't recognize it, so I'm wondering what else it could be.
Thanks!