FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: Object - Instance relationship  (Read 3306 times)

icefire

  • Newbie
  • Posts: 2
    • View Profile
Object - Instance relationship
« on: January 11, 2008, 12:51:52 pm »

Hello

While working on our project and studying FIFE core code I found that current Object - Instance relationship makes it difficult (impossible?) to achieve the effect of variations of Instance animations of the same Object. Current design forces all instances of the same object to be immutable, but animation overlays for example require the ability to make modifications to them.

So, do you consider making changes to the design, that will allow such modifications?

Basically, it would be enough to use copy constructor to initialize m_object field of Instance in constructor, instead of setting the pointer to Object. But maybe it would be better to separate mutable and immutable Instance classes, or keep animation id's in Instances, or something like that.
Logged

jasoka

  • Developer
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Object - Instance relationship
« Reply #1 on: January 12, 2008, 08:32:09 am »

Could you give an example where you encounter this restriction? Perhaps could you think overlays with the same mechanism as animations in actions (which are immutable as well); each instance uses the same animations, but they can be timed differently and e.g. movement direction might differ.

Perhaps you could extend the action definition to include all overlay stuff, and keep track of currently used overlays in instance (like done with movement direction).
Logged

icefire

  • Newbie
  • Posts: 2
    • View Profile
Re: Object - Instance relationship
« Reply #2 on: January 12, 2008, 10:51:14 am »

Could you give an example where you encounter this restriction?

I want to create new player animations on-line: load several image sets, render new animations for each action and each direction depending on player's weapon, armor, etc., add new animation resources to the pool (all in game). Then I need to exchange animation id's for player's actions, which are stored in ActionVisual for Action, which is defined in Object. And this is from where the Instancerenderer gets the animation id.

Yes, overlays are defined for instances, and their logic is inside ActionVisual, but it would be good to have animation id's stored for each Instance separately, not for Objects. Example: to have 20 instances of Object "goblin", each with possibly different weapon, or slight difference in appearance, etc.
Logged

jasoka

  • Developer
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Object - Instance relationship
« Reply #3 on: January 12, 2008, 01:24:37 pm »

Yes, overlays are defined for instances, and their logic is inside ActionVisual, but it would be good to have animation id's stored for each Instance separately, not for Objects. Example: to have 20 instances of Object "goblin", each with possibly different weapon, or slight difference in appearance, etc.

How about an approach where you store all weapons and appearances inside one action, and then in instance just mark which ones are used. That way view can pick the correct combination for each instance. The example would be:
- Goblin object
-- Goblin walk animations
--- naked animations
--- Boots animated for walking
--- Sword animated for walking
-- Goblin stand animation
--- naked animations
--- Boots animated for standing
--- Sword animated for standing

Goblin instance 1:
- current action = walking
- equipment = boots
--> view renders "naked animation" + boots

Goblin instance 2:
- current action = walking
- equipment = boots, sword
--> view renders "naked animation" + boots + sword

What do you think?


Logged