playMaker

Author Topic: Infinite Loop or not?  (Read 1609 times)

Vagus

  • Playmaker Newbie
  • *
  • Posts: 1
Infinite Loop or not?
« on: September 16, 2016, 10:01:31 PM »
Hello everyone! I'm just working through the BadSeedGames Basic AI tutorial on YouTube and got up to Episode 4 (Cone of Vision), https://www.youtube.com/watch?v=PqVXoeriX8Q&index=4&list=PLCFBBA6A7A7BB34F8.

I've copied what the video has done almost exactly, except I've thrown in some "Next Event Frames" into the "In/Out of Range" states that he sets up around the 9:20 mark. Now, it seems to work fine, and the cone of vision for my enemy works when I put it into practice in later tutorials. However, when I look at it in Playmaker, it's cycling around incredibly fast over and over again.

From what I understand, if it were an infinite loop I'd get the "Loop count exceeded maximum: 1000 Default is 1000. Override in Fsm Inspector." error pop up, but I do not and I haven't changed it from the default in the inspector. My question is, if it functionally works and it's not throwing up a bug at me, should I stop concerning myself with the seemingly blindingly fast cycles? It seems to me that it would put a lot of strain on the system.

Thanks for any help in advance, I get the impression I'm asking an incredibly basic question, but just wanted to get the fundamentals down well. Please ask if you need any further information.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Infinite Loop or not?
« Reply #1 on: September 18, 2016, 05:06:35 AM »
The loop resets itself in each frame. you have a next frame action... Take out the next frame and you will have an error. with that setup, it will loop only once per frame.

You can slow it down, if needed, by using wait (wait one second for example) or next frame advance from ecosystem.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Infinite Loop or not?
« Reply #2 on: September 18, 2016, 07:30:06 AM »
Hi,
I would set this up differently (see picture)
be sure to place the "set fsm bool" above the other actions and have every frame turned off, the other actions must be every frame.
(except set the bool to false in "out of vision")