Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Is it possible to constrain table values?

outstreetflowoutstreetflow Posts: 15Member, PRO

Similar to how game or self attributes with the constrain attribute behavior, how could a value in a table be constrained?

The only solution I've come up with so far is to set a change table value inside of a time that performs every 0 seconds. I'm worried this will bog down the game's speed if too many of these actors are placed (They will be later in development).

Best Answer


  • tatiangtatiang Posts: 11,786Member, Sous Chef, PRO, Senior Sous-Chef

    Well yeah, you could do that with a timer but the more important question is: why do you want to constrain a table cell value? The only time they get changed is if you use a Change Table Value behavior... so it's not like a Move behavior or something that would be constantly changing the value of the attribute.

    Can you explain more about why you need to do this?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • outstreetflowoutstreetflow Posts: 15Member, PRO

    I'm working on a fake 3d game. I've been able to get this far by using the replicate behavior:

    As you can see there is a main block which is replicated in the direction of the camera. However, this came with a big issue... the main actor wasn't able to collide with the replicated block that was at the end. I figured that the main block could spawn an invisible actor with a collision. Each individual wall would need to spawn their own individual collision actor, to work this out I created a table. Each individual wall actor is assigned a row by following this process:

    This also commands the wall actor to put its important information (X,Y,Angle blocks are replicating, and the distance the farthest replicated block is)

    Now is where constraining these table values come into effect. These must be updated constantly as the distance and angle the replicated tiles are dependent upon the position of the camera in order to create a 3d illusion.

    Spamming the change table value behavior did work. The actor is successfully colliding with the invisible wall, but I'm worried this will affect the game's performance as this is the wall actor and there will be A LOT of walls.

    I guess the real question are...

    1.) Is there a better way of executing what I'm doing?
    2.) Will spamming a change table value behavior drastically hurt my game's performance?

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
    edited May 2017

    just spawn the whole wall instead of using replicate.

  • JapsterJapster Posts: 672Member
    edited May 2017

    I'd agree with @The_Gamesalad_Guru - Replicate's awesome, but really, it's mainly for helpful visual effects (Lives, bling, etc...) as the replications (replicants? :smile: ) have no real 'presence' in terms of physics or actor properties, I think you'll be much better off spawning the actual walls too?

    (EDIT) Note:- Just had a thought - perhaps you ought to replicate UP instead? - ie. your actor is the rectangle you mention needs to be the collision area, and replicates up? - however, I'm assuming you'd need to set your actor in a higher layer or order, and then when behind the block this would look wrong? - again, an argument for using spawning/destroying/re-spawning, on different layers, perhaps?

Sign In or Register to comment.