[How do i] Setup a simple server or so

Get help using Construct 2

Post » Sat May 04, 2013 6:03 pm

Firstly, i searched and read through many pages of tutorials and posts. But i cant get it all together, my head is almost exploding, safety first, i decided to ask befor anything happens

how do i setup a simple server(best would be with a gui made in c2)
make the client connecting, asking if there exists any rooms,
if yes, connect into it. if not, create one.
And then if start the game, disconnect from the main server and proceed Client-to-Client multiplayer.

i just dont get it with the rooms and everything, that should firstly be done here, if i got done that above im going to proceed with my question, so its not all, yet.
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
9
G
7
Posts: 253
Reputation: 4,831

Post » Sun May 05, 2013 8:45 am

C2 as of this time has no robust networking api. There is also no C2 server technology yet... however there is promising hope down the road....... sometime down the road. However we currently do have

Websocket
Socket.io
these paths will require you to program a server backend. As they are only client communications

Velotjet has(http://www.scirra.com/forum/behavior-multiplayer-online-demo_topic61563_page1.html)
Photon Cloud Behaviour
Multiplayer plugin
These are more robust and include more room options and you can create a game using this providing you know there isn't going to be server side logic. I'm prone to detail errors on this

B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Sun May 05, 2013 10:23 am

thank you, i think i did forget to mention that i decided to use Socket.io but if there better options, let me know ;)
and well, i have no problem with programming a backend server, i just dont know how :/
And like i said, i actually want in the actual game only client to client.
Its going to be hard, i know. Especially if its a multiplayer for a RTS...
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
9
G
7
Posts: 253
Reputation: 4,831

Post » Sun May 05, 2013 10:24 am

@SgtConti
Try my two multiplayer plugins:

1) MultiPlayer (NodeJS server - you need some server-side JavaScript experience if you want to adapt my server code; C2 doesn't extend to server programming).

2) PhotonClient (Photon Cloud server - no server-side programming needed here, but it does mean that you have fewer options for management of your game).
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Sun May 05, 2013 11:38 am

i looked at those, but they dont seem to fit what im planning to do.
I a good tutorial(would be best) on how to do this,
something that describes how i could realize this:
If button pressed: build soldier and send "build enemy Soldier" to Client2
---and:---
If Multiplayerbutton pressed: Connect server, find room(max 2 players) if no room, create room.

Something like that ^^ should be done with socket.io i just dont know how.
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
9
G
7
Posts: 253
Reputation: 4,831

Post » Sun May 05, 2013 6:01 pm

I wouldn't say you cant do what you want, but you will need to be a little more creative. This is for Photon, I couldn't find what you would want with the multiplayer one.

A. Create a Webplayer sprite.

B. This sprite is never actually part of game play. maybe it's a logo in the corner to represent the player face. Maybe it's off screen. Whatever, it's not actually going to be used as a game piece. Also make it global so it does not get reset between layouts.

C. have a Dictionary Object called Message

D. Set all your data values for transmission in your Message.

E. Webplayer.SendTextMessage( Message.toJSON )

on the recieving side

Webplayer.OnReceivedMessage
Message.importJSON( webplayersprite.photonclient.message )
*** cough, reverse the import


also a tip for you Message Dictionary. You Dictionary should have two parts of a structure.

Always include this
Action
Player
Room

follow up with what ever information you need
figure.owner
figure.moveto xy
figure.action

or
text for chat message....

of course you will need to do all message handling yourself. No way to get around that.

umm. as for Rooms. Well there looks to be room(join/leave), but I saw no actions to support it. So you will need to add that to your text message handling.


.
.
.
.
.

Alternatively and very hesitantly. I might part with my photonclient I was toying around with. I do mean toying, as it's not meant for release and never meant to be released.

It already supports Join/Leave rooms, and is a plugin not a behaviour.

Data is packed into a Variadic params that "Function" uses. and is accessed by PhotonClient.Param(#) similar to Function.Param(#).

Based on Event Registration. So your action/command is already expressed with the message.
- On 'GAME' Startup
-- Client.RegisterEvent(#)

-Client OnEvent
-- Client.CompareEvent = #


however, I'm not sure I'm ready to part with it. It's
A. Not done
B. prone to a lot of terrible code(in the js)
C. prone to errors
D. some Events/Actions are 'in', but do nothing
E. possible complete upheavle leaving the high possiblity that you would need to wipe all your photonclient work and re-do it.
F. Requires you to run your own server as it does not use PhotonCloud
G. I may and likely will drop Photon in favour of NodeJS ActionHero or Tycho.
H. I'm not likely to support it out side of a few basic questions.
I. No work done on RoomLists. so there is no way manage room details.


Your probably better of using Velotjet and working around it. While overall the MP is not ideal. It is workable, just a lot of work. I'm sure Velotjet will get the ultimate networking code running sooner or later. We have a lot of network faith in his efforts :)
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Mon May 06, 2013 12:55 pm

Thank you, now i got an idea how it all works.
Im thinking about using Socket.io to send dictionary values.
But it wont work, always if i say send: Dictionary.Get(Spawned)
It say Unkown Expression. Sry for the question but im total noob with Construct 2, before i used to use Cpp.
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
9
G
7
Posts: 253
Reputation: 4,831

Post » Mon May 06, 2013 1:53 pm

You could also do it with PHP, this would be much easier but you need to learn a new language.

You could also hire me to make all this Multiplayer things for you :D

To your problem:
You connected to the Server ?
You need to predefine (is this word right? :D) the key Spawned in your Dictionary. This means in Construct you need to already have this key.Darklinki2013-05-06 13:55:23
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Mon May 06, 2013 10:59 pm

@SgtConti
Could you please explain further:
"If button pressed: build soldier and send "build enemy Soldier" to Client2"

Is that another player that you can control? How would you control its actions as well as your own player's actions? Multiplayer usually means that you're just controlling your own player and its actions are reproduced on another player's display.

@jayderyu
Thanks very much for your support and confidence!
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Mon May 13, 2013 6:26 pm

hello i didnt wrote anything in the last tome, but now its changing:
example explanation:
I press the "Build Soldier" button, it builds a soldier on my screen and sends the data: "Enemy build soldier" to the other client.
Its a RTS. the server should be like, a Multiroom Autojoin server.

I have problems understand the servside scripting, and communication between the clients, sending the "messages".
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
9
G
7
Posts: 253
Reputation: 4,831

Next

Return to How do I....?

Who is online

Users browsing this forum: MarkThomas, signupdemo and 0 guests