oosyrag's Forum Posts

  • Yes this is possible.

    As with all peer to peer networking with authoritative host, each peer will send only their input states to the host, such as mouse position and button inputs.

    The host, upon receiving the input state from any peer, can determine what to do with the object.

    For example, upon receiving a "click" and "position" from a peer, the host will go through the following process:

    Conditions:

    Where did the peer click? Is it on an object?

    Is the peer holding the mouse down?

    Where is the peer's mouse position moving to?

    Action:

    Move object to new location.

    Using object syncing, the object's new position will be reflected to all peers.

    You will have some additional considerations, such as "ownership" of an object, so multiple people can't manipulate the same object simultaneously, as well as local input prediction so the object's movement will be instantly reflected locally on a peer to hide lag.

  • Your performance issue is unlikely to have anything to do with the number of objects. Static off screen objects should basically be negligible in terms of performance.

    It will be difficult to give more advice without seeing the whole situation though.

    Looping through a large array constantly definitely is not a good idea. If you want to stick with that general method, you'll want to break your map and arrays into "cells". A fair cell size would be a bit larger than your viewport window. As you move around your map, you'll only use the 4 (offset based on half cell sizes) or 9 (whole cells, simpler but less efficient) nearest cells/arrays to populate the map. Also generally speaking you probably want to avoid destroying and recreating an object that is going to be exactly the same as it was before anyway, so adding a check to see if the object already exists then not taking action is better.

    Still, I normally wouldn't recommend this technique outside of completely procedural/endless map type games, it should normally not be necessary.

  • Try moving the world around the player instead of moving the player directly.

  • The first idea that came to mind is to have a checkpoint trailing behind the player location. When you use the checkpoint to respawn, disable enemy spawnng for x amount of time, and place x amount of flat ground before starting up your procedural generation again.

  • HTTP headers are configured on the server side, where the file is hosted - in your case, Google Drive.

    The control is specifically there to prevent outside websites or apps (your game) from directly accessing files on the server. It is pretty much on by default for all servers, because the owners of those servers don't want people abusing their resources.

    If you are the owner/admin of your own server, you can set that HTTP header to allow cross domain access in your server configuration.

    Basically, if you want your app to access data online, a free file hosting service probably isn't going to cut it. You might want to look into setting up your own server, or use a service like backendless, firebase, or parse.

  • You can open C2 files directly from C3....

    Here is another https://www.dropbox.com/s/l8ap1sdcf26uf ... e.c3p?dl=0

  • Generally speaking, if you want an event to run for each instance of an object instead of one time for all of them, you want to use the system "for each" condition.

  • Fake path is what I was thinking. Just a quick idea, I haven't tried this, but if your layouts are generally going to be similar to your example it should work...

    You're going to spawn four invisible helper objects at each wall object , offset at each corner. Whenever you select a destination, your player will pick the nearest helper object that exists between player and destination, and move there. When it arrives, repeat for the next closest helper object between player and destination (the ones that have been passed are no longer considered). Continue until no more helper sprites exist between player and destination. This should get you a very rudimentary pathfinding system.

    There are many situations it might not be ideal though...

  • What is the reason not to use pathfinding behavior?

    Another option would be to create a custom pathfinding system, which could possibly be simpler than boids or SAT depending on how flexible you want it to be.

  • Full answer: https://www.red3d.com/cwr/boids/

    Simple answer: Have each obstacle exert a force vector proportional to the distance away from the object, away from the object.

    Edit: If you have long straight objects like walls, pathfinding is generally the better solution...

    I've also seen SAT used to have objects slide off and around each other http://www.dyn4j.org/2010/01/sat/

  • Which part are you having trouble on?

    Here is a commented example: https://www.dropbox.com/s/69dqyvjskr9nr ... .capx?dl=0

  • Haven't confirmed but (viewportleft+viewportright)/2 sounds like it should give you the middle of the viewport regardless of where on the layout you are. Even when you are parallaxes, as long as you place the object on the same layer as you are getting the viewport numbers from it should work fine.

    You can try viewportleft+(originalwindowwidth/2) as well.

  • On touch sprite - Set var to var=7?1:var+1

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Put the origin point at a tip of the triangle.

    For each hexagon x/y

    Repeat 6 times - Spawn triangle at x/y, rotate loopindex*60 degrees.

    To get a random color for each triangle, assuming you are using a single object with different animation frames, add an action to set animation frame to floor(random(6)).

    To get a non-repeating random color for each triangle, create an array size 0,1,1.

    Step 1 - Populate the array

    Repeat 6 times - Array Push Back loopindex

    Step 2 - Pick a number out of the array out of the remaining available numbers (use a variable)

    Set PickedIndexVariable to floor(random(array.width))

    Step 3 - Apply the picked number

    Set triangle animation frame to Array.At(PickedIndexVariable)

    Step 4 - Delete the picked index so it can't be picked again

    Array delete index at PickedIndexVariable

    Repeat steps 2-4 until all numbers are picked

    Repeat step 1 for next set of triangles.

    Repopulate array

  • There are many ways to create a "seeded" random. There are different advantages, disadvantages, and varying levels of complexity for different methods. Depending on your particular needs, you should pick the most suitable method. The general technique is called pseudo random number generation.

    https://gist.github.com/blixt/f17b47c62508be59987b

    https://www.geeksforgeeks.org/pseudo-ra ... ator-prng/

    https://en.wikipedia.org/wiki/Pseudoran ... _generator

    https://en.wikipedia.org/wiki/Middle-square_method