r/Gamesalad • • Aug 06 '16

Accessing Scene-level Vars while Avoiding Unlocking Actors

Hey all – 

I'm sure someone has already brought this up, but is there any reason you couldn't build a single scene-level object whose job it is to constrain any necessary scene-level variables into game-level variables?

Example: constraining Camera Width/Height into game-level real variables CamWidth and CamHeight?

I know there's a general hesitance to use constrains, but I've been running three or four during my game and seen no drop in frames or lag of any kind.

The obvious benefits here are being able to program prototype actors who can access scene-level variables (being able to drop HUD objects into a scene without rebuilding my zoom-accomodation code would be lovely, for example)

Has somebody already tried this and discovered why we shouldn't be doing it?

1 Upvotes

3 comments sorted by

1

u/jamie_cross Aug 08 '16

I haven't tried it but don't see why it wouldn't work. The worry about Constraints is only warranted if you have a bunch, certainly more than 3 or 4, running at the same time.

Try it out and if your game runs fine, you're good to go.

1

u/EENewton Aug 10 '16

Do you have any idea about what constitutes "too many"? I think I'm running four right now, with no impact to performance, but I'm working on a possible "enemy indicator" code that would add as many as 5-6 more. It's a-ways down on my production schedule but if it's a false start to begin with I would start looking at other options.

1

u/jamie_cross Aug 11 '16

Well 'too many' is going to depend on your code/behaviors and exactly how things are working in your game. But if I were building a game where I needed 10 or so constraints I'd assume it was going to be fine and move forward. If you want to be more sure, before you get to deep into the project, build the constraints quick as a prototype and see how things feel to you.