Chess Example

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

Swonson
Posts: 8
Joined: 15 Nov 2016, 07:30

Chess Example

Postby Swonson » 15 Nov 2016, 07:38

Hey Guys,

I'm new on Sfs and I'm trying to realize a multiplayer chess. For learning purposes.

I have the random matchmaking done and ask me, how can I create a synchrone chessboard, where both player can fight against each other. Of course if habe the graphic. Unfortunately I have no idea how to synchronize the player turns.

It's just a 2D game. Can anybody help me with an example or a link to the correct documentation entry?

Thanks and have a nice day!

Best regards swonson
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Chess Example

Postby Lapo » 15 Nov 2016, 08:01

Hi,
you can take a look at our "Tris" game example, which is a turn based game of tic tac toe. The rules are way simpler than those of chess but the mechanism for synchronizing the player's turn is the same.

The example is available in a variety of languages and platforms: Unity, Flash, iOS, Android etc...

For instance this is the tutorial for Unity:
http://docs2x.smartfoxserver.com/ExamplesUnity/tris

You can download the sources of this game example from our "Examples" section:
http://smartfoxserver.com/download/sfs2x#p=examples

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Swonson
Posts: 8
Joined: 15 Nov 2016, 07:30

Re: Chess Example

Postby Swonson » 15 Nov 2016, 14:43

Hey lapo,

Thanks a lot.
This helps me.

One addition question. I want to realize a real-time mode. Where the chess game is not Turnbased.

Both player should be able to make there turn in realtime while the other player can turn to. How would I realize a real-time Synchronisation?

Have a nice day and many thanks for support!

Best regard
Swonson
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Chess Example

Postby Lapo » 15 Nov 2016, 15:57

I am not sure I understand.
Chess is definitely a turn-based game, in the sense that players must alternate moving the chess pieces, they can't decide to make a move when it's not their turn.

So I am a little confused as to what you mean by "realtime". Real time games are those like Call of Duty or Need for speed, for example, where players race or shoot against each other and the interaction is not restricted by turns.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Swonson
Posts: 8
Joined: 15 Nov 2016, 07:30

Re: Chess Example

Postby Swonson » 15 Nov 2016, 16:59

Hey,

Thanks for your answer.

You are definitely right. The chess game is just a learning project. So it doesn't matter on what kind of game I try to learn synchron 2D actions.

Of course it doesn't make sense to create a realtime chess. My question is: how can I synchronize a 2D realtime game with Sfs.

Sorry my example with the chess was really confusing.
I hope you understand me.
If not, feel free to ask. I will try to explane my thoughts better.

Have a nice evening.

Regards swonson.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Chess Example

Postby Lapo » 15 Nov 2016, 17:57

Ok, I got confused by the chess reference :)
So, if you want to learn how to synchronize realtime games in 2D I would recommend two different projects that we provide as examples with source code and that demonstrate exactly what you're looking for.

Battle Farm: a tile based action realtime game
http://docs2x.smartfoxserver.com/Exampl ... battlefarm

SpaceWar: a mutliplayer rendition of the classic arcade shooter game
http://docs2x.smartfoxserver.com/Exampl ... pacewar-p1

They both come with fully detailed tutorials and you can download them from the Examples section:
http://smartfoxserver.com/download/sfs2x#p=examples

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Swonson
Posts: 8
Joined: 15 Nov 2016, 07:30

Re: Chess Example

Postby Swonson » 16 Nov 2016, 16:23

Hey Lapo,

Thanks a lot for the awesome help.
It's exactly what I have looking for!
Have a nice evening.

King regards
Swonson

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 30 guests