[idea] Action Queue Object
Some time ago, I posted a thread on Tech Support asking how to make a character follow another by copying it's actions after a delay. The thread got a few responses, and a couple of examples, but it seemed that it couldn't really be done without some decidedly kooky programming with the Move It object, and even that wasn't bug-free, with characters floating around the place a bit and going through scenery.
The other day I came up with this idea for an extension, though, which could fix things and have plenty of use for other stuff.
Essentially, it would let you store actions in a list and later re-execute them on a different object (provided the object is compatible) when the list is full. It's a little hard to explain, so maybe a little pseudo-code with the Platform Movement Object (PMO) would help here. It works a little like a fastloop in the code set-up:
Start Of Frame
- Start queue "Move"
- Set length of queue "Move" to 10
- [PMO] Set object to Player
[PMO] Test for object overlap
+Player is overlapping a backdrop
- [PMO] Object is overlapping a backdrop
- Record events of PMO in "Move"
Repeat whilst Right is pressed
- [PMO] Right input key is pressed
- Record events of PMO in "Move"
//All the other stuff
Queue "Move" is full //This would be positive on Frame 10
- [PMO] Set object to Player2
- Execute events in Line 10
Always
- [PMO] Set object to Player
- Set queue index "Move" to QueueIndex + 1 //Automatic instead?
So, what would happen is this, if Left is being held (and if PMO/my pseudo-code was perfect, iirc there's some problems with changing objects?):
Frame 1: Player moves to the left, the event "[PMO] Left input key is pressed" is stored in line 1 of the Action Queue Object. Lines 2-10 are still empty, so Player2 stays where it is.
Frame 2: Player moves further to the left. The recorded line 1 above is moved to line 2, the actions in this frame are put in Line 1. This happens from here to Frame 10.
Frame 10: Or 11? I always get this stuff wrong. Anyway, the frame when the list has been filled. PMO sets the object to Player 2, the Action Queue tells PMO to do the events stored in the last position (the first ones recorded), so Player2 starts moving left. Essentially following Player with a 10-frame delay.
So, there's the bare bones of it. It'd need an action for recording a blank space (in this example, if there player is stopped dead) - which I presume would mean changing it from a null value to "0" so it's not read as an unfilled entry but nothing actually either. It'd need actions to stop a queue from running/recording, too. As each frame progresses, the bottom event is replaced with the one above, and so on, the new events put in at the top.
Maybe it could have an action for appying actions to a different Active - "Execute Events in Line 10 on Active2" - but that could bring up some compatibility problems, like trying to apply actions of one extension onto another by mistake.
So, reckon this is technically feasible? Or even a good idea?
Regards
~Raylax
Re: [idea] Action Queue Object
cool idea...could be used for lots of cool things
Re: [idea] Action Queue Object
I don't think that's technically possible since you can't access the function calls of each object, but I might be wrong.
Re: [idea] Action Queue Object
Or perhaps its time to create a better way in MMF to allow users to create extensions without having to learn C++.
This has been an ongoing issue that has been discussed over the last couple of years.
Re: [idea] Action Queue Object
...Suggestions? You could technically port the SDK to other languages, but... nah.
Re: [idea] Action Queue Object
You couldn't. The SDK requires mmfs2.lib, which is for Microsoft Visual C++ only.
Re: [idea] Action Queue Object
You said you could some weeks ago, though. ;)
Re: [idea] Action Queue Object
Woo, looks like the thread has sparked a bit of discussion. Non-coders to make extensions? Yeah, that would be cool. Maybe someone who can make extensions and understands the SDK could make a tool for the job? It would probably be quite limited compared to what could be done with the raw SDK and a copy and knowledge of Visual C++ (I guess then it's a case of the old Command Line vs Operating System - complete control using the Command line, but much easier to use an OS), but maybe such a program would be handy for making small, relatively simple extensions for personal use.
Re: [idea] Action Queue Object
Jamie, is it possible to port the SDK to Borland C++
Re: [idea] Action Queue Object
MMF2 could grow to make Widgets more viable and powerful, we have discussed that somewhat. At least the seeds are planted.
As for an extension maker, that's still rather fuzzy. I find it hard to imagine it is impossible, but it could be improbable. Extension developers probably have an opinion on this ;)
To make it so, it takes some vision first. Brainstorming. How would this be possible, how would it work and what would it do?
Since programming extensions in C++ adds functionality from the raw guts of lower level code, how could you take that up a level or two to something between C++ and MMF? It would probably be innovative, but complex to initiate.
You have the code and then the potential visual, display elements, (think Dialog Box +). Really, future MMF widgets might be able to use functional blocks created in C++ that could then be tied together via events, for instance. So, the functional blocks would be a growing library of interface-able elements that are more primitive than extensions and more versatile and Lego-block-like.
That's pretty much the same as using ActiveX or DLL's except there might be a way to assemble these functional "objects" in an easy, straight forward fashion either in a "creator/editor" to be used in a blank Extension/player or via actions within MMFF.
That's my rough idea and I am sticking to it for now ... now to duck while the missiles fly! :) It never hurts to take a stab at something new or envision a potential. That's step one.
So, start a thread or discuss it here if you care to.
Re: [idea] Action Queue Object
Quote:
Originally Posted by Crazy_Ivan
Jamie, is it possible to port the SDK to Borland C++
Unfortunately, no. The library distributed with the SDK, which is required to implement an extension, is built for Microsoft Visual C++ only.