Mass Scene Behaviors?

Sunflower

  • Posts: 591
(first I wanted to name this thread "Global Scene Behaviors", but this could lead to misunderstandings)

Could we have an option to attach a behavior to all scenes? Or rather, that it would be done automatically and you wouldn't have to attach it every time you make a new scene? I'll explain in detail what I mean...

Let's say that we have e.g. behavior which contains some often used functions, like, for example, HUD. Now, whenever I need to use them, I must add this to the scene. However, remembering to add it to every scene may be quite difficult, especially when this is a game which contains many levels, like, for example, platform game. Not having these behaviors might lead to unexpected bugs, which would be tricky to reproduce, because it would require going exactly to the buggy scene or so. >_<

However, that's where Mass Scene behaviors would help. They wouldn't allow to pass values between scenes; they would work like regular Scene behaviors, except they would be attached to each scene automatically, so the creator wouldn't need to add them each time a new scene is added. I think that setting a behavior as Mass Scene one could be done through Properties, somewhere near defining if it's Actor or Scene behavior. Also, in Behaviors section in scene editor there could be a checkbox "Attach Mass Scene Behaviors", which would be marked by default (that's the purpose of MSBs, after all), and could be unmarked when this scene doesn't use these behaviors, like e.g. menu doesn't need HUD for game.

So, what do you think about it? O.o

ssaamm

  • Posts: 13
It's a very good idea.

I think that it would work best if the behaviors were folder-based.  A set of behaviors could be applied to a folder of scenes.

That, I think, would work the best if we were to do this.
or something

+1

This would've been VERY useful when I was making Blip's Adventure. There were several behaviors I needed to attach to every level.

Darkhog

  • Posts: 1243
I support this with one change: Instead of applying for all scenes/actors (for actors it might be useful too in some cases), give list with checkboxes similar to one which Facebook displays when you inviting friends to games:





Each item will be scene and in place of photo there will be scene thumbnail. At the left checkbox will be there. This way you'll be able to check to which scenes you want to add behavior.

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

Sunflower

  • Posts: 591
Well, yes, I think it could work IF there was another checkbox, somewhere at the top or bottom, with option: "Attach this behavior to newly created scenes". Otherwise you still need to remember to add it sometimes; more rarely, but still.

Aber

  • Posts: 33
It's not exactly what you wanted but we all noted that in a game a lot of scenes would share the same set of behaviors.

The best workaround is that once your primary scene is done with all the scene behaviors such as title, background music, switching etc, just go the game center scene tab and right click on the primary scene and pick duplicate. You'll see a Copy of Primary Scene created. Then go into this copy and go to properties tab and change the scene name to scene whatever. Then you can proceed to change any of the scene attributes in this second scene. This is kinda of a workaround to save you some typing and asset management.

The above also applies to Actor. You can duplicate it multiple times if they happen to share a lot of similar behaviors.

Ganu

  • Posts: 224
Yep if  this will be implemented it will really make our life easier.
Pray to Stencyl.
Currently waiting for joints in stencylworks.

redpesto

  • Posts: 134
It's not exactly what you wanted but we all noted that in a game a lot of scenes would share the same set of behaviors.

The best workaround is that once your primary scene is done with all the scene behaviors such as title, background music, switching etc, just go the game center scene tab and right click on the primary scene and pick duplicate. You'll see a Copy of Primary Scene created. Then go into this copy and go to properties tab and change the scene name to scene whatever. Then you can proceed to change any of the scene attributes in this second scene. This is kinda of a workaround to save you some typing and asset management.


Agreed, while not perfect I think the duplicate scene then strip off what you don't want, will pretty much meet the OPs needs right?

chaosoul

  • *
  • Posts: 260
It's not exactly what you wanted but we all noted that in a game a lot of scenes would share the same set of behaviors.

The best workaround is that once your primary scene is done with all the scene behaviors such as title, background music, switching etc, just go the game center scene tab and right click on the primary scene and pick duplicate. You'll see a Copy of Primary Scene created. Then go into this copy and go to properties tab and change the scene name to scene whatever. Then you can proceed to change any of the scene attributes in this second scene. This is kinda of a workaround to save you some typing and asset management.


Agreed, while not perfect I think the duplicate scene will pretty much meet the OPs needs right?
This is actually pretty inconvenient if you're trying to apply a new behavior to already existing games. I support Hectate's updated idea.
COOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEESS

Greg

  • *
  • Posts: 1259
Yes, I think the main problem is when you already have a large number of existing scenes - and you realize that you need a new behavior for something.  Then you have to go back and open each scene to add the behavior. 

Sunflower

  • Posts: 591
This is actually pretty inconvenient if you're trying to apply a new behavior to already existing games. I support Hectate's updated idea.
Uh... just who you mean by saying Hectate? He didn't write anything here so far (unless I don't know about something -. -.). Maybe you meant Darkhog? :P

Hectate

  • *
  • Posts: 4643
This is actually pretty inconvenient if you're trying to apply a new behavior to already existing games. I support Hectate's updated idea.
Uh... just who you mean by saying Hectate? He didn't write anything here so far (unless I don't know about something -. -.). Maybe you meant Darkhog? :P
I have to say, I was confused as well. I'd been reading this thread as it progressed and I had to go back and check to see if I'd posted something also.

Unless chaosoul meant to post in another thread, lol.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

redpesto

  • Posts: 134
This is actually pretty inconvenient if you're trying to apply a new behavior to already existing games. I support Hectate's updated idea.

I support Hectate's idea also - but until its implemented into SW this way will save a little time if you have a lot of scene behaviours going on :D


EDIT: Come on Hectate, own up - you put the idea into his mind didn't you? ;)

ssaamm

  • Posts: 13
Well, we appear to have 3 solutions here:

1. Set certain behaviors to automatically attach to scene

Pros:
Functional

Cons:
Possible cause of confusion
Likely will cause additional manual effort because of deactivation/reactivation


2. Set certain folders to cause the scenes inside to have behaviors

Pros:
Allows for active/passive manipulation of behaviors
Promotes organization

Cons:
Bureaucratic, in a way
Relies heavily on user


3. Create an interface for adding behaviors to several scenes or scene folder simultaneously

Pros:
Straightforward
Does not require maintenance
Does exactly what it says it will do

Cons:
Not undoable (EDIT: at least automatically
Also, it has to be applied every time a new scene is made)

« Last Edit: August 23, 2011, 06:10:30 pm by ssaamm »
or something

Sunflower

  • Posts: 591
1. Set certain behaviors to automatically attach to scene
[...]
Cons:
Possible cause of confusion
Likely will cause additional manual effort because of deactivation/reactivation
By the second cons, do you mean that you would need to deactivate every single behavior manually, because they wouldn't be appropriate e.g. for menu? If so, I just want to remind of the possible checkbox "Attach Mass Scene Behaviors" made for these quite exceptional scenes.

Although I think that the idea of attaching behaviors to folders rather than to single scenes appeals me the most, now that I think of it. It may be bureaucratic in a way, but I don't think it's exactly the bad thing; after all, having a habit or organizing scenes into folders isn't something bad, is it? O.o
After thinking about it a bit more (although I don't know how it would be technically complex), I think that you could attach already packed behaviors to scenes, anyway, for example to change some attributes.

Let's say that there would be behavior "Init Physics", which would set gravity and other things to proper values. There also would be folder "Ingame Levels" which would have behavior "Init Physics" attached to it with gravity value 5. Also, this folder would contain 3 more folders, like (*generating possible lands out of blue, please wait*) "Grassland", "Volcano" and "Space". First two wouldn't have any behaviors attached to them, because they're very default; Space, however, would have behavior "Init Physics" with gravity value of 1. Because this folder is more "specific" than "Ingame Levels" (since it's contained by it), gravity would be set to 1 rather than 5.
Also, there would be scene "Last Boss" which would take place on some mothership with artificial gravity, and because evil aliens are used to different gravity than us, gravity value for this level should be something like 10 or so. So, instead of wondering what should be done, creator would simply include behavior "Init Physics" with gravity value 10, and this would count, as it's the most specific behavior here.

(I suppose that programmers would associate this idea with inheritance and overriding virtual functions... well, I hope it wouldn't be too complicated to make, because it could save a lot of work for us O.o)

I think that it technically would be best to do with some window for folder behaviors, where you could attach them, and then all the scenes and lower folders would inherit these as well. Also, in the behaviors attaching screen, for scenes as well as folders, inherited behaviors should be shown as well, with darker font, perhaps (overridden behaviors would show as normally attached ones).

So yes, I support the idea with folders!

Quote from: redpesto
EDIT: Come on Hectate, own up - you put the idea into his mind didn't you?
Now whose mind do you have in mind... I mean, who do you meant? I'm still not sure if you're talking about Darkhog or me. Assuming from the "his" it should be Darkhog, but you could've been mistaken. >_<

Also, Hectate, apparently you have became the local Puppet Master here... oh my, I have a doll in my avatar! O.o