|
-
Jul 28th, 2008, 09:32 AM
#1
Thread Starter
Junior Member
MultiPlayer Card Game (Winsock)
At long last, im finally going for my first online game. The actual card game is 100% finished and has been made so all values for each player can be accessed with minimal effort.
The card game is a clone of "Castle Wars", which i chose because its so simple.
If your not familiar with this game check out
http://www.newgrounds.com/portal/view/379417
For you guys from the future who might get a broken link and are still coding in VB 6.0. 
--------------------------------------------------------------------------
Its a turn based game which means each player play's 1 card at a time back and forth. There are always 8 face-up cards on the table that you may choose from, and when a card is played that card is simply replaced by the next card in the deck. However, should you not be able to afford any card then your forced to discard 1 of the 8 cards on the table. (Discarding can be used at any time though)
"Materials" are used to pay to use cards, and a production value for each material that defines how much of that material is produced each turn.
Builders produces Bricks
Soldiers produces Weapons
Magic produces Crystals
Although, only when both players have played their cards will the material income be collected for both players.
There are 30 different cards split into 3 different types
10 Red Cards, cost's Bricks to play and focuses mainly on Defense (e.g. increasing castle size)
10 Green Cards, cost's Weapons to play and focuses on Attacking your enemy castle
10 Blue Cards, cost's crystals to play and the majority focuses on reducing your enemy Materials making him unable to play expensive cards
There are also cards that increase your production value to increase your material income.
The objective of the game is to either get your castle up to 100 or get your enemy castle to 0, in other words destroy it.
--------------------------------------------------------------------------
Obviously, Winsock should be more then enough for this job. I've managed to get a chat program working so i know the basics of sending / receiving data. I'm thinking about making a direct connection where one player is host and another tries to connect since i dont have a server.
Although, could someone perhaps explain a little about a direct connection and / or through a Server. Also, i know there are ways to keep the game in sync which im clueless about how to do.
-
Aug 1st, 2008, 03:30 AM
#2
Hyperactive Member
Re: MultiPlayer Card Game (Winsock)
I too know only the basics of sending an receiving data and I too have written a chat client. I suggest Peer to Peer connections, that way no computer acts as a server and each client manages their own state. The only problem with Peer to Peer is that it can get quite slow when there are more than about 4 players since each player has to send to every other player. I don't think performance is a problem in your situation (Turn based card game).
-
Aug 2nd, 2008, 06:45 PM
#3
Thread Starter
Junior Member
Re: MultiPlayer Card Game (Winsock)
Thanks for the reply, just for clarification my game will only handle 2 players per game. I've been grinding brain-cells trying to come up with different scenarios of how to send/receive data in both cases (Peer to Peer / Server <-> Client).
As i see it on Peer to Peer it seems quite unavoidable to not send all the player stats back and forth each player turn. In my case it would be sending the 8 visible values (builders, bricks, soldiers, weapons, magic, crystals, castle, fence) and the card that was played and perhaps a boolean that keeps track of whose turn it is.
Actually as im writing this i just realized, the basic idea of Server <-> Clients is obviously that you only want the server to send data because that is the core and the quickest sender/receiver. So basically we need the game inside the server and the clients shouldn't really handle more then graphics and visible data incoming from the server. All the clients need to send should only be what card was played and perhaps something to tell the server that the client has made its move so it can fire the next player. It can't be more complicated then that, theoretically anyway. Am i on the right track?
Peer to Peer:
If i were to add a chat system whilst the game is running i guess i would have to send the data in parallel. What pops up in my head is making two subs, where one handles the actual game values and the other sends a string, and perhaps use a unique identifier e.g * or / to then pass it on to proper location. Although can winsock handle this if both get sent really close?
Last edited by Tr4iNe3r; Aug 2nd, 2008 at 07:55 PM.
-
Aug 4th, 2008, 03:33 AM
#4
Hyperactive Member
Re: MultiPlayer Card Game (Winsock)
Yes, you ideally want to put as much work to the server as possible so that the game is more consistant and hacker proof. If you were to write a real-time game then for perfomance reasons you would need the client to do some predictions. The idea of a peer to peer chat system is good in my opinion but I will remind you again that I am no expert in fact I am quoting what I learned at university.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|