News Forums RAIN General Discussion and Troubleshooting FPS Control throws assert with newer versions of Rain

This topic contains 5 replies, has 2 voices, and was last updated by  vamuse 1 year ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #39222

    vamuse
    Participant

    I downloaded the FPS control:
    http://www.fpscontrol.com/
    and it worked ok (the enemies don’t shoot, but I’ll cross that bridge when I get there).
    However, it’s running in Rain version 2.0.6.0. When I try to run it with the latest version of Rain it throws this error:

    Assets/AI/AI/AttackHarness/AIUpdateAttackPosition.cs(47,35): error CS1501: No overload for method `OnGraph’ takes `1′ arguments

    Deleting the AIUpdateAttackPosition script makes it throw the same error on a different script in the same directory so I got rid of the entire folder and the assert was gone. But I’m fairly certain I need this script for the AI to behave properly. Any suggestions on how I fix this problem?
    Thanks!

    P.S, if you happen to figure out why the enemies aren’t shooting I’d really appreciate that too!

    Here’s the script:

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using RAIN.Core;
    using RAIN.Action;
    [RAINAction("Update Attack Position")]
    public class AIUpdateAttackPosition : RAINAction
    {
        public AIUpdateAttackPosition()
        {
            actionName = "AIUpdateAttackPosition";
        }
        public override ActionResult Execute(AI ai)
        {
    		AttackHarness attackHarness = ai.WorkingMemory.GetItem<AttackHarness>("attacktargetharness");
    		AttackHarness waitHarness = ai.WorkingMemory.GetItem<AttackHarness>("waitharness");
    		if ((attackHarness == null) && (waitHarness == null))
    			return ActionResult.FAILURE;
    		AttackHarness harness = null;
    		int slot = -1;
    		if ((attackHarness != null) && (ai.WorkingMemory.ItemExists("attacktargetharnessslot")))
    		{
    			harness = attackHarness;
    			slot = ai.WorkingMemory.GetItem<int>("attacktargetharnessslot");
    		}
    		if ((harness == null) || (slot < 0))
    		{
    			if ((waitHarness != null) && (ai.WorkingMemory.ItemExists("waitharnessslot")))
    			{
    				harness = waitHarness;
    				slot = ai.WorkingMemory.GetItem<int>("waitharnessslot");				
    			}
    		}
    		if ((harness == null) || (slot < 0))
    			return ActionResult.FAILURE;
    		Vector3 attackpos = harness.GetAttackPosition(slot);
    		ai.WorkingMemory.SetItem<Vector3>("attackposition", attackpos);
    		ai.WorkingMemory.SetItem<bool>("run", false);
    		if (!ai.Navigator.OnGraph(attackpos))
    			return ActionResult.FAILURE;
    		float distance = (attackpos - ai.Body.transform.position).magnitude;
    		if (distance > 2.5f)
    			ai.WorkingMemory.SetItem<bool>("run", true);
    		return ActionResult.SUCCESS;
        }
    }
    #39225

    Sigil
    Keymaster

    Yea, unfortunately FPS control is pretty far back in versions. I can work with you to fix your issues, but it’ll have to be case by case as you run into trouble.

    So the exception is telling you that it recognizes the function OnGraph, but that the number of arguments are wrong:

    ...
    if (!ai.Navigator.OnGraph(attackpos))
        return ActionResult.FAILURE;
    ...

    So at some point the code changed and it requires an additional argument (MaxYOffset). It used to have a default, and will again in the next version, but that’s besides the point, just pass in 0 for it.

    ...
    if (!ai.Navigator.OnGraph(attackpos, 0))
        return ActionResult.FAILURE;
    ...

    You’ll need to do that for every exception referring to OnGraph.

    #39232

    vamuse
    Participant

    Thank you so much for the quick response. And thank you for being willing to help me through problems as they arise! I’ll make that change and let you know how it goes.

    #39241

    vamuse
    Participant

    So I made the changes you suggested and it cleared out the asserts! Thank you! But now when I run the game, not only do they not shoot like in the old file, but they don’t move or anything (they’re animating, but they aren’t walking the route). I have a waypoint route, a navmesh, I even went through and recreated every node from the behavior tree by hand into my project and the AI doesn’t function. Looking at the behavior tree it doesn’t seem to work past the root node. Do you think you could possibly take a look? Heres the project:

    https://drive.google.com/folderview?id=0B5lwR1OhWJTNYWZlb3RQTDVFTm8&usp=sharing

    Thanks in advance!

    #39260

    Sigil
    Keymaster

    Well I went ahead and took a look at it… and at this point I’d say it’s a lost cause. By this I mean that your time is better spent starting over then trying to get what is in FPSControl up to date.

    The behavior trees are out of date, so they won’t work without changing a good portion of them. In the original FPSControl scenes the AI is completely unbound and likely the original data lost so it isn’t coming back. The animator is also out of date, or at least not as good as it could be with the latest Unity and mecanim. And honestly, even the AI that is in the scene is over complicated, and can be done a lot better with the modern version of RAIN.

    If at some point FPS Control is revisited (it isn’t our project though), it could be fixed, but I can’t take this on, and I don’t think it is worth your time. Use the models, buildings, etc but rework the animation on the shock trooper, and take a look at our starter kit to start reworking the AI from scratch. It will take you less time and get you better results in the long run.

    There is also Squad Command, but I realize that it isn’t free, and it doesn’t necessarily offer everything that FPS Control has.

    #39267

    vamuse
    Participant

    I understand, Thank you so much for trying to help!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.