Building a Multiplayer Card Game
by Scott Johnson · in Torque Game Builder · 07/16/2006 (12:08 pm) · 14 replies
Hello All,
I've now progressed through the basic tutorial, and I'm anxious to get started building up a 4 player card game that will demonstrate some of the awesome graphical abilities of the TGB Engine..
I had started to prototype my game in C# from scratch, and I'm sure I would eventually be able to come up w/single player variant in a decent amount of time.. however the networking was going to be a killer for me...
My Question is, where should I start, I've glanced at the chess sample, but I'm just wondering if anyone has attempted a card game (or more than 2 player game) in this engine, and if so, any words of wisdom would be appreciated.
I have some concerns, mainly in the area of AI.. as I would like to include the ability to have computer controlled players for those times in which no one is available to play.
Can a decent computer player be done? speaking of the engine here, not the programmer.. :)
Also... It would be great If there were a way to communicate some data back to a webserver back end (via POST or something similar) so that scores, and winnner/loser stats could be remembered...
Thanks in advance for any help here...
I've now progressed through the basic tutorial, and I'm anxious to get started building up a 4 player card game that will demonstrate some of the awesome graphical abilities of the TGB Engine..
I had started to prototype my game in C# from scratch, and I'm sure I would eventually be able to come up w/single player variant in a decent amount of time.. however the networking was going to be a killer for me...
My Question is, where should I start, I've glanced at the chess sample, but I'm just wondering if anyone has attempted a card game (or more than 2 player game) in this engine, and if so, any words of wisdom would be appreciated.
I have some concerns, mainly in the area of AI.. as I would like to include the ability to have computer controlled players for those times in which no one is available to play.
Can a decent computer player be done? speaking of the engine here, not the programmer.. :)
Also... It would be great If there were a way to communicate some data back to a webserver back end (via POST or something similar) so that scores, and winnner/loser stats could be remembered...
Thanks in advance for any help here...
About the author
#2
07/17/2006 (12:23 pm)
I have all of these elements working in Capicu, my online Dominoes game. So its definitely doable. I would suggest making sure your really sharp on the checkers tutorials, and a little hint, in the common directory, alot of the magic is stored in the GUI files for the server/client GUI's.
#3
One question that really comes to mind is how to go about doing the "Lobby" where players can meet up, and see games that are waiting for players, etc..
Would it be better to implement one "in-game", or would it be better to host a lobby on a webserver for example, and then allow the players to "join" a game on said server, then when the game was ready to start, it would have everyone's game start... Rodney I would certainly be interested in your comments on this one...
I have discovered (after working in the checkers tut..) the common folder.. I think I will be doing some digging in there for a while... lots of good stuff.
Thanks for the feed back, and please keep it coming.
07/17/2006 (4:27 pm)
Yes, I have been stepping through the checkers tutorial, and i am starting to get some basic understanding of the networking side of things, however much more to go on this front.One question that really comes to mind is how to go about doing the "Lobby" where players can meet up, and see games that are waiting for players, etc..
Would it be better to implement one "in-game", or would it be better to host a lobby on a webserver for example, and then allow the players to "join" a game on said server, then when the game was ready to start, it would have everyone's game start... Rodney I would certainly be interested in your comments on this one...
I have discovered (after working in the checkers tut..) the common folder.. I think I will be doing some digging in there for a while... lots of good stuff.
Thanks for the feed back, and please keep it coming.
#4
07/17/2006 (4:35 pm)
There is some chat system files in the common directory that have already set up a multi-user chat system using commandToClient and commandToServer. That might be a better example.
#5
You can view games to play via data queried from a "Master Server" that the in game lobby gui hits to query for games. You can hit my website to see games in play, however there really is no good way to "launch" a game from a website in game, so I dont have that available to really launch a game.
I wrote my own version of a "lobby" type gui , that mixes the joinServer and the chat stuff Matthew just mentioned, so it allows you to chat with other players, invite, them, etc.
But I dont really do anything from the website other than telling people how many games are in play, etc. and showing some statistical information thats fluff.
You Might check out my Master Server Resource for how to host your own Game Broker type resource on your own server.
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10702
The real guts though of the Server / Client piece of mine is still heavily on the players machines.
The Master Server is really nothing more than a fancy Finger Service.
Hope that helps some.
--Rod
07/17/2006 (4:44 pm)
The difinitive source of the game state and games in play is my backend postgres server. You can view games to play via data queried from a "Master Server" that the in game lobby gui hits to query for games. You can hit my website to see games in play, however there really is no good way to "launch" a game from a website in game, so I dont have that available to really launch a game.
I wrote my own version of a "lobby" type gui , that mixes the joinServer and the chat stuff Matthew just mentioned, so it allows you to chat with other players, invite, them, etc.
But I dont really do anything from the website other than telling people how many games are in play, etc. and showing some statistical information thats fluff.
You Might check out my Master Server Resource for how to host your own Game Broker type resource on your own server.
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10702
The real guts though of the Server / Client piece of mine is still heavily on the players machines.
The Master Server is really nothing more than a fancy Finger Service.
Hope that helps some.
--Rod
#6
Nice work on the Capicu I might add.. you should seriously consider a "Mexican Train" variant.
Just a suggestion from a fan of the game.
I'm thinking/hoping that something like a small java app, or active x (if I must) might do the trick from a webpage... you know just to give the "game portal" of a website the ability to really be a portal...
I'm starting to see an actual solution forming in my head (at least one that's closer to realistic).
Are you also able to gather statistics for the back end ?
Still searching for that HttpObject mentioned above.. any quick shortcuts?
07/17/2006 (4:57 pm)
LOL, I was out reading that site as you posted this (followed your profile link).Nice work on the Capicu I might add.. you should seriously consider a "Mexican Train" variant.
Just a suggestion from a fan of the game.
I'm thinking/hoping that something like a small java app, or active x (if I must) might do the trick from a webpage... you know just to give the "game portal" of a website the ability to really be a portal...
I'm starting to see an actual solution forming in my head (at least one that's closer to realistic).
Are you also able to gather statistics for the back end ?
Still searching for that HttpObject mentioned above.. any quick shortcuts?
#7
On the other stuff.
Read this. http://www.garagegames.com/blogs/32/10202
I dont use httpObject I use a tcpObject like Mr. LabRat there does.
I have a dynamic backend that can take posts regarding game state from multiple clients playing the same simulation, etc. In fact, you can even make play moves over my website engine. But that requires the clients to poll for state updates.
I even have in Game Profile Logins working using tcpObject with some encryption.
I can feed games to join into control and build objects based off what it receives, but it starts getting a bit "hairy" regarding making sure things are going on, etc. I just dont like to use http for the lobby portion, I've found the built in client /server stuff to be stable and work fine.
07/17/2006 (5:11 pm)
Yeah the plan is to come out periodically with new game versions of it , starting with a basic 6x6 game and a Capicu version, with more rules and types coming out, I've never played one called "Mexican Train", but knowing dominoes it probably goes by other names as well. I'll search the web for rules of it. On the other stuff.
Read this. http://www.garagegames.com/blogs/32/10202
I dont use httpObject I use a tcpObject like Mr. LabRat there does.
I have a dynamic backend that can take posts regarding game state from multiple clients playing the same simulation, etc. In fact, you can even make play moves over my website engine. But that requires the clients to poll for state updates.
I even have in Game Profile Logins working using tcpObject with some encryption.
I can feed games to join into control and build objects based off what it receives, but it starts getting a bit "hairy" regarding making sure things are going on, etc. I just dont like to use http for the lobby portion, I've found the built in client /server stuff to be stable and work fine.
#8
What exactly does this sample master server .pl script do? I generally understand it being a finger daemon, but in its current state, I'm trying to get a picture of what would happen if my linux buddy with his server runs this daemon... and how might I be able to easily test if it's functioning?
Also since I have a hosted site, my host provider might be interested to know what the ramifications of using the POE, and this script are to his server so that we could lock it down...
Also, I would love to learn more about the dynamic back end, any possible sample or tutorial for say a simple high score tracking based on this system?
I could even do a tutorial, if I could score some code...
07/17/2006 (6:58 pm)
Wow.. I wish I had a linux server now.. dang..What exactly does this sample master server .pl script do? I generally understand it being a finger daemon, but in its current state, I'm trying to get a picture of what would happen if my linux buddy with his server runs this daemon... and how might I be able to easily test if it's functioning?
Also since I have a hosted site, my host provider might be interested to know what the ramifications of using the POE, and this script are to his server so that we could lock it down...
Also, I would love to learn more about the dynamic back end, any possible sample or tutorial for say a simple high score tracking based on this system?
I could even do a tutorial, if I could score some code...
#9
All that perl resource file does is start a daemon listening on the specified port for "servers" to connect and start HeartBeating. When Clients want to join a game, and you click the Master Server button in the joinServer gui, it calls that master server to see who is serving games, and they gui on the clients side renders those into selections the client can make on which game to join.
BTW: That code does not require linux. It runs just fine on windows as well, and should on Mac, even though I haven't tested it on Mac. All you need is a copy of ActiveState Perl , and use the ppm command line tool to install POE.
I can help explain the backend a little more if you need me too, but its really just a loose state machine written in perl , that uses postgresql to store state.
07/17/2006 (7:06 pm)
Unfortunately, the Master Server is the only piece of code I'm going to release for now on this project. And my Customized Master Server is much different that what I posted, since that one needed to remain Generic. (For instance Mine doesn't store the information in a perl hash, mine is stored in a database, and queried), then my other web tools use that for state as well. All that perl resource file does is start a daemon listening on the specified port for "servers" to connect and start HeartBeating. When Clients want to join a game, and you click the Master Server button in the joinServer gui, it calls that master server to see who is serving games, and they gui on the clients side renders those into selections the client can make on which game to join.
BTW: That code does not require linux. It runs just fine on windows as well, and should on Mac, even though I haven't tested it on Mac. All you need is a copy of ActiveState Perl , and use the ppm command line tool to install POE.
I can help explain the backend a little more if you need me too, but its really just a loose state machine written in perl , that uses postgresql to store state.
#10
I may take you up on that explanation, but I got a bit of work ahead of me anyhow, and will be revisiting this soon.
Rodney, thanks a million for your feedback on this. It is really educational.
07/17/2006 (7:12 pm)
Ok, I'm cool with that... and was just realizing that about the active state.. I do have a server for that.. need to get back into it any how...I may take you up on that explanation, but I got a bit of work ahead of me anyhow, and will be revisiting this soon.
Rodney, thanks a million for your feedback on this. It is really educational.
#11
07/17/2006 (7:15 pm)
No Problem, the stronger the community, the stronger we all are. I'm sure you'll answer a question of mine or two before were all done with these damn games :-)
#12
ActiveState installed
POE installed
Modifed the server.pl
ran the script.
Built the checkersdemo tutorial (zip exe deployed)
put it on laptop 1
put it on desktop 1
Ran both games
SUCCESS!! I can "Query Master Server" for the list of games. and connect and play.
Whiz bang..
Well sort of... I did have one small wrinkle with the prefs..
forgot to change the common\preferences\prefs.cs to point to the new master server before I packaged..
No big woop.
Yeah.. Rodney you are "Torqued"
07/17/2006 (8:50 pm)
Progress Update.ActiveState installed
POE installed
Modifed the server.pl
ran the script.
Built the checkersdemo tutorial (zip exe deployed)
put it on laptop 1
put it on desktop 1
Ran both games
SUCCESS!! I can "Query Master Server" for the list of games. and connect and play.
Whiz bang..
Well sort of... I did have one small wrinkle with the prefs..
forgot to change the common\preferences\prefs.cs to point to the new master server before I packaged..
No big woop.
Yeah.. Rodney you are "Torqued"
#13
07/17/2006 (8:59 pm)
Congrats, I'm glad it worked so seamlessly for you, that was a design goal of that script, to make it easy to plug a non modified Server into... If you run into any problems let me know so I can fix it and update it :-)
#14
07/20/2006 (11:57 pm)
Thanks for all the help you gave Scott Rodney :) We have a great community! Glad you found your answers and got that working Scott... if you need any more answers keep posting, Rodney here might beat me to them and lessen me and Thomas B.'s load :)
Torque 3D Owner Matthew Langley
Torque
Definately :)
You definately can do so, search for HTTPObject...