playMaker

Author Topic: Rigidbody Movement  (Read 2546 times)

404 FxZe

  • Playmaker Newbie
  • *
  • Posts: 2
Rigidbody Movement
« on: November 01, 2021, 08:51:19 AM »
This is a little project i started today where i made a rigidbody based character controller in Playmaker. Happy to share FSM's and Prefabs if people are interested!



<iframe width="560" height="315" src=" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Rigidbody Movement
« Reply #1 on: November 04, 2021, 08:35:02 AM »
If you put all the input gathering in a single state, you will probably occur into problems when the player will want to crouch and jump at the same time, or to run forward and strafe left at the same time... or at least, I don't know how to deal with that in a single state. I do a FSM for each button to get around this.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Rigidbody Movement
« Reply #2 on: November 04, 2021, 04:54:40 PM »
If you put all the input gathering in a single state, you will probably occur into problems when the player will want to crouch and jump at the same time, or to run forward and strafe left at the same time... or at least, I don't know how to deal with that in a single state. I do a FSM for each button to get around this.

You can use Run Fsm Action with Templates :)

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Rigidbody Movement
« Reply #3 on: November 05, 2021, 04:36:19 AM »
If you put all the input gathering in a single state, you will probably occur into problems when the player will want to crouch and jump at the same time, or to run forward and strafe left at the same time... or at least, I don't know how to deal with that in a single state. I do a FSM for each button to get around this.

You can use Run Fsm Action with Templates :)

Mmmm does that help somehow in terms of readability and/or performance?
I mean, is there a reason to call a template instead than having the FSM already attached to the object?

Honestly, attaching those 6 or 8 FSMs to the object up to now worked like a charm for me.
So at this point, my only concern is performance.
I didn't test, but considering that the input gathering is only performed once in the scene, and in my case only for few inputs, it only means makes up for less than 10 FSMs, so I don't think this should affect the performance that much.
« Last Edit: November 05, 2021, 04:52:10 AM by PolyMad »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Rigidbody Movement
« Reply #4 on: November 05, 2021, 08:26:58 AM »
Hi.
Performance wise it might not matter in a build, depending on your setup.

For editor it can be better performance (especially in pm version 1.9.0 and below) and readability.

In our game, for our player I did not use much run fsms yet as when i started on him 3 years ago i did not have a lot of knowledge of the power from a Run Fsm.

on our enemies i use a lot of run fsms now.

For example, I have a fsm for behavior (patrol, attacks, got hit, stunned etc)
on my patrol state I have a template to do the standard patrolling, then a template to detect player (and send a attack event when player in range) in front
and a detect player behind.

These only need to happen during patrol and in some other cases (double attacks/ combo attacks).

if i would use a separate fsm, i would need to send a start/stop event to the detection fsms as they should not keep detecting since they use boxcasts(raycasts)
and if you have many enemies doing those i can start to have lag.

With a Run Fsm I can just place it on the states that need the detection, also i can re-use them on other enemies.

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Rigidbody Movement
« Reply #5 on: November 05, 2021, 08:46:30 AM »
Great, thank you.
3 years development?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Rigidbody Movement
« Reply #6 on: November 05, 2021, 08:53:42 AM »
Hi.
Yes our Dark Light Project is now close to 3 years (we are only a small team of 3)
But we should be able to do a full release early next year.

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Rigidbody Movement
« Reply #7 on: November 06, 2021, 05:51:03 AM »
I really hope so, man!  ;D