User Tag List

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

Thread: AI - Basic Principles

  1. #11
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    To pair your detectors with sprites, make sure there's the same number of detectors as sprites, then do this:

    ALWAYS
    --- Detector: Set position to (0,0) from Sprite

    MMF automatically pairs the objects. Think of MMF like a giant object database (which it is pretty much, with conditions acting like a query). Multiple object types will line up in 'rows' inside MMF's logic, so if you have the same number of objects of each type, they'll all follow each other.

    This is actually how Spread Value itself works.

    If you want to transfer data between these objects (the sprite and detector), try keeping the same alterable values in each.

    Then transfer them across using always commands, e.g.

    ALWAYS
    --- Sprite: Set 'Some Value' to 'SomeValue("DETECTOR")'

    and so on for each value you want them to share. This makes sure your Sprite always carries with it the same info that the detector carries, so it can then do tests based on its own vars, rather than having to keep asking the detector what's going on.

    It'll preserve your object pairing as a matter of course, thanks to the 'row' effect mentioned above, and it's pretty darned quick too

    As an interesting note too:

    If you have 2 of object A, and 10 of object B, and you tell B to follow A (i.e. the many must follow the few), then...

    ...Both A objects will have 5 B objects following them. Interesting, nÚ?

  2. #12
    No Products Registered

    Join Date
    May 2008
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    I still can't get this for some reason, but I don't want to dirty up the article thread with my stupidity, so if you want to take a peek I've outlined what I have in my scene over here -
    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=91652#Post91652
    which is the original thread I opened on the topic before someone linked me to this (great) article.

    As for ObjB->ObjA comment at the end, that is really interesting. Are you saying it automatically divvies up the appropriate amount of following objects for each leading object so the total number on each are equal? Maybe I'm misunderstanding. What happens when you have 9 of ObjB under the same scenario?

    Thank you for your reply! I appreciate how much time people take to help on this forum. I really find the resources included with the editor lacking in clarity and description sometimes.

  3. #13
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    How do you deal with adding and removing objects that are paired at runtime? In my case it usually messed up at that point, so I fell back to loops.

  4. #14
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Posts
    1,027
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    You can still use fast loops to add/delete/re-pair objects as that shouldn't cause any slow down at all.

  5. #15
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    Yeah, one obvious downer with this system is that it eats into your 26 alterable values and however many strings VERY quickly. So in trying to avoid fastloops, your alt vals are suffering.

    Usually, I determine the sprite's action inside an 'Action' string, and just share it across using ALWAYS.

    So then you can do:

    SPRITE: 'Action' = "DIE"
    DETECTOR: 'Action' = "DIE"
    --- Sprite: Destroy
    --- Detector: Destroy

    Something like that.

    ----

    Artician: You're correct, with a many-to-few situation (10 B's follow 2 A's), it would try and divide the many up so that the same number follow each one of A. It's best if we illustrate it with ducks.

    So for 100 Ducklings and 5 Ducks, it would make it so that each Duck had 20 Ducklings following it.

    If you had a number that didn't properly divide (like 9 Ducklings and 2 Ducks), then I think you'd get 5 Ducklings following one Duck, and only FOUR Ducklings following the other.

    I'd have to experiment with it some more

  6. #16
    No Products Registered

    Join Date
    Feb 2009
    Location
    CA, USA
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    Why don't you like fastloops? They're sometimes, well, fast. Don't avoid them. Good article anyways.
    __________________________________________________ __________________

    Fastloops are your friend

  7. #17
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    It's not that I don't like them, it's just that they're not the fastest loop out there.

    I mean, if someone invented a 'Super-fastloop' object which could go a hundred times faster, would you blame me for raving about that new object?

    In this case, simply using object selection is that kind of super fastloop. It's fastloop on steroids.

    For instance, you can process 500 objects in an ALWAYS event and still maintain the 50fps standard rate. Try the same process as a fastloop, and your game will run like a pensioner.

    What I've found is that (in my experience) most people use fastloop where they don't need to, and their framerate suffers the consequences.

    It doesn't mean it serves no purpose - I use F/L for line of sight, obstacle detection, file reading and writing, and of course many application processes which require repetition of a certain function, re-testing of conditions, etc.

    But my point is: Try and avoid using fastloop for simply iterating multiple objects. MMF already comes with a much more efficient system, and in many cases you can adjust a process so that it uses object selection rather than requiring the old 'spread value and loop' procedure.

    Even if doing it by object selection makes the process apparently LESS efficient, it's just so quick that it doesn't matter. I've found that just doing an ALWAYS event for every enemy in the game world can still be faster than narrowing them down and fastlooping through just a few of them.

    So yeah, try and think outside the box and avoid using fastloops when you could use action loops and object selection.

  8. #18
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,734
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    Pensioner? I run pretty fast as one.

    Anyway I agree with you completely Dines.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  9. #19
    No Products Registered

    Join Date
    Feb 2009
    Location
    CA, USA
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    Quote Originally Posted by Dines
    In this case, simply using object selection is that kind of super fastloop. It's fastloop on steroids.
    Steroids are bad. But okay... Thanks for the tip.

  10. #20
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: AI - Basic Principles

    For LOS: I just use a 1px object and shoot it directly at the player. If it hits, the path is clear.

Page 2 of 4 FirstFirst 1 2 3 4 LastLast

Similar Threads

  1. basic iso and pathfinding example
    By Bigfoot in forum File Archive
    Replies: 0
    Last Post: 22nd April 2011, 03:36 PM
  2. Some basic components
    By Ham in forum dotNet Scripting
    Replies: 2
    Last Post: 3rd December 2010, 10:17 PM
  3. Basic Oscillator Example
    By Atom in forum File Archive
    Replies: 0
    Last Post: 15th October 2008, 03:54 PM
  4. Basic Tutorials?
    By Verd0uX in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 18th March 2008, 07:40 AM
  5. Very Basic i know.
    By kayli051203 in forum The Games Factory 2 - Technical Support
    Replies: 4
    Last Post: 18th January 2007, 11:23 AM

Posting Permissions

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