playMaker

Author Topic: Game stalls as non-player perches on top of objects  (Read 3875 times)

prattfall

  • Playmaker Newbie
  • *
  • Posts: 19
Game stalls as non-player perches on top of objects
« on: March 18, 2014, 08:53:27 AM »
I have a non player object which is searching for other objects of various kinds. It is now working in principle, but after some random point, it finds itself on top one of the objects instead of handling it in the usual way. Surely it should be registering as a collision (as it does perfectly well when it collides along side). I tried increasing the other-object's collider slightly to make sure of this, but the damn non-player object just sits on top the thing, stuck. Anyone know what's going on or a way to deal with this? (PS I don't really understand how it gets up there in the first place, since I'm just moving it around on the xz plane!)
« Last Edit: March 18, 2014, 08:55:26 AM by prattfall »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Game stalls as non-player perches on top of objects
« Reply #1 on: March 18, 2014, 08:59:35 AM »
Hi,

 can you show a screencast or something? mabye also describe what is the usual way will help too.

bye,

 Jean

prattfall

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Game stalls as non-player perches on top of objects
« Reply #2 on: March 18, 2014, 05:00:25 PM »
Sorry, and thanks for the response. It's a really basic set up that I'm using to learn this. There's a sphere which rolls around looking for cubes (roughly the same size as the sphere). When it finds a cube, it eats it - i.e. the cube instance is destroyed and a "Full" variable incremented. But now and again - on average after about 10-15 cubes - it finds itself exactly on top of a cube, just spinning on the spot. More rarely, it finds itself exactly under the cube (both the same x,z pos). This cube is the sphere's highest priority, and because it's somehow unable to eat it, it gets stuck.

Update: I had "ignore vertical" checked in the "Move Towards" action. Unchecking this stops the perching but causes a more complicated sticking, in which the sphere and cube jostle unsatisfactorily.

The searching for cubes uses an arraymaker list proxy, making the closest cube highest priority. (This is overly complicated at the moment, for reasons further down the line.) The eating of cubes is three actions: destroy object; send event (re the "Full" variable) and Array List Remove (to delete the eaten cube from the array).

prattfall

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Game stalls as non-player perches on top of objects
« Reply #3 on: March 19, 2014, 07:54:22 AM »
Update: now I have unchecked "ignore vertical" in the Move Towards action, the problem seems more to do with some failure in the collision processing. The sphere generally pushes a cube along.

This is the Search for cubes state: Array List Get Closest Game Object; Move Towards (sending an event on finish). That event transitions to eating the cube - Destroy Object etc. I've tried adding Collision Event after Move Towards, but this didn't make any difference.

prattfall

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Game stalls as non-player perches on top of objects
« Reply #4 on: March 19, 2014, 07:02:10 PM »
Here's a screencast. I'm just laying down these cubes. The problem occurs towards the end, where the sphere nudges one cube off screen. It's in collision, so it should destroy the cube.

http://www.flickr.com/photos/120865053@N02/13276383714/

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Game stalls as non-player perches on top of objects
« Reply #5 on: March 25, 2014, 12:39:32 AM »
Hi, odd indeed.

I think it's more a problem of enforcing the height of your sphere. can you constraint physically the sphere so that it can not move in height.

-- can you change the rigidbody set up to be more precise? typically switch interpolate to "interpolate" and Collision detection to "continous dynamic".

-- also it' simportant to understand what exactly is going wrong as well, do you have "while in this stuck state" any fsm running, can you pause and make sure that all fsm are actually doing what they suppose as opposed to being in a state that indicates a problem earlier in the process?

bye,

 Jean

prattfall

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Game stalls as non-player perches on top of objects
« Reply #6 on: March 29, 2014, 07:45:49 AM »
Thanks very much for your response. I haven't had a chance to work on it this week. I did actually try constraining the Y axis and the ball stopped moving altogether. I will try the other options you mention. (Problem compounded by the fact that I'm learning behaviour trees and the ball has currently stopped doing anything at all!) I'll post again when I've got that side of things sorted. Thanks again!

prattfall

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Game stalls as non-player perches on top of objects
« Reply #7 on: April 21, 2014, 07:56:48 AM »
I'm really struggling here. I've been away from this for a while and tried reconstructing the thing from scratch. (I've given up using Behaviour Trees until I've got this other stuff sorted.)

The entire thing is not working logically at all, to the point where I don't trust the debug information.

For instance, can someone explain this:
When a food object appears, it triggers into the state I want correctly. This state does the following, in order:
1. Find closest (tagged "food" storing the result in "priorityObject")
2. Move towards (Target object "priorityObject")

What happens is, the food appears. The agent starts moving towards it. However, debug shows priorityObject is null. How then, please, is it moving towards it??? It then hits the food object, whereupon priorityObject is assigned to the food object. And as before, instead of destroying it, it simply nudges it along.

Surely there is something wrong with the debug here? (Incidentally, another thing I've noticed, in the debug log window, it says it's supposed to show the values of the variables at the particular state you have selected, but in mine it only shows the current values, no matter what state I have selected.)

Any help please, because I'm close to throwing in the towel.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Game stalls as non-player perches on top of objects
« Reply #8 on: April 21, 2014, 07:59:04 AM »
Can you post the scene or some screenshots?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

prattfall

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Game stalls as non-player perches on top of objects
« Reply #9 on: April 21, 2014, 08:11:55 AM »
The screenshot is the same as the one I've already posted above, except only one food object.

Also, if I store the distance in the Find Closest action, the distance of the food objects is showing correctly, even though the store object is still null! Surely this must be an error in the programme?
« Last Edit: April 21, 2014, 08:28:18 AM by prattfall »

prattfall

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Game stalls as non-player perches on top of objects
« Reply #10 on: April 21, 2014, 09:24:17 AM »
Okay, here's another screencast.

https://www.flickr.com/photos/120865053@N02/13971952783/

I solved the problem of the object assignment. (It was being unassigned by another FSM.)

However, here, you can see the Destroy Object action taking the correct value, but obviously not destroying the object.