Tris Demo - How to Enlarge Board?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

TipOfTheDay
Posts: 2
Joined: 01 Jul 2020, 13:47

Tris Demo - How to Enlarge Board?

Postby TipOfTheDay » 01 Jul 2020, 13:55

Hi folks!

I'm new to coding multiplayer games and SmartFox is my first attempt at getting my head around it all.

I'm playing with the Tris (tic tac toe) demo and wondering how to make the board much bigger than 3x3? Looking through the code, I can physically enlarge the board by editing ResetGameBoard and EnableBaord in TrisGame.cs and adding tiles in the Unity editor space. But the logic seems to fail after this? It will display my move but won't update the opponent or switch turns for them.

I believe that's because TileController.cs controls this? I've jumped into that script and believe the line I need to edit to allow the logic to review more tiles is line 43:

gameInstance.PlayerMoveMade(int.Parse(this.transform.name.Substring(4, 1)), int.Parse(this.transform.name.Substring(5, 1)));

But as I mess around with those transform values (4, 1) and (5, 1) - the game just seems to break? I can't logically figure out how this transform function relates to the gameboard layout?

So for example, I've tried to make a 4x4 board and switched those transform values to (5, 1) and (6, 1) respectively, just to try. But when I run, I get "out of range" errors in the console.

At this point I'm just guessing guys and couldn't find any documentation about that specific detail so. . . . any help/guidance/advice would be greatly appreciated! Thanks!
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Tris Demo - How to Enlarge Board?

Postby Lapo » 01 Jul 2020, 14:50

Hi,
I would highly recommend to follow the relative tutorial from our docs website:
http://docs2x.smartfoxserver.com/ExamplesUnity/tris

The actual game logic is implemented server side, which is where it is decided the final outcome of the game (win/loose/tie)
If you want to enlarge the board you will also need to adapt the server side code to reflect the new board.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
TipOfTheDay
Posts: 2
Joined: 01 Jul 2020, 13:47

Re: Tris Demo - How to Enlarge Board?

Postby TipOfTheDay » 01 Jul 2020, 15:34

That makes perfect sense. Thanks so much for the guidance!

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Alexwek and 98 guests