shepherdgames's Recent Forum Activity

  • Thanks alot for looking into this.

    It's my error, I should have explained more clearly.

    The peer should be created at (768, 1548) but it is being created at (0,0) and it freezes. It doesn't move like it the host. Peer functions just like the host but for some reason it is not happening in that way.

    Please let me know if you need more detailed explanation.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • dop2000 Will you be able to you help me on this?

    Thanks in advance.

  • Gonna need you to post your file captain

    Oops! Here you go drive.google.com/file/d/1UJIOhRcpdYE-ZVxueC6tSjzjxoSdoWau/view

  • Hi,

    I've been working on a multiplayer game. I followed the instructions in the pong multiplayer that comes with the scirra sample projects. I was able to establish the connection between Host and Peer, and host is displayed on the Peer side but the Peer is being created at (0,0) instead of the defined area.

    Looks like Peer is not able to sync to Host or the host is not updating the sync values properly. I'm not sure where it went wrong. Can you please check the code and help me with it?

    Please check the gameplay for better understanding -

    Subscribe to Construct videos now

    Thanks in advance. Please let me know if you need any further information.

    [Multiplayer]

    ----+ System: GamePlay = "multi"

    --------[Signalling]

    // On start of layout, connect to the signalling server. We also set up which client input values the peers will be using, and sync the Peer object with its position and additional instance variables for the look position, current inputs and player stats.

    ------------+ System: On start of layout

    -------------> Multiplayer: Add client input value tag "x", precision Low (int16, 2 bytes), interpolation None

    -------------> Multiplayer: Add client input value tag "y", precision Low (int16, 2 bytes), interpolation None

    -------------> Multiplayer: Add client input value tag "points", precision Low (int16, 2 bytes), interpolation None

    -------------> Multiplayer: Add client input value tag "player", precision Low (int16, 2 bytes), interpolation None

    -------------> Multiplayer: Sync Creators (with Position only, precision Low (int16, 2 bytes) at Normal bandwidth (unpredictable))

    -------------> Multiplayer: Sync Creators variable Points (precision Low (int16, 2 bytes), interpolation: None, client value tag: "points")

    -------------> Multiplayer: Sync Creators variable Player (precision Low (int16, 2 bytes), interpolation: None, client value tag: "player")

    -------------> Multiplayer: Connect to signalling server "wss://multiplayer.scirra.com"

    // When connected, request to log in.

    ------------+ Multiplayer: On signalling connected

    -------------> Multiplayer: Log in with alias "Sud"

    -------------> TextCoins: Set text to "Connected to server"

    // When logged in, request to join the room. Use auto-join to assign pairs of players in to separate rooms.

    ------------+ Multiplayer: On signalling logged in

    -------------> Multiplayer: Auto-join from room ROOM_NAME for game GAME_NAME instance INSTANCE_NAME (max peers: 2, lock when full)

    -------------> TextCoins: Set text to "Logged in with alias: " & Multiplayer.MyAlias & " (" & Multiplayer.MyID & ")" & newline & "Joining room..."

    // We joined the room: activate either the Host or the Peer group.

    ------------+ Multiplayer: On signalling joined room

    // As the host, we also adopt the existing paddle object on the left of the layout as our own. We must set its peer ID to our own ID and tell the Multiplayer object it is associated with ourselves.

    ----------------+ Multiplayer: Is host

    -----------------> TextCoins: Set text to "Joined Room as Host"

    -----------------> System: Set group "Host" Activated

    -----------------> Creators: Set peerid to Multiplayer.MyID

    -----------------> Multiplayer: Associate Creators with peer Multiplayer.MyID

    // When not the host, the paddle object already in the layout is destroyed. 'Sync object' will create both paddles, and they'll be associated with the correct player using the 'On created' trigger in the 'Peer' group. Also since the game is 2-player, it can begin as soon as the peer joins since we know the host is already there, so update the game state to "getready".

    ----------------+ System: Else

    -----------------> TextCoins: Set text to "Joined Room as Guest"

    -----------------> System: Set group "Peer" Activated

    -----------------> Creators: Destroy

    -----------------> System: Set GameState to "getready"

    ------------+ Multiplayer: On signalling disconnected

    -------------> TextCoins: Set text to "Disconned from Signalling"

    ------------+ Multiplayer: On signalling error

    -------------> TextCoins: Set text to "Signalling Error: " & Multiplayer.ErrorMessage

    ------------+ Multiplayer: On signalling left room

    -------------> TextCoins: Set text to "Partner left the room"

    ------------+ Multiplayer: On kicked

    -------------> TextCoins: Set text to "Kicked (either could not connect to host or host quit)"

    --------[Game]

    ------------[Peer]

    // When a Peer is created from 'Sync object', Multiplayer.PeerID has the ID of the peer that the object represents. This must be stored in an instance variable so we can later identify which peer the object represents.

    ----------------+ Creators: On created

    -----------------> Creators: Set peerid to Multiplayer.PeerID

    -----------------> Multiplayer: Associate Creators with peer Multiplayer.PeerID

    --------------------+ Creators: peerid = 1

    ---------------------> Creators: Set animation frame to 1

    --------------------+ Creators: peerid = 2

    ---------------------> Creators: Set animation frame to 2

    --------------------+ Creators: peerid = 3

    ---------------------> Creators: Set animation frame to 3

    --------------------+ Creators: peerid = 4

    ---------------------> Creators: Set animation frame to 4

    --------------------+ Creators: peerid = 5

    ---------------------> Creators: Set animation frame to 5

    ----------------+ [DISABLED] Creators: peerid = Multiplayer.MyID

    -----------------> [DISABLED] Multiplayer: Enable local input prediction for Creators

    ----------------+ Multiplayer: On client update

    ----------------+ [DISABLED] Creators: peerid = Multiplayer.MyID

    -----------------> Multiplayer: Set client input state "player" to value Creators.Player

    -----------------> Multiplayer: Set client input state "points" to value Creators.Points

    -----------------> Multiplayer: Set client input state "x" to value Creators.X

    -----------------> Multiplayer: Set client input state "y" to value Creators.Y

    // If the host indicates that the game state has changed, update the GameState global variable. The 'Common' group changes the display when this changes.

    ----------------+ Multiplayer: On peer message "gamestate-changed"

    -----------------> System: Set GameState to Multiplayer.Message

    ------------[Host]

    // As the host, when a peer joins we create a new paddle for them on the right. 'Sync object' will cause it to be created for the peer too. We also begin the game: we set the state to "getready" for 3 seconds, then upon "go" we set the ball moving and 1 second later set the state to "started" (so the score appears instead of "GO!").

    ----------------+ Multiplayer: On peer connected

    -----------------> System: Create object Creators on layer "Player" at (LayoutWidth÷2, LayoutHeight - 500)

    -----------------> Creators: Set peerid to Multiplayer.PeerID

    -----------------> Multiplayer: Associate Creators with peer Multiplayer.PeerID

    -----------------> Functions: Call SetGameState (state: "getready")

    -----------------> System: Wait 4 seconds

    -----------------> Functions: Call SetGameState (state: "go")

    -----------------> System: Wait 1 seconds

    -----------------> Functions: Call SetGameState (state: "started")

    ----------------* On function 'SetGameState'

    ----------------* Parameter 'state' (String)

    -----------------> System: Set GameState to state

    -----------------> Multiplayer: Broadcast tag "gamestate-changed" message GameState (from "", mode Reliable ordered)

    // There is only one other peer in the game, and we keep them positioned at the peer's "y" input, which is the Y position of their mouse.

    ----------------+ Creators: peerid ≠ Multiplayer.MyID

    -----------------> Creators: Set X to Multiplayer.PeerState(Creators.peerid, "x")

    -----------------> Creators: Set Y to Multiplayer.PeerState(Creators.peerid, "y")

    -----------------> Creators: Set Points to Multiplayer.PeerState(Creators.peerid, "points")

    -----------------> Creators: Set Player to Multiplayer.PeerState(Creators.peerid, "player")

    -----------------> TextCoins: Set text to Multiplayer.PeerState(Creators.peerid, "x") & " " & Multiplayer.PeerState(Creators.peerid, "y")

    ----------------+ Touch: On any touch start

    -----------------> System: Create object IconFingerPrint on layer "Player" at (Touch.X, Touch.Y)

    -----------------> IconFingerPrint: Set Sine Disabled

    -----------------> System: Create object IconDeflector on layer "Player" at (Touch.X, Touch.Y)

    -----------------> IconFingerPrint: Set size to (358, 512)

    -----------------> IconFingerPrint: Set opacity to 100

    ----------------+ Touch: On any touch end

    -----------------> IconFingerPrint: Destroy

    -----------------> IconDeflector: Destroy

    ----------------+ Creators: On collision with IconDeflector

    --------------------+ Creators: peerid = Multiplayer.HostID

    ---------------------> Creators: Add 1 to Points

    ---------------------> System: Add 20 to BallSpeed

    ---------------------> Creators: Set Bullet speed to BallSpeed

    --------------------+ Creators: [X] peerid = Multiplayer.HostID

    ---------------------> Creators: Add 1 to Points

    ---------------------> System: Add 20 to BallSpeed

    ---------------------> Creators: Set Bullet speed to BallSpeed

    --------[Common]

    ------------+ System: GameState = "getready"

    ----------------+ System: Game = "No"

    --------------------+ System: Every 1 seconds

    --------------------+ System: Score > 0

    ---------------------> System: Set Score to Score - 1

    ---------------------> TextDynamic: Set text to Score

    --------------------+ System: Score ≤ 1

    ------------------------+ System: Every tick

    ----------------------------+ Creators: peerid = Multiplayer.HostID

    -----------------------------> Creators: Set position to (lerp(Creators.X, 768, 0.1), lerp(Creators.Y, 924, 0.1))

    ----------------------------+ Creators: peerid ≠ Multiplayer.HostID

    -----------------------------> Creators: Set position to (lerp(Creators.X, 768, 0.1), lerp(Creators.Y, 1124, 0.1))

    ----------------------------+ Creators: Height ≥ 300

    ----------------------------+ Creators: Width ≥ 300

    -----------------------------> Creators: Set size to (Creators.Width - 15, Creators.Height - 15)

    --------------------+ System: Score = 0

    ---------------------> System: Set Game to "Yes"

    ---------------------> System: Set BallSpeed to 100

    ---------------------> System: Wait 1.0 seconds

    ---------------------> Creators: Set Bullet Enabled

    ---------------------> Creators: Set Bullet bounce off solids True

    ---------------------> Creators: Set Bullet speed to BallSpeed

    ---------------------> Creators: Set Bullet angle of motion to random(360) degrees

    ------------+ System: GameState = "go"

    -------------> [DISABLED] Creators: Set Bullet Enabled

    -------------> [DISABLED] Creators: Set Bullet bounce off solids True

    -------------> [DISABLED] Creators: Set Bullet speed to BallSpeed

    -------------> [DISABLED] Creators: Set Bullet angle of motion to random(360) degrees

    ------------+ System: GameState = "started"

    ----------------+ Creators: peerid = Multiplayer.HostID

    -----------------> TextDynamic: Set text to Creators.Points

    ----------------+ Creators: [X] peerid = Multiplayer.HostID

    -----------------> TextDynamic: Set text to Creators.Points

    Tagged:

  • Kyatric Thanks for the tip.

    I will see whether there is way to do it.

  • these json are for Adobe after effects.

    you can try this library but it uses svg not canvas.

    https://github.com/icons8/titanic

    Oh I see. Thank you for your response.

    Any tips on how to use them?

  • Hi,

    Thanks for looking into this.

    I found a bunch of app icons in .JSON format. I would like to load them in my app.

    Can anyone help me with this?

    Tagged:

  • Hi,

    I need to set the text of a list by a value from an array.

    The list and array has values of {a1,a2,a3}. When I compare text with a1 in Array and returns True then the list show select value as a1.

    I'm able to get text from a given index but how do I get index from a given text?

    Tagged:

  • dop2000 I found issue. It is working now. Thanks alot.

  • dop2000 Thanks for the C3P, it works fine on it. I have implemented the same on my project but still it doesn't work.

    Subscribe to Construct videos now

    Not sure where I'm going wrong. :/

shepherdgames's avatar

shepherdgames

Member since 3 Feb, 2015

Twitter
shepherdgames has 18 followers

Connect with shepherdgames

Trophy Case

  • 10-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • x6
    Popular Game One of your games has over 1,000 players
  • x8
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

19/44
How to earn trophies