Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: shadowspark on February 29, 2012, 06:24:14 PM

Title: Playmaker 1.3.2 - Network Sample problems
Post by: shadowspark on February 29, 2012, 06:24:14 PM
I've gone ahead and gotten unity after seeing so much praise for it,
but I'm getting problems just trying my very first sample scene, that I need to be able to understand for my project.

Network Sample #4 - SpawnPlayers
When I start a new client, it seems to almost respawn all the players at the central position before moving the ones that already exist to the same relative position as the other client/server screens display.
The problem is, the new player who doesn't have an actual position in the world yet, get's shot off from the impact of being squashed with the other 2 players.
So you end up with something like this (the red arrow is pointing to the new player)
http://i.imgur.com/WqsIv.png
And then the players slowly get into their proper positions
http://i.imgur.com/dMDa7.png
Also, if you disconnect/reconnect multiple times, when connecting it will think there is still a player
for each time you had connected, and so you will continue to have more players spawned at the center
which are then pushed out.
http://i.imgur.com/YPIzA.png
And after that, only one managed to get back to it's position as it is displayed on the other screens.
http://i.imgur.com/xYgPN.png

That's....really terrible.
Is this just how the demo was built, are we meant to try and workout how to fix it?
I've run other demo's and the characters were seamlessly in their respective positions in every window,
however this is how they look across each screen in comparison to eachother.
http://i.imgur.com/dMDa7.png
http://i.imgur.com/1JNaU.png
http://i.imgur.com/jOgVt.png

Is this a matter of settings somewhere? Is this something that will improve when you integrate photon support? What should I be doing until then when I can't even test 3 players at once? And would learning how this sample works, be learning something incorrect because of it's apparently poor setup?
Would just like to know, what's going on, what's wrong, and is there a fix, what is at fault?
Title: Re: Playmaker 1.3.2 - Network Sample problems
Post by: jeanfabre on February 29, 2012, 10:32:19 PM
Hi,

In this particular sample, yes the spawn point could win being higher up:

 select "PlayerSpawn" and move it so that it's y position is 2.5 or something, then spawning will never cause problems anymore.

--regards the persistence of players when they are actually disconnected, there seems to be indeed an issue. I can recall having struggled with it when I started networking, I'll investigate hopefully today, but basically, the way out of this is to respond to the PLAYER DISCONNECTED event, get the guid of the player and destroy that player.

More on this soon.

Regards

Jean
Title: Re: Playmaker 1.3.2 - Network Sample problems
Post by: shadowspark on March 03, 2012, 08:06:29 PM
It's still occurring, the only difference is they are all now colliding in the air.
Really it's a shame this hasn't been debugged D:
Hard working with a sample as reference when it doesn't work x.x;

It looks like on connect, it's moving every player to the spawn point, rather than just the new one.
Do you have any idea how to filter that? So changing the spawn point position won't make any change.


The guid is the term for it's specific object ID?
Title: Re: Playmaker 1.3.2 - Network Sample problems
Post by: Alex Chouls on March 03, 2012, 10:47:49 PM
Sorry about the state of that sample - as soon as 3.5 came out we had to release 1.3 so Playmaker users could upgrade, so some things are still a little rough around the edges. That sample wasn't actually meant to show how to pick a spawn point... but I know that doesn't matter when that's what you're trying to do :)

Picking a spawn point is a non-trivial problem, and spawning is often a little clunky in multiplayer games with players intersecting each other. The problem is highlighted in that sample since the cubes use rigid bodies with free physics (so they go flying). Try spawning player objects that use Character Controllers instead - they should push each other apart more gracefully! You can find examples of Playmaker Character Controllers in TestLab/Character and TestLab/Input.

Other things you can try: Pick a random spawn point (see the spawning samples in TestLab), add a random offset, disqualify a spawn point after it's used (permanently or with a reset timeout), try to detect if a spawn point is occupied... I'm sure there are other strategies...

I would try: Character Controllers instead of rigid bodies, and pick a random spawn point. But the best strategy will also depend on the game.

Also remember that many Playmaker actions are a fairly direct translation of the Unity API, so many standard Unity techniques and tutorials are applicable here.

Thanks for hammering on the samples and the network implementation - it helps us make them better! Don't worry we'll get there!
Title: Re: Playmaker 1.3.2 - Network Sample problems
Post by: shadowspark on March 05, 2012, 12:09:07 AM
Ahhh, well I'm glad to hear there's a bit more back story to it's current state.
However it's not that I was really trying to discover how to set a spawn point, rather I was
trying to deal with the issue I was explaining where every character in the scene moved to
said spawn point when a new player logged in.
And off course additionally the problem where characters that logged out were still considered
in-game by the other clients and the server.

Hopefully I can just start developing the gameplay, practice setting up a server and then maybe things
will function a bit more naturally with photon as I'm wishing to create an MMO, so regarding spawnpoints
I'd like to be able to have character creation/saving of location data and the likes which most likely
won't be something to test until you've been able to get that working.
Title: Re: Playmaker 1.3.2 - Network Sample problems
Post by: jeanfabre on March 15, 2012, 05:55:20 AM
Ok,

 good news, after some real struggle, I finally found the source of the problem.

 It is not so much a problem of instanciation, rather the issue comes from not properly disconnecting players in the various scenario possible. This coupled with an issue in the NetworkDestroy action that failed to provided the desired result ( was destroying the viewID, not the player which seems to make a difference, also I now make a different call and call DestroyALLObjects() which is actually what we want).

 So between all this, the problem was  when disconnecting reconnecting, phantom players would still haunt the server and spawn at the same point, and explode because totally collided!

 Now, with the proper behavior, when you connect, existing players WILL be directly put at the current location, which is never or rarely the spawning point. The only clash that will still happen is in a real world implementation, where several player could connect around the same time, fast enough to spawn as other players keep falling, but that is already another issue ( solved with various systems, like for example a trigger volume around the spawning point, that when spawed players are still in contact with the spawning collider, will move the spawning transform higher), nothing difficult from then on.

 Please find the NetworkDestroy action corrected and the player prefab used in the samples ( Fsm has changed a bit too), so you can replace and test on your ends, and progress.

don't hesitate to report if you still experience issues.

Bye,

 Jean
Title: Re: Playmaker 1.3.2 - Network Sample problems
Post by: getluky on December 17, 2012, 12:17:08 PM
Just wanted to bump this thread to remind you to update the network example with this change. I just encountered the same problem and it seems this fix didn't make it into the current (1.4.5) release. :)