playMaker

Author Topic: FSMs stop working as game progresses  (Read 4209 times)

dshad44

  • Junior Playmaker
  • **
  • Posts: 55
FSMs stop working as game progresses
« on: August 24, 2017, 09:27:07 PM »
I have a few objects with working FSMs on them. I know they work because they do exactly what they've been designed to do for the first half of the game. They are essentially supposed to blow up when they reach the bottom of the screen  (think tetris).

As the game progresses, the objects stop blowing up. It takes about a minute or two for the FSMs to stop working. I can see that the floor trigger is still sending events to the objects, and the objects are receiving them.....it just...stops doing what it is supposed to do.

Has anyone experienced this before?

I'd like to get some fresh ideas before I start saying what I THINK the problem is, so that I don't lead the topic in the wrong direction.

Thanks in advance!

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: FSMs stop working as game progresses
« Reply #1 on: August 24, 2017, 10:58:21 PM »
No, I havent seen this before? Console errors? FSM stuck on a specific state? FSM coding issues?

dshad44

  • Junior Playmaker
  • **
  • Posts: 55
Re: FSMs stop working as game progresses
« Reply #2 on: August 24, 2017, 11:56:54 PM »
Thanks for the response!

I'm not sure if it would be a console error. How would I find out if it is? I'm just running the game on my PC since I haven't done a published test yet.

My guess is that the object is receiving too many signals at once and can only execute one at a time. Is that a thing in Unity/Playmaker?

If so, how can I get it to observe mutliple message? I tried setting the FSMs to Action Sequece, but it still behaves the same.

plinm

  • Playmaker Newbie
  • *
  • Posts: 25
Re: FSMs stop working as game progresses
« Reply #3 on: August 25, 2017, 04:36:28 AM »
@tcmeric means the Unity "Console", which is a window in Unity outputs information for debug purpose, if you wrote Unity scripts before, the it would be

Code: [Select]
Debug.Log("A example message")
If you don't have it open, you can enable it by "Window => Console".

Back to your problem, did you destroy the game objects after they "blow up"? If not, as game runs, eventually you will have a huge number of active game objects await for events.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: FSMs stop working as game progresses
« Reply #4 on: August 25, 2017, 01:52:08 PM »
Hi,
Can you show the fsms/states/actions,
maybe there is a infinite loop or 1000+
in many cases also there is a next frame event needed, depending on your project.

dshad44

  • Junior Playmaker
  • **
  • Posts: 55
Re: FSMs stop working as game progresses
« Reply #5 on: August 25, 2017, 03:58:46 PM »
Ah I see. The only errors I see on the Console are the ones that have to do with me using a flat plane as a part of my object.

Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported in Unity 5.
If you want to use a non-convex mesh either make the Rigidbody kinematic or remove the Rigidbody component. Scene hierarchy path "Mlt Ch 3 Bm Rt(Clone)/Right Bomb/CherryBomb01_wMat (2)/3Bm Right Rt Plane", Mesh asset path "Library/unity default resources" Mesh name "Plane"

It doesn't like that I'm using a plane to display an image.

I'll get the FSM images up shortly so that you can take a look at them.

dshad44

  • Junior Playmaker
  • **
  • Posts: 55
Re: FSMs stop working as game progresses
« Reply #6 on: August 25, 2017, 04:18:25 PM »
This is the floor trigger. It tells the different objects that come in contact with it to explode and reduce health from the player. It also creates two sound effects.

It tells the objects (which are bombs) to explode by sending the event 'Hit Bottom' when they hit the floor trigger.

There are six total objects that can hit, so each has its own Send Event.
« Last Edit: August 25, 2017, 04:22:17 PM by dshad44 »

dshad44

  • Junior Playmaker
  • **
  • Posts: 55
Re: FSMs stop working as game progresses
« Reply #7 on: August 25, 2017, 04:27:41 PM »
This is the bomb FSM. It waits in idle while moving down slowly until it receives input.

1. It can be clicked on which will trigger the event Explode.
2. It can be told by another object that it wasn't selected, so trigger the event Not Picked.
3. It can hit the Floor Trigger, so trigger the event Hit Bottom.

When it isn't selected, it transitions into an empty state so that it can't be picked anymore (if the player chooses the wrong answer, I don't want the player to then go and pick the right answer afterwards). The empty state has a Hit Bottom transition for when it eventually collides with the Floor Trigger.

dshad44

  • Junior Playmaker
  • **
  • Posts: 55
Re: FSMs stop working as game progresses
« Reply #8 on: August 25, 2017, 04:28:20 PM »
At the end, all objects destroy themselves.

dshad44

  • Junior Playmaker
  • **
  • Posts: 55
Re: FSMs stop working as game progresses
« Reply #9 on: August 25, 2017, 04:32:00 PM »
All bombs live in a container. The container is what the Floor Trigger talks to when the bombs hit the bottom.

dshad44

  • Junior Playmaker
  • **
  • Posts: 55
Re: FSMs stop working as game progresses
« Reply #10 on: August 25, 2017, 04:38:16 PM »
The bomb containers are called Multiple Choice 1 Bomb, Multiple Choice 2 Bombs, and Multiple Choice 3 Bombs.It has the Left, Middle or Right append at the end of the name so that I know which one of the bombs is the correct one. The shortened names I use look like this:

Mlt_Ch_1Bm_Mid
Mlt_Ch_2Bm_Lt
Mlt_Ch_2Bm_Rt
Mlt_Ch_3Bm_Lt
Mlt_Ch_3Bm_Mid
Mlt_Ch_3Bm_Rt

Inside those containers, all bombs have the same names:

Left Bomb
Middle Bomb
Right Bomb

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: FSMs stop working as game progresses
« Reply #11 on: August 26, 2017, 12:03:57 AM »
Hi,
from the states you showed i can't really see an issue,
But i did notice you using a wait 0.1, instead you can use a 'next frame event' unless you really want it to be 0.1 seconds.

Also you use a lot of create objects which is heavy for cpu maybe you should look into pooling
and for the sound you could have a "sound manage"
(Have a fsm with several sound effects and use global transitions to trigger sounds)

When you play the game and it stops working does it give errors then?

if it stopped working, pause the game (don't stop)
and check if there are fsms that does not have a highlighted state.

This video can help you debugging :


and this video can help you with global events/transitions


dshad44

  • Junior Playmaker
  • **
  • Posts: 55
Re: FSMs stop working as game progresses
« Reply #12 on: August 28, 2017, 02:55:04 PM »
Great! Thanks for the videos. I'll probably invest in Pooly after I try out a few things.
I've noticed that at question number 23, my objects stop working. Even if I use a cheat node to START THE GAME at number 23, it will still fail (from that question forward). I've tried rebuilding that node. I've tried rigging the game to go to question 1 again once it reaches question 23 to see if it would fail (despite the fact that question 1 worked at the beginning) and it DID fail!

I'm so stumped!

Another question is, does lighting slow the game down too? I set my lights to mixed lighting.

Thanks again guys!
« Last Edit: August 28, 2017, 02:57:49 PM by dshad44 »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: FSMs stop working as game progresses
« Reply #13 on: August 28, 2017, 11:23:37 PM »
Hi,
Dynamic Lighting can be heavy especially for mobile, many games use bakes lighting.
Try google 'for unity lighting for mobile' or 'unity baked lighting' or something like that.

dshad44

  • Junior Playmaker
  • **
  • Posts: 55
Re: FSMs stop working as game progresses
« Reply #14 on: August 30, 2017, 05:56:17 PM »
Well, from what I've seen so far and tried, baked lighting looks absolutely terrible. It seems to be what mobile games use so I guess I just have to deal with it. It's a shame, because the difference between realtime and baked is huge, despite using a minimal lighting setup.

As for Next Frame Event, it doesn't have any effect on what I do, so I'm unsure of what it's supposed to do. The tutorials show that it's supposed to allow the game engine to finish one set of commands, before moving on to the next state and start a new set of commands. Is this the case?

Either way, my game objects still break despite working just fine before. I don't understand why it would be so unstable.

I'll try adding the pooly technique now. If that doesn't help, then I'm stuck on a desert island.
« Last Edit: August 30, 2017, 05:57:51 PM by dshad44 »