Author Topic: Generic Gamemode Help (Formerly: Creating AIPlayer Movement)  (Read 4385 times)

I am currently working on a flat area, but plan to expand this to something that would require pathfinding, so preferably what i need is anything that can make a bot find it's own way over basic terrain, although standard 'making him realistically move to a tile' is fine. The gameboard is covered with 4x4f bricks that is the basis of the positions the bots can assume.

This is a very rough idea of what the gamemode will be and I'm trying to get the basics down.

http://puu.sh/gJmei/ce2dd0e0e7.png

Also, how would I go about making him rotate to one of the values on the Z axis - 0, 90, 180, 270 believably.
« Last Edit: April 05, 2015, 05:20:30 AM by Dannu »

Code: [Select]
datablock fxDTSBrickData (BotTileBrickData)
{
brickfile = "./shapes/BotTile.blb";
category = "Special";
subCategory = "Bot Wars";
uiName = "Bot Tile";
iconName = "Add-Ons/Gamemode_Bots/shapes/4x4fBot";
};


//function fxDTSBrick::onActivate(%brick, %obj, %client, %pos, %dir)
//{
//
//}  DEPRECIATED

function fxDTSBrick::onActivate(%brick, %obj, %client, %pos, %dir)
{
if(%brick.getDatablock().getName() !$= BotTileBrickData)
return;

if(isObject(%client.activeTroop))
{
if(%client.activeTroop.activeBrick $= %brick)
{
%client.activeTroop.delete();
return;
}

//MOVEMENT CODE HERE
return;
}

%client.activeTroop = new AIPlayer(){datablock = playerstandardarmor; position = %brick.getPosition();};
%client.activeTroop.activeBrick = %brick;
}

How large will the final arena be?  Will the final arena be static or dynamic?  Do they need to be capable of three-dimensional movement (e.g. crouching and jumping) through the arena?


Also, to rotate the bot to a given angle, use %bot.setTransform(%bot.getPosition(), "0 0 1 "@%angleInRadians); - a radian is about 57 degrees, so divide 0, 90, 180, 270 by 180 / $PI to get that value in radians.

%bot.setTransform(%bot.getPosition(), "0 0 1 "@%angleInDegrees/(180/$PI));
« Last Edit: March 21, 2015, 10:47:06 AM by Xalos »

The area will be a playing board that is previously created so static and may possibly be quite large.
Jumping will be required.

As to rotating, is it possible to create a more realistic rotation like a player would.

The bots should have a possibility of finding a path over an obstruction too high to jump over. The only thing I have found is Port's A* search algorithm, but that requires creating Node Paths across the entire movable terrain, which isn't optimal. Also, I never quite learned how to use it.

I could easily create a script that automatically adds and removes nodes when bricks are added; the problem is that creating a movement map both around and OVER obstacles is less trivial.  As long as the arena is static, it would probably be easiest to create the pathing nodes yourself - any three-dimensional map like a skyscraper would be hard to automatically make a node map for.

To make a bot rotate under its own power, use %bot.setAimLocation(%Point3F); or %bot.setAimObject(%object);
To have more control over a bot's rotation, go back a few revisions and use an AIConnection.

Wasn't AIConnection depreciated?

Also, the map under question is quite flat, it's terrain and mostly only offers vertical challenges. Also, my movement question wasn't answered.
« Last Edit: March 21, 2015, 01:05:07 PM by Dannu »

Wasn't AIConnection depreciated?
Hence the
go back a few revisions
part

It was a sort of sarcastic comment
also the term is 'deprecated'

Oh, I completely missed that one.. heh.



This depends entirely on what you want the bot to do. What obstacles could the bot run into? Judging by your picture, the area is flat, so you could just make it jump when it runs into something, assuming its a player/bot. If there will be pillars in the way, you could do a sort of dynamic detection, by firing a few raycasts in front of it and just making the bot turn away from obstacles. The question isn't how to do it, its how you want it to be done.

Currently, as I am trying to get the barebones to work, just the standard functions and common methods to make AIPlayers move.

Then do .dump(); on an AIPlayer. There's a bunch of functions to control them.

Now that I have a hexagon brick, I can dust off this project and continue work on it.. just to hit a ditch. (Major thanks to LeetZero)

http://forum.blockland.us/index.php?topic=276652.msg8235216#msg8235216

My question:

How do I find the shortest path from a brick to a brick, check for each certain value that's inherent to the brick that describes the movement value necessary to cross that distance and just take it from there?

My question:

How do I find the shortest path from a brick to a brick, check for each certain value that's inherent to the brick that describes the movement value necessary to cross that distance and just take it from there?

You can look at Slayer's (very limited) implementation. It's using a modified version of Port's A* script temporarily.

Support_Pathing <- This contains the pathfinding scripts.
AiPlayer.cs <- Player-related functions - spawning, etc.
AiController.cs <- temporary AiConnection replacement
Slayer_AiController.cs <- Slayer-specific AiController - handles AI objectives
Slayer_PathHandlerSG.cs <- Manages the node system
« Last Edit: March 26, 2015, 03:20:12 PM by Greek2me »

I looked at that, and looked.. and then some, but I never understood the basic concept of putting it to use.