Animation Engine Functions

Started by RickJ, Sat 01/03/2003 04:07:51

Previous topic - Next topic

RickJ

In this thread the functions that comprise the animation engine will be discussed in detail.  This discussion is being conducted here for the benefit of the community and to allow opportunities for making input in the process.  A design spec as well as other documents are available in plain text form from the urls below. Checkout Juncmodule's disscussion of AI/Mood system.  

Execution Control Functions
Here are the functions curently defined that control the execution of animation engine threads.  

  // Start and stop execution of the specified thread
  AeRun(thread)
  AePause(thread)
  AeStop(thread)
  AeToggle(thread)

  // Debug GUI - Next and previous line in the specified thread,
  // Similar to single step function in traditional debugers
  AeNext(thread)
  AePrev(thread)

  // Debug GUI - Switch gui to another thread
  AeNextThread()
  AePrevThread()
  AeGotoThread(thread)

  // Get current execution state of specified thread
  AeState(thread)

Thread Creation, Branching, and Looping
These functions can be nested upto aeNMAX levels deep.  aeNMAX is a constant and can be set to any number of desoired levels.

What convention should be used to name constants?  Use aeNAME, AENAME, AE_NAME or some other variation?

  // Create thread, threads are bounded by these functions
  aeInit(thread)
     :
  aeEnd()

  // Expressions
  // An expresion consists of two values and one of the
  // following operators: (eq, ne, gt, lt, ge, le, and, or)

  // Conditional branching
  aeIf(value1, operator, value2);
     :
  aeIfElse();
     :
  aeElse();
     :
  aeEnd();

  // Conditional looping
  aeWhile(value1, operator, value2);
     :
  aeEnd();

  // Unconditional looping - loop fixed number of times
  aeLoop(value); or aeRepeat(value);
     :
  aeEnd();

which name is preferrable aeRepeat() or aeLoop()? aeRepeat is currently implemented to repeat the entire thread and simply jumps back to the beginning the specified number of times.   What should I do about this?

  // Unconditional branching
  aeDoCase(case);  
     :                        
  aeCase(case);      
     :
  aeDefaultCase();
     :
  aeEnd();

Statements immediately following the DoCase() will always be executed.  When the first Case() is encountered a jump to the specified case will occur.

  // Unconditional branching
  aeDoRandomCase(case, random);  
     :                        
  aeCase(case);      
     :
  aeDefaultCase();
     :
  aeEnd();

Similiar to DoCase() except actual case is calculated by case=case+Random(random).

Ok so let's review these first, then we will go on to the next group.  Let me know what you think, questions comments, suggestions, pitfalls, etc..  ;D

Scorpiorus

#1
Oh, I have found the thread. bump up.

QuoteWhat convention should be used to name constants? Use aeNAME, AENAME, AE_NAME or some other variation?
aeNAME seems fine for me.

Quotewhich name is preferrable aeRepeat() or aeLoop()? aeRepeat is currently implemented to repeat the entire thread and simply jumps back to the beginning the specified number of times. What should I do about this?
I'm voting for aeLoop then.



After reviewing the first version of global move command I optimized it's code. The new version adds separate raw move command as well as global move command:

-  Global move script file v1.01
-  A little test game demonstrates global move in action [25kb]

Well, Rick, this way move command should work fine for AE. There is AGS_CHARACTERS_MAX constant which determines maximum number of characters. You may want to decrease it (originally it's 150) to see single NPC's footprints.

As you already know global move (new move) uses both raw move and AGS move function but there is a problem....
Although raw move command uses the same walking speed as AGS MoveCharacter() it doesn't work properly if there is anti-glide mode turned on. I just can't solve the problem of recalculating walkspeed as it depends on frame skipping speed.

-Cheers


RickJ

Ok.  aeNAME, aeLoop() it is.

I had a look at your global.txt.  Cool.  I need to look more, maybe try it when I find some time.   I will use this method for character movements.  I would also like to add the generic math functions to BlueGui.  I also found your sting array stuff on another thread, very good stuff.  Thanks for everything.

I have added DoCase() and DoRandomCase() functions.  See my previous post or the text document.

 

Scorpiorus

#3
Quote from: RickJ on Mon 03/03/2003 15:54:22
Thanks for everything.
you are welcome. :)
The global move command works another way that the one from CCS where I used only AGS movecharacter function and hiding NPCs. The only disadvantage, as I said above, is speed calculatings.

QuoteI have added DoCase() and DoRandomCase() functions.  See my previous post or the text document.
oh, yes that's would be handy statements. Good work!

Another suggestion has just occured to me is (for future) is some sort of export import functions:
aeLoadThread(int ThreadId, string filename);
aeSaveThread(int ThreadId, string filename);
AeLoadThread(int ThreadId, string filename);
AeSaveThread(int ThreadId, string filename);

With these commands it would be possible to change code inside already compiled game. That might be useful. But that's not priority for now.

-Cheers

Neole

I'm confused - what is this, a plugin?

RickJ

Neole:  It's open source script.   Anyone can downloade it and include it in their own creations.  

Scorp:  I'm working on  specifications for the base engine and for extensions that support the autonomous character control system I have been discussing with Juncmodule.  I plan top begin implementation next wednesday.

Oh! and the Load and Save thread idea is cool.  With that you would be able to select personality profiles for your characters.  Let the player do it or automatically like Dr. Jekyll & Mr. Hyde.

 

Neole

Open source script for AGS? What is it supposed to do exactly?

RickJ

It makes it easy to make multiple, simultaneous character and object animations....

RickJ

Spec documents have been updated.  See links in first post.

Scorpiorus

I was experimeting with bold character[]. variables  ;D and here is a simple global animation command:

=> newAnimationCharacter function [global script source] (ver0.2)


Well it's just a basic implementation and it has some bugs due to the lack of get-view(loop/frame)-data functions.

-Cheers

a-v-o

Quote from: RickJ on Sat 01/03/2003 04:07:51
CJ has already implemented 50 GlobalStrings. See help file SetGlobalString and GetGlobalString

Helm

RickJ are you still pursuing this?
WINTERKILL

RickJ

Helm,

Yes this is still on my todo list.  When will you need it?

juncmodule

I posted a little in your "My Absence" thread about this...

I have abandoned my previous project that would have used this system. I had decided to go back and start it again but, after taking a good look at it I realized that it was WAY too ambitious :P.

As a sort of test game/demo of my AI system and perhaps even AE I have started another game which is a bit more simple.

It will contain one city and about 26 people. A lot of work, but much better than the 20 cities and 60 people that Smuggler had. Of the 26 characters initially I intend to only have 5 exhibit "intelligence". I will slowly build up from there adding "intelligence" to other characters as I become more comfortable (and get all of the bugs worked out) with the system.

I am currently still in the artwork stages which I intend on taking a lot of time with. This will be my first game with 100% orginal artwork ;D.

So, when I need this will be some time off still. Just to let you know though, I am still greatly interested in seeing it completed ;).

later,
-junc

RickJ

Junc:  

Great!  Knowing that folks are interested in using it gives me incentive to get busy.  I think your timing will work out just fine for me.  

TerranRich

Boy, I must be stupid. :P I'm very interested, but also very confused. I've read all the threads, all the documents, and I still don't quite get any of it. Perhaps some kind of dumbed-down tutorial could be made in the future? ;)
Status: Trying to come up with some ideas...

juncmodule

It is actually extremely simple. That is what makes it so confusing :P.

Truthfully though, it is.

It is a very complex way to be able to do something very simple. Since AGS doesn't allow controlling of characters across rooms there needs to be a way to do this.

Currently if you have a character you can control him in one room, but, if you want to use him in another room you have to import him there and THEN move him around. Some commands are blocking and some execute all at once. This all makes it very difficult to control non-player characters (NPC's).

RickJ's Animation Engine (AE) solves these problems by allowing global animation and movement commands. So, in your global script under repeatedly execute you can put a set of commands to control EVERY character in the game, in every room.

Currently Scorpiorus' CCS plug-in does just that. But, it can be a little confusing, doesn't recognize walkable areas, and a few other things. The work between Scorpious and RickJ was to combine their efforts and make it so you didn't need a plug-in. (Thus allowing portability to Linux).

My project which mirrored another portion of RickJ's AE system was meant to create Artificial Intelligence(AI) within AGS. While of course not TRUE AI, it was something that could at least emulate it.

It would allow two characters, NPC's, to walk up to each other, have a conversation, and then walk away in a different "mood". Then, the next time they had a conversation their initial mood would affect that conversation.

Of course this is how I saw all of these things coming together. I think Scorpiorus and RickJ may have been taking a slightly different approach. Hopefully that kind of explains it a little better. My apologies if anything sounds a little "too" dumbed down in here. My intention is not to insult, just to be as clear as possible without adding more confusion. ::)

later,
-junc

TerranRich

Don't worry about it! I prefer dumbed-down explanations. :P

This sounds very interesting actually. I'd imagine having moods in that aspect (affecting conversations, etc.) would be VERy complicated to implement. I mean, altering moods is one thing. But deciding what to say based on a set of moods is another altogether.

:o
Status: Trying to come up with some ideas...

RickJ

#18
Rich, you are the one that got all this started ;) when you asked about having characters randomly walk across the screen in the background.  Maybe it will make more sense when I get it done and thetre is a demo available.

Scorpiorus

QuoteAs a sort of test game/demo of my AI system and perhaps even AE I have started another game which is a bit more simple.

It will contain one city and about 26 people. A lot of work, but much better than the 20 cities and 60 people that Smuggler had. Of the 26 characters initially I intend to only have 5 exhibit "intelligence". I will slowly build up from there adding "intelligence" to other characters as I become more comfortable (and get all of the bugs worked out) with the system.
Right approach, junc. Also I think it is the way the future mood-packs will be created. So we have several characters living in a small world. Then we can extend it, add new ones, adjust their attributes, etc.

QuoteCurrently Scorpiorus' CCS plug-in does just that. But, it can be a little confusing, doesn't recognize walkable areas, and a few other things.
Walkables is a general problem. AGS holds only one room at time so that means we can't get access to the walkable in any other room. The reason I made it MoveDirect is because otherwise it could de-synch game process a lot more as in that case characters moving in the current room would walk around the obstacles (set by walkables) while in other rooms they'd go direct. Yet one important note, even if it were possible to use all rooms' walkables imagine how it could slowdown a game when there is a pathfinder run for several characters. :P


Rick, glad to see you. :) I had think about AE implementation and another idea come to my mind. What about simulating multiple scripts running at time? Not just threads but having fully(basically)-equiped script launguage: functions, variables (scope), stack (recursive calls). And all these with parallel processes support. And maybe implement the ability to use some object oriented approach. :P No, I'm not talking about entire OOP thingy but some sort of class struct would be handy. So all related projects like Autonomous CCS could rely on that basement (example: we could have a class with all character's attributes defined in + some methods incapsulated as well). It would make unnecessary to add segments thing we were talking about. Instead there are two different methods processing simultaneously: character.walk() and character.think(). Though I see the speed to be the main issue. I know you are working on important project so that's just a suggestion for future  requiring a detailed discussion I think.

-Cheers

SMF spam blocked by CleanTalk