oosyrag's Forum Posts

  • Wait.... you might be right.

    Edit: You're definitely right. Use an instance variable in the family object to identify which object it is (set it on created).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello there!

    I have some questions about performance.

    1) Am I right that it will result in a better performance if I let the player object check if it is colliding with one of the hundreds of trees in my game instead of letting hundreds of trees check if they collide with the player object?

    There is no difference, the number of collision checks (which you can see and test yourself in debug preview mode) remains the same. As mentioned above, optimize performance by using other conditions to narrow down the number of objects that need checking, by using within distance or is on screen or something similar.

    2) For the tree falling animation I use the spin behavior and check if the tree is 1° to 90°, if so change it to a laying tree object so it will stop spinning. Am I right that it will have a better performance if I swap this tree to another unique tree object before the spinning part so that the eventing will only need to check trees that are actually falling instead of also checking all the hundreds of other trees degrees that are not currently effected from chopping? Or is it more demanding to destroy an object and let another spawn on its position?

    I would use an instance variable to keep track of the state of the tree (0 for stationary, 1 for falling ect.).

    3) I use player to tree collision checking to make the tree 50% opaque if the player is behind. For setting the tree back to 100% opacity I use "on every 0.2 seconds -> tree set opacity 100%". But this affects every tree. Is there a more elegant way to achieve this?

    Use an "Else" event after an is overlapping event to set oacity to 100.

    4) If I set an object to anothers child, it has better performance if I unselect as many of the "child-syncing" options as I can, right? Or do these only really take up performance if their parents are moving or changing their angles?

    Not familiar with this, but the golden rule is that if you can't measure a difference yourself, its not worth worrying about!

    Thank you in advance!

  • You simply put the actions for each object within the family in the actions.

    If there is an action for a specific object, but it is not picked, then the action doesn't do anything.

    So pick top instance of family as a condition.

    Actions

    ObjectA - Do something

    ObjectB - Do something

    ObjectC - Do something

    Only the instance that was picked would be affected.

    Alternatively you can add an instance variable to the family/object as a condition to compare against to take actions.

  • Add a 'scroll to' behavior to your player objects.

    You should try following the beginners tutorials,they cover a lot of the useful behaviours.

  • If the object is synced, you won't be able to use the drag and drop behavior on the peer.

    You will need to send the peer input states like mouse position and button states to the host, and the host will have events to move the object based on these inputs.

    After you get that working, you can duplicate the movement events on the peer side and activate local input prediction to hide the lag.

  • If you're not using tilemap, you'll want to check if an object (wall) is overlapping at that random point instead.

  • Assuming you're using a tilemap.

    The first step is to pick a random point to check if it is valid or not. You'll need to save this point to a instance variables, since if it is valid after checking we'll want to move to that spot.

    First set variables targetx and targety to round(random(layout.width)) and round(random(layout.height)).

    Use system compare two values to check if tile at that location is valid. tilemap.tileat(positiontotilex(self.targetx)),positiontotiley(self.targety)) = valid tile.

    If it is, then set pathfinding move to targetx and targety. Else run the event/function again with a new random target.

  • From my own experiences, I've found updating text objects every tick can cause major slowdowns, especially when more text objects are involved. I would say best practice would be to update the text only when it changes, usually by putting the set text action in the same event that causes the change in the first place.

    If you want to save and simplify the events, containers are perfect for this situation where sets of certain objects are always associated with each other. When picking any of the objects in a container, the associated instances of the other objects in the container are picked at the same time too.

  • An iframe should work.

  • Kiwi Story is a pretty big project! Probably best to mess with the two beginner tutorials more.

    Here's how I dug into it...

    First I was looking for the events that control inputs. The ePlayer event sheet seemed like a good bet so I started there, and indeed there was a "Player Input" group. This group looked like it had various input methods like keyboard and gamepad doing the same thing, calling the player move/turn functions. The functions I found in the next section below, where I could see that movement used the platform behavior, on the Player_Base object. So the Player_Base object is the one with the platform behavior settings. I found under Object Types > Level Objects > Player > Player_Base.

    However when clicking this you might see that all the properties on the left says "No Instances", so we need to find where this object is placed on a layout in the project to set the defaults. You can do this by right clicking the Player_Base object and then "Find all references". The first entry shows that it is on the ObjectBank layout. So open that layout, then you can modify the default platform behavior properties.

    Note that half of the above complexity was digging/searching through the organizational structure of someone else's project, you normally would know where things are set in your own project!

  • Are the videos embeddable? Have you tried using the iframes object?

  • Looks fine? Does it work?

  • On event 13, you aren't picking any text objects in the conditions, so the actions apply to all text objects instead.

    You'll need to either have some way to identify the correct text object to set, or set the text at the same time the text object is spawned, which automatically picks it.

    To associate a text object with a sprite object, you can put them both in a container, or upon spawning set an instance variable in the sprite to text.uid (or the other way around). Then you can use the pick by uid condition (Or pick by compare instance variable, if you did it the other way).

    It looks like setting the text when spawning isn't going to work in this case since you want it to update every tick.

  • Try adding a "for each" sprite object condition and see if that resolves your issue.