Too much going on in one block, bad?

redpesto

  • Posts: 134
Is it bad practise to have too many things going on in one Design Block?

I have a block that controls the player's movement, which is already quite complex & non-standard. Within that same block I've ingrained the combat animations. I have a load of attributes inside this block that all need to check on each other.

As everything is already talking to each other it would be easiest to just carry on adding to this one block. I've thought of a few options; the main one being to use global attributes so they are not contained in the block - but it says globals are for save games and high scores, is it a bad idea to do this? The attributes are things like 'When X is held down HeldDown? = True'. Its important a lot of different elements can see this state.

Thoughts?


Rawr

  • Posts: 85
Is it bad practise to have too many things going on in one Design Block?

I have a block that controls the player's movement, which is already quite complex & non-standard. Within that same block I've ingrained the combat animations. I have a load of attributes inside this block that all need to check on each other.

As everything is already talking to each other it would be easiest to just carry on adding to this one block. I've thought of a few options; the main one being to use global attributes so they are not contained in the block - but it says globals are for save games and high scores, is it a bad idea to do this? The attributes are things like 'When X is held down HeldDown? = True'. Its important a lot of different elements can see this state.

Thoughts?
I dunno how it affects the performance of the game, maybe it kinda slows it down, or maybe it doesn't. Dunno.

But I actually 'prefer' having as much things as possible going on in one block...it makes everything quite logically simple. As long as you don't forget where you left off on the coding that is...  :D

AnachroNia

  • Posts: 72
At the end everything goes to one place. Maybe having more behaviors slows down more than placing everything in one :)

When you make a behavior it goes to Array. When it should update it loop thru the whole array executing each element's update method :)

Just try to optimize everything as much as you can :)

http://www.antiifcampaign.com/

redpesto

  • Posts: 134
Hmm interesting :D

I guess I'll make a new block where possible & the rest will be added into the big 'controls' block. Bit worried that things will get out of hand later on. Will work more on laying the block design out nicely.

Any thoughts on using Global Attributes for specific things?

coleislazy

  • *
  • Posts: 2607
It should not affect game performance, as long as everything is designed properly (for example, not executing unnecessary code every frame). It will affect the performance of SW when you have a large behavior open, however.

Also, I would avoid using global attributes just to use internally between behaviors. All global attributes are saved when you save the game, which should be limited as much as possible. Also, if you make a change to a global attribute, then load an old saved game, it would be using the old value still, which could make debugging very difficult.

If you need to pass attributes between behaviors, custom blocks are the way to go.