I’ve never been concerned with online play in Unity until now. Last night as I was drifting off to sleep I came up with a pretty unique game mechanic and I’m really itching to see if it would work. It’s a really fundamental concept along the lines of the game Portal, but I can’t test it out before Unity integrates some online functionality. Can we please get a fuzzy ballpark window of when online play will be available? Unity 2.0, 2.5, etc…
As has been mentioned before we’re implementing network game play support in the 2.0 release. I sense the next question will be “when is 2.0 coming out?” and the answer is…
(radio silence)
Sorry, we’re not offering any public information on the shipping time frame so you’ll have to stay tuned for official announcements.
You actually don’t have to wait for 2.0 (although I can’t wait for it myself ), you can start now with networking right out of the box. My personal programming skill is miniscule compared to all the pro’s in these forums, but I have gotten TCP/IP working, client/server working, SOAP working, I have even got Unity to work with a POST through an HTTP proxy. The only limit that exists for Unity is what Mono is limited to, well, that is, if your lame like me and do not fully comprehend C++ integration. All that I mentioned can be done with Unity Indie. I own pro, but heaven help me, I have yet to build a decent C++ plugin. Probably do to time constraints right now.
Seriously, they went way out of there way with this editor, the power, shivers, gives me chills every time I plunge into a new idea. I have way to many projects started now in Unity to even begin to count, the latest, which is my personal thorn at the moment, is getting Rakknet integrated. If I succeed in that, well, that effort is self explanitory.
But I do appreciate the “promise” of some sort of plug and play on-line functionality for 2.0. It at least gives me a rough timeline for what I should have ready for this game once on-line play is available in Unity. In fact the SF “Unite” conference is a good deadline to set for myself to complete a prototype of this game to share with people there (along with other upcoming games my team has in the works right now).
I may even be using something even simpler. Since I can post high scores into a MySQL server I was thinking that the two-player game Ron and I want to work on that involve taking turn moving pieces (in a simple way, involving only a flat 2D direction and force) I could simply do this …
As the player takes his shot record the direction and force variables and pos them into a database.
Each player’s game client polls the database every 5-10 seconds. If it finds the direction/force filled it applies that the other player’s shot to move their piece on your board.
It then clears the database until you take your “shot” that then posts the two values back into the database.
The one issue is setting up a unique game and finding another player I guess. That one still has me stumped.
Why not go with the same idea but use it for a “lobby” of sorts? User launches game, enters their name and that their interested in playing a game with someone. A database poll is made querying for other available users, if both select each other within a certain amount of time they’re each assigned a unique game id that allows them to play against each other. That game id is used to store each of their moves as you previously described (so game A doesn’t affect games B, C, D, etc.).
That’s what I thought about doing. Instead of the database having only 4 fields (direction and velocity for two opponents) I add four more … two for names, one for “open”, and one for a unique ID.
When a player choose multiplayer they are presented with a screen showing the “oldest” 20 open games (that is, a game where one person at this same point has selected “Create game”) that simply shows a wiating player’s name. They click that name and change the status of that game to “closed” (removing it from the list) and the game begins.
I guess.
(If I was doing this in Flash I’d simply hook players up through SmartFox Server and their new SmartBits multiplayer plugin).
That how a lot of web games solve that problem. You can also allow users to have permanent accounts to score their long term scores and encourage regular usage patterns. This also allows you to have tournaments and other longer term group play.
I am curious if any one has successfully done a physics driven multiplayer game test, or game for that matter, using the current networking tools we have available. In theory it seems quite possible but I have talked to a few people about it and they had there doubts. Some thought we would need lower lever access to physX to really make it work. Can any one talk about their experiences with networking unity physics?
When I get this crokinole game going I’ll let you know. It’s the one question I have too … if the opponents shot is simply three values pushed into a database (starting point, direction and force) your game client should be able to pull that info out and recreate the opponents shot EXACTLY on your board.
And vice versa when you take your turn and push those three variables back into the database and they recreate your shot.
Everything should replicate exactly. But when i get the code that far, I’ll test over a LAN with two machines side by side and let you know.
It seems to me that physics doesn’t really make that much difference to this issue. In the end, there are two kinds of objects:
Stuff whose exact position isn’t that important. E.g. particles, smoke, bits of rubble, non-violent npcs.
Stuff whose exact position is that important. E.g. players, projectiles, violent npcs.
Remember, in a multiplayer game the worlds don’t need to be perfectly synced, just well-enough synced to maintain the illusion. (In World of Warcraft if you run alongside someone and look at their computer – you’ll be trailing them on their screen.)
For type 1 stuff we can just let the physics engine do its thing on each players’ machine.
For type 2 stuff – even without physics – someone has to own each object and periodically broadcast its canonical attributes, whether this is client/server or peer-to-peer is a matter for you to decide.
Deciding who owns which object is going to be a bit of an art (unless the server owns everything, or everything except the player). E.g. if I were implementing Quake as peer-to-peer I’d hand projectiles over to the player most likely to be hit by them (and possibly hand them over to other boxes as required).