[project1dev] Re: networking pirate dice woes

  • From: Kent Petersen <kentkmp@xxxxxxxxx>
  • To: project1dev@xxxxxxxxxxxxx
  • Date: Mon, 22 Feb 2010 08:11:46 -0800

Ok, so ultimately, I want to add networking to pirate dice.

First, should I try getting a networking script working on its own? At first
I was just trying to add the code to pirate dice. Pirate Dice's code can get
a little confusing especially when it comes to the starting initization code
(because it does it 2x!?). So this whole thing got really confusing really

Then, I was trying to make something simple like you log on and it tells
you, you log on but I just couldn't piece together the info. I guess a
little step by step guide would be more helpful? Like you need to login,
create a game server, connect to the server, send message, receive message
(even if its just a variable) but when it comes to coding it I keep getting

I think... I'm still just confused

On Sun, Feb 21, 2010 at 9:58 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote:

> well hrm, what kind of problems are you having? i might be able to help you
> out by explaining better
> On Sun, Feb 21, 2010 at 9:42 PM, Kent Petersen <kentkmp@xxxxxxxxx> wrote:
>> I still seem to be having a problem trying to figure out how to use the
>> commands. Can you possibly make a different kind of network script that I
>> can also use for reference?
>> On Sat, Feb 13, 2010 at 2:35 PM, Kent Petersen <kentkmp@xxxxxxxxx> wrote:
>>> I think that helps. I will take another stab at it next chance I get.
>>> You are welcome to take and delegate tasks that are needed. If something
>>> becomes urgent scripting-wise let me know.
>>> I did see the commands in the scripting help but I did not find the
>>> documents very helpful. They explained the variables and values but I
>>> couldn't really figure out how to use the commands.
>>> On Sat, Feb 13, 2010 at 9:34 AM, Alan Wolfe <alan.wolfe@xxxxxxxxx>wrote:
>>>> Hey Kent,
>>>> Totally understandable about your shift in time usage.  I figure i'll
>>>> take on some of the scripting tasks but leave the important stuff like
>>>> networked pirate dice to you.
>>>> If anything becomes uber important and you dont have time to do it, i
>>>> have no problem takin it over so we should be fine (:
>>>> Ok, about the network stuff hrmms...
>>>> #1 - GetServerList: well first things first, i added the network script
>>>> functions to the script help documents.  Have you seen those?  If so were
>>>> they not too helpful?  If not let me know, maybe i need to document things
>>>> better.
>>>> Anyhow, GetServerList is only useful for searching for existing servers.
>>>>  Theres another function for creating servers but you are right, you would
>>>> change the string to PirateDice and thats all you need to do to make it 
>>>> work
>>>> for pirate dice.
>>>> #2 - SendChat: yeah this is the only place it sends to the server.  For
>>>> the success thing, basically what thats about is every network function
>>>> returns whether or not it was successful.  If it wasn't, you should display
>>>> an error message to the player and then bail out of the game.  The reasons
>>>> it wouldnt be successful is like if they unplugged their internet cable or
>>>> something.
>>>> #3 - OnNetworkMessage: This guy is called by the game whenever it
>>>> receives a network message from the server.  How network messages work is
>>>> you send a message to the server which consists of "MessageName" and
>>>> "MessageValue".  After it gets to the server, the server sends it down to
>>>> all of the clients, including the person who sent the message in the first
>>>> place.  OnNetworkMessage is called once for each message received so that
>>>> you can respond to the message (like if someone raised a bet, you can 
>>>> update
>>>> the pot size).  Everyone receives messages in the same order (:
>>>> Since messages have both a name and a value you can do something like
>>>> all chat messages have the message name "Chat" and all message values are
>>>> what the person typed for chat.
>>>>  For when anyone takes a turn you might make a message named "TakeTurn"
>>>> and then have the message value be something like "call", "fold", "raise 
>>>> 10"
>>>> etc.
>>>> OnNetworkMessage also receives messages when players join or leave.
>>>> Also each network message (i think... going from memory) give you both
>>>> the name of the player, as well as a "PlayerID" which is a unique ID#
>>>> associated with that player (if its ever useful to know, this ID# is always
>>>> the same for the same player, it's like an account number).
>>>> Does this help at all?
>>>> On Sat, Feb 13, 2010 at 2:05 AM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>>>> Tonight is the first time I really spent any time on the network code
>>>>> and let me tell you I am confused as hell. If I follow along the lobby 
>>>>> code
>>>>> I can make enough sense of it but when it comes time for me to recreate 
>>>>> it I
>>>>> can't get shit to work right. I can get it to log in to a server by 
>>>>> copying
>>>>> the "Join chat server" section of the lobby code but I don't really
>>>>> understand what to do from there.
>>>>> Here are some questions off the top of my head
>>>>> in the "Join chat server" section I think I would want to change
>>>>> GameServer_GetServerList("Chat") to GameServer_GetServerList("Pirate 
>>>>> Dice")
>>>>> I think this would cause the game to join the game server Pirate Dice.
>>>>> Am I right?
>>>>> is the function SendChat the only point in the code where the player
>>>>> can send information to the server? I don't really get the success= part?
>>>>> I also don't really understand the OnNetworkMessage part. I think it
>>>>> has something to do with sending messages to the server and out to the
>>>>> players but I don't see how it does it. I understand that the bottom 
>>>>> portion
>>>>> of OnNetworkMessage is updating the chatroom. Pirate Dice should probably
>>>>> have an in game chat.
>>>>> I want to start Pirate Dice. Have a button for join network game. This
>>>>> will look through for a list of servers and then create one if there is
>>>>> nothing available. Like the lobby, I believe. Pirate Dice will then begin 
>>>>> as
>>>>> it does now.
>>>>> Somehow I want the players name and ID to be assigned to the player
>>>>> value. For example Player1 will say Atrix.
>>>>> Somehow I want the players game choices to get sent to the server and
>>>>> back to the players. The information that should be sent would, the choice
>>>>> they made (raise, bluff, call), what they have in their hand (pair, three 
>>>>> of
>>>>> a kind), and any money information (amount raised, raising to the called
>>>>> amount)
>>>>> Between work and school I just don't have a lot of time to invest right
>>>>> now. So this is mostly for discussion and to get my brain thinking. I love
>>>>> working on this stuff I do it for fun and relaxation these days. I might 
>>>>> be
>>>>> able to squeeze some time in on the weekends or if I finally get ahead on
>>>>> homework. The workload will definitely drop as I get the hang of my job 
>>>>> and
>>>>> as I finish off my internet classes.
>>>>> Any help is greatly appreciated.

Other related posts: