Page 1 of 2
My first Hollywood based network game
Posted: Sat Mar 03, 2012 6:33 pm
by jalih
Hi all,
Since nobody volunteered to write the first Hollywood based network game and release the sources...
I still need to write a proper user interface for the game before releasing it. Networking part and game logic section is allready working fine. Special thanks goes to Bugala for sponsoring me the Hollywood 5 update!
Connected to and playing against my Inferno based server program
Re: My first Hollywood based network game
Posted: Sun Mar 04, 2012 1:32 am
by xabierpayet
can you put some source code?
i´m sure that will be very useful why the network chapter in the hollywood guide is not very well explained, lack of examples.
Re: My first Hollywood based network game
Posted: Sun Mar 04, 2012 10:53 pm
by jalih
xabierpayet wrote:can you put some source code?.
I will post the sources soon, when it's finished...
This game is quite simple to make, really:
Game board is stored in a two dimensional table. We make the table internally a little bit bigger than the real game board because we want to add extra border around the board edges. This is done, so we can save some comparisons when checking the winning position. There is no need to check if we are at the edge of the board. Extra border around the board will always terminate a search anyway.
Local player input is simply handled by building the game board grid as buttons and using event handler for handling the button presses. We simply use SendData() function to send the move as a line of text consisting button id to remote player. Remote player input is handled by using event handler for "OnReceiveData" event.
Synchronizing game turns is also simple. We use variable, which can have two states: 1 and -1. This variable is often called lambda and can have some clever uses. For an example we can use the same procedure for testing our own pieces and enemy's pieces in a game. If player1 plays on positive lambda with positive pieces and player2 plays on negative lambda with negative pieces, we can multiply value of the piece on board with lambda and result is always positive if the piece is owned by player whose turn it is.
Re: My first Hollywood based network game
Posted: Mon Mar 05, 2012 12:22 am
by xabierpayet
nice example, i will try it in my strategus game xD
Re: My first Hollywood based network game
Posted: Wed Mar 07, 2012 6:50 am
by jalih
Almost finished...
Now game server and client are both Hollywood based and working nicely. Just need to draw better user interface and add some status texts, like turn indicators and connection status for an example.
Current status of the Hollywood Tic-Tac-Toe
Re: My first Hollywood based network game
Posted: Wed Mar 07, 2012 7:25 am
by tolkien
Perfect explaining. Thanks you! We need more!
Re: My first Hollywood based network game
Posted: Wed Mar 07, 2012 2:49 pm
by jalih
I will try to add missing functionality later today and post the sources...
Meanwhile you can test
these AmigaOS4 binaries and check, if you can break the networking stuff.
Note: uses port 2000 for networking.
Re: My first Hollywood based network game
Posted: Wed Mar 07, 2012 9:51 pm
by jalih
Sources available
here
Written in a hurry... Code could use some comments, more structuring and procedures. I hope it helps someone...

Re: My first Hollywood based network game
Posted: Thu Mar 08, 2012 12:13 pm
by xabierpayet
hello jalih, i have a timeout error ever when i try to connect with the client to the server, i need put an special hostname or else?
Re: My first Hollywood based network game
Posted: Thu Mar 08, 2012 12:15 pm
by jalih
jalih wrote:Sources available
here
There is a small typo error in Client:
On button_handler(), change:
Code: Select all
Repeat
Local str$, ok = StringRequest("Connect to host", "Enter hostname:")
If StrLen(str$) <> 0 Then Break
If ok = False Then Return
Forever
To:
Code: Select all
Local str$, ok
Repeat
str$, ok = StringRequest("Connect to host", "Enter hostname:")
If StrLen(str$) <> 0 Then Break
If ok = False Then Return
Forever
I just noticed... Seems like Hollywood defaults to local host if address is Nil.
I will fix sources later today and will probably add double buffering as well.