User Tag List

Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 11 to 20 of 34

Thread: Object-based MMF Interface

  1. #11
    No Products Registered

    Join Date
    Aug 2006
    Posts
    984
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    Quote Originally Posted by Retriever2
    I want to take a moment and share (in code) some of the way things are changing

    Code:
    -- On the frame, we've created a bunch of instances of a "Goomba" active object.  We've also got some "Koopa Shell"s
    
    -- An object class represents an object collectively
    -- An object represents a single instance
    goombaClass = mmf.NewObjectClass("Goomba")
    koopaShellClass = mmf.NewObjectClass("Koopa Shell")
    
    -- We can get objects from a class
    goombaList = goombaClass.objectList()
    
    -- And operate on them all
    for i,goomba in ipairs(goombaList) do
      if (goomba.overClass(koopaShellClass)) then
        -- When we destroy an object, the lua table backing it will
        -- disable itself, so even if we try to use it we're safe
        goomba.destroy()
      end
    end
    
    -- We can store our own data or methods with objects or object classes.
    goombaClass.step = function(obj)
      obj.x = obj.x - 1
    
      -- Speaking of names, now you can access alt values and strings
      -- by their names if you defined them in the editor
      obj.y = obj.y + obj.values['gravity']
    end
    
    for i,goomba in ipairs(goombaList) do
      -- Note, I still need to do some exploring but I may be able to
      -- get proper inheritance working with these special objects, thus
      -- avoiding needing call the class method via the class object
      goombaClass.step(goomba)
    end
    
    -- What am I doing here?
    goombaClass = nil
    collectgarbage()
    
    -- Oh no, I lost my class object with my custom defined method!
    -- But actually...
    goombaClass = mmf.newClassObject("Goomba")
    goombaClass.step(goombaClass.randomObject())
    
    -- ... the function is still there.
    goombaClass2 = mmf.newClassObject("Goomba")
    
    -- In fact goombaClass and goombaClass2 are the same table.  The
    -- library will keep a persistent reference of every object or 
    -- object class created, and always return the same table.
    So that's a little preview of the new things I've accomplished with the library.

    I'd like to hear anyone's suggestions on how you think the API should be designed, what should be included, issues like 1- vs 0-based indexing, etc. I never went out looking for input the first time I designed it, but now's your chance.
    where's rain() :<

    well i don't have ideas for the first two yet but for 0/1-based indexing i would almost lean towards 1 since doing the offset adjustments on the c-side would be more efficient and then you wouldn't have to rewrite some of lua's default functions to make them 0-based (that and mmf isn't very consistent about bases itself so)... however modulo operations (such as on animation frames) would be a little nicer with 0-base, though because that's probably not used a whole lot i wouldn't consider it very compelling. i could be an ass and suggest a function like mmf.useBaseOne(boolean) and an accompanying mmf.BASE constant but i won't

    so i guess you figured out your garbage problem then

  2. #12
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    This sounds good. So its basically like classes in C++??
    How does this method of object selection compare to the current method of passing ID values?

  3. #13
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    It's not quite a direct translation to the C++ class model, but I find a lack of more suitable terminology to differentiate object instances from object ... classes.

    Once you've created an object, it holds its own reference and ID, so you can just call fields or methods directly on it. To create objects, they can either be returned from a variety of selection functions of the class, or you can create one explicitly with a fixed ID.

    Before I release this DLL, I will write up an explanation of the model and everything it supports, along with some examples.

  4. #14
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    It'd be awesome if it automatically created classes for all the objects that exist (and deleted them when the objects are destroyed, etc)

  5. #15
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    That's a pretty good idea, at least being able to populate a list with all the available class objects. However I don't think deleting classes would make a lot of sense since objects could still be recreated later event-side. They do carry the current object count with them, though. Shame at the lack of any reasonable way to directly create objects.

  6. #16
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    Wait, I misunderstood what you had implemented. You've already done what I was thinking.

    I don't know how you managed to get any sense from my post, let alone ideas!

  7. #17
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    I won't be able to release a DLL until I finish fixing some of the architectural changes I started to XLua, but I now have online documentation available, quite thorough and rife with examples. You should be able to get an idea of what you can do if you flip through it. There's still some items not added to the documentation because they're not finished yet.

    http://jaquadro.homedns.org/~xlua/

    Eventually the entire XLua documentation will make it online.

  8. #18
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    Quote Originally Posted by Retriever2
    I won't be able to release a DLL until I finish fixing some of the architectural changes I started to XLua, but I now have online documentation available, quite thorough and rife with examples. You should be able to get an idea of what you can do if you flip through it. There's still some items not added to the documentation because they're not finished yet.

    http://jaquadro.homedns.org/~xlua/

    Eventually the entire XLua documentation will make it online.
    Nice, will there be a offline documentation also?

  9. #19
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    The first release is available: http://hocuspocus.taloncrossing.com/rii/mmfi.zip

    It's still an experimental platform and any detail is subject to change, but that will depend on the feedback that I receive.

  10. #20
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object-based MMF Interface

    Cool thanks this seems like it will be nice. Just wondering were you going to add a goomba/mario mfa example with this or was just code examples?

    By the way i noticed the help doc seems to have no title.

Page 2 of 4 FirstFirst 1 2 3 4 LastLast

Similar Threads

  1. Interface Bar Object v1.0
    By DanielRehn in forum Released Extensions
    Replies: 2
    Last Post: 27th October 2013, 05:54 PM
  2. Interface Bar Object - Help Needed
    By Bowler in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 31st July 2012, 01:12 AM
  3. Interface Bar Object v1.0 released!
    By DanielRehn in forum Extension Development
    Replies: 40
    Last Post: 7th September 2008, 06:36 AM
  4. Interface Bar Object v1.0
    By mmf2 in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 11th August 2008, 02:34 AM
  5. MMF 2 - Object Interface Question
    By droberson in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 15th March 2007, 11:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •