CREATOR4's Forum Posts

  • I usually use a tiled background

    Every tick:

    1. Set the angle to the player

    2. Set the height to the distance between the origin and the player

  • As far as anxiety goes, try Trello for planning your game out :)

    C3 isn't free

  • Create an invisible Sprite called "Camera". Give it the ScrollTo Behavior

    Give the camera an instance variable called "FollowUID"

    Create a family for objects you might want to follow called "Followable"

    Every tick Pick By UID the Followable object you want using the camera's FollowUID variable. Set the camera's position to that object

    This is nice because you don't have to give the ScrollTo behavior to every object you want to follow. Also, you can do effects with the camera like a smooth follow behind the character. Also, you can sometimes have the camera move independently of the character or stand still. This method gives you a lot of control

  • As a C3 Multiplayer Plugin user this is exciting to me

  • When the host first sync it's basically sending a list of objects to the Peer to create

    -Hull

    -Turret

    The peer receives this list and makes a hull and a turret. The hull makes a companion turret for itself (since they're in a container), and the turret makes a companion hull for itself (same reason). This is why there are duplicates

    To fix this you'll need to remove the container and do things manually

  • Thanks! Is there any way to have it grab the x from the right side of an object and not the top left?

    if the origin is top left you can do

    x = object.x + object.width

  • Thanks for the encouragement :). Are you telling me those things are what I need to to or were you going to attach a file? And also I have looked at the multiplayer tutorial before, but I'll read it again. It will probably make more sense now.

    Sorry, I forgot the file! dropbox.com/s/43p9izjae8iczvn/WardensFixed042720.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're not hopeless, multiplayer is just tricky

    The multiplayer code was actually fine, it ended up being a layer issue. I opened the debugger and saw that the peer did in fact have enemies spawning, but the enemies were invisible. The debugger said they were 100 opacity and Visible though, so I checked their layers and they were on the Collision layer while the Host's enemies were on the Object layer. I just added "Move Enemies to "Object" Layer" under common and it fixed

    I made 2 other changes:

    1. Made it quicker to login (so you can test faster)

    2. Moved your enemy spawn logic from under "Waves" group to under "Host" group

    I don't know if you read the multiplayer tutorial in full but I would recommend going through it. Multiplayer can be very complicated. It's good to know the core concepts like the difference between the Host and Peer: construct.net/en/tutorials/multiplayer-tutorial-1-concepts-579

  • How can I set the bits for my peer only?

    You can pick your peer using Peer.Peerid = Multiplayer.MyPeerID

    What code exactly should be put into the host group?

    Anything that controls serious elements of the gameplay. The creation and destruction of enemies, collision detection for inflicting damage, etc

    The host should be running the only "real" version of the game. The host should be moving the enemies, deciding when they've collided with peers, damaging them, destroying them, etc. The peer does not control any of this and must only receive information from the host describing what is happening

  • But if the host attacks two at once, only one will get knocked back and take damage, and the other one will become invincible.

    This one is easy and isn't a multiplayer quirk! When the host overlaps two enemies, your Enemy_Hurt function is only running for one of the instances. This is because functions called on picked instances will only be called for ONE of the picked instances. If you want to have a function run for each picked instance you need to add a For Each before you run the function

    The reason the not-damaged enemy becomes invincible is because every action BEFORE the function IS able to run on all picked instances, meaning the enemy's Hurt variable is being set to 1, but he's not running the Enemy_hurt function, and so his Hurt never returns to 0

    The peer cannot do any damage, probably because he or the enemies are not synced right.

    In your code you have it so when the Peer is overlapping an enemy AND the peer's input 4th bit is set to 1, the peer will damage the enemy. The problem is with the 4th bit never being set to 1 by non-host peers. Here's where the problem is in your code:

    + Touch: On tap gesture on Attack_Button

    ----+ System: getbit(Peer.inputs, 4) = 0

    -----> Peer: Set Inputs to setbit(Self.inputs, 4, 1)

    You're not specifying that the peer should be checking and setting the bits for THEIR peer. Since you don't specify, the code is probably picking the first instance, which is the host's peer object. This is why it works for the host, because they are accidentally picking their own peer

    Also, most of your enemy code should be in the Host group. You don't want peers running logic for the enemies because things can happen differently on the Host's computer and the Peer's computer, resulting in mismatches game states and weird glitches. The peers should only be TOLD what is happening by the host (using the object syncing and via messages)

    For the enemies, they will hop towards the crystal stand unless they get attacked. Then they are supposed to attack the last peer that hit them. For some reason they will not attack the peers; they will not move at all after being struck.

    This is another problem that is not multiplayer-specific but is just how C3 works. Here's the code where the problem is:

    + Enemies: Hurt = 0

    ----+ Enemies: Last_Hit_PeerID = ""

    -----> Enemies: Set 8Direction vector X to cos(angle(Self.X,Self.Y,Crystal.X,Crystal.Y)) × Self.8Direction.Maxspeed

    -----> Enemies: Set 8Direction vector Y to sin(angle(Self.X,Self.Y,Crystal.X,Crystal.Y)) × Self.8Direction.Maxspeed

    ----+ System: Else

    ----+ Peer: PeerID = Enemies.Last_Hit_PeerID

    -----> Enemies: Set 8Direction vector X to cos(angle(Self.X,Self.Y,Peer.X,Peer.Y)) × Self.8Direction.Maxspeed

    -----> Enemies: Set 8Direction vector Y to sin(angle(Self.X,Self.Y,Peer.X,Peer.Y)) × Self.8Direction.Maxspeed

    I'll translate what is happening

    Pick ALL enemies where Hurt = 0

    From those enemies, go through them all and check which ones have a Last_Hit_By_Peerid variable that is set to ""

    For THOSE enemies, run movement logic

    NOW we skip past the 'else' because the first condition was met. There were enemies that had a Last_Hit_By_Peerid variable that is set to "", so the condition was true and the 'else' is skipped. You probably expected your code to treat all the enemies with an empty variable one way and all the other enemies another way. What actually happened is if there are ANY enemies who match the first condition, the second is skipped entirely

    To fix this you have some options

    1. Remove the else (This will go through your group of Hurt = 0 Enemies twice. Once to check for enemies with an empty Last Hit By variable and another time to check for enemies WITH a valid Last Hit By Variable)

    2. Add a For Each after Enemies: Hurt = 0 (This will run through each Enemy seperately, one at a time, and you can leave the else)

    These options may have different impacts on performance, which you can test for yourself

    Hope this helps :)

  • I'm not sure if that would work. Wait 0 seconds usually doesn't play well with repeat

    It may be safer to use Pick Last Created Hash before adding the hash.width to position

  • If you're using tilemaps, try this method

    taken from this thread: construct.net/en/forum/construct-3/general-discussion-7/whats-preferred-method-149506

  • Try this beginner tutorial: construct.net/en/tutorials/beginners-guide-construct-1

    It will teach you about the camera and the viewport ("window" border at the top left)

  • Make sure you set the function's "Return Type" to something other than None