Home   Help Search Login Register  

Author Topic: Urban area's ... obsticles  (Read 1680 times)

0 Members and 1 Guest are viewing this topic.

Clees

  • Guest
Urban area's ... obsticles
« on: 07 Jan 2005, 04:02:26 »
My idea...

The problem with AI in urban combat it that it dose not understand enviroment (its becouse lack of functions which could give you infromation how close it is to the nearest wall etc. - this information could be very, very useful for skilled scripter).

The solution for it can be found - but its quite ... "simple" and a bit "physic".

We have function to create objects. createCamera (or whatever)
We have function to set postion of a object
We have function to get a pice of information of objects current (very importent in my idea) position
And moust importent : we have funtions to set some objects velocity (if im wrong - tell me - but I think yes)

1. We create a object which dose not fall on ground when dropped (zero mass or in other words error in programming ;) )
2. We set position of it very, very near our soldier.
3. We setVelocity of this object in any wanted direction
4. In short periods of time we check position of our "thrown" object.
5. When this object stops (its position dose not change so fast as some time ago) (I hope it stop... dont know ... It should be ... you know) it means - we have an obsticle ... we have its location... we can do with this information whatever we want...

what do you think?

HotShotAce

  • Guest
Re:Urban area's ... obsticles
« Reply #1 on: 10 Jan 2005, 03:32:50 »
umm, basically i didnt understand anything in this post but i do understabd you want AI to move through an urban enviroment right?

this might help :

http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=20876

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Urban area's ... obsticles
« Reply #2 on: 10 Jan 2005, 05:10:02 »
i understand that, could be a very useful function
great idea!

Clees

  • Guest
Re:Urban area's ... obsticles
« Reply #3 on: 12 Jan 2005, 00:39:11 »
Ok... two days ago I wrote simple script to check this idea: here are my observations:

1. We can change velocity only of object of class vehicle which have engine (it's not possible to throw for example a chair - and im not taking here about calculating new position and changing it place by place by setPos - try playcing a object chair named chair1 , a trigger and give in activation chair1 setVelocity [1,0,0] - nothing will happen).

Conclusion :

This script requires a new addon - an invisible (and visible req. during debugging) object of class "vehicle" on which function "setVelocity" can be executed with effect.
« Last Edit: 12 Jan 2005, 00:39:52 by Clees »

Offline XCess

  • Former Staff
  • ****
Re:Urban area's ... obsticles
« Reply #4 on: 12 Jan 2005, 05:16:00 »
Sounds like sonar to me. Wouldn't it be easier to use objects IDs and getPos?

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Urban area's ... obsticles
« Reply #5 on: 12 Jan 2005, 10:43:55 »
Clees:

What you are talking about is a trace, right? You have a starting position and an endpoint, and you move an item along this path until it hits something or reaches the end. This is common programming practice, at least in the Uneal series which i can speak for.

I tried implementing this in a function in ofp using a modified bullet that did no dammage as the trace object. The problem I found was as the function is instantaneous you cant have any delays, and what ever item you want to do the trace with doesn't have time to move along the trace path, before the function finishes. You could try using a script but that would defeat the purpose of an instant function.

I agree, it would be very useful if someone could get it to work! I made a couple of functions to work around this, but they aren't as good as this would be. Be cool if someone could get it to work tho.

HotShotAce

  • Guest
Re:Urban area's ... obsticles
« Reply #6 on: 12 Jan 2005, 13:13:48 »
What I'm trying to understand is what this script will actually do? Can someone explain it to me please. From what I understand its for AI movement in urban areas. Will it be like the urban ai script recently released where your men go to your last position or will your men constantly follow you like in games like full spectrum warrior?

Clees

  • Guest
Re:Urban area's ... obsticles
« Reply #7 on: 12 Jan 2005, 16:30:37 »
To HotShotAce

Not only AI movement in urban areas. This kind of function could return position of real obsicle - very, very useful information. What I mean by this?

Example : In editor You place a house on position [x0,y0,z0]. House is a quite large object (walls, etc.) and takes some space on ground. There is no inprogrammed function which could return you position of single point on the wall of a house (exa. [x0 - 20, y0 - 11, z0]) (a tank, a big box or anything else behind you can hide (you can do it without programming - I hope ;-) - AI cant)

"Will it be like the urban ai script recently ..."

If someone could write script in which this kind of function would be used (to gather information about real enviroment) results would be very, very impressive.

To Fragorl

Yes. I think its called ray-tracing. Yhe, its very common (to be honest Im quite sure it has to be implemented to OFP AI sorce-code - but we dont have access to it ... nevermind).

"... to move along the trace path, before the function finishes ..."

And what about function which execute itself till (it could "kill" cpu) condition is met (for example.. trace velocity more/less zero or else.. better) and then returns its position.
« Last Edit: 12 Jan 2005, 16:31:45 by Clees »

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Urban area's ... obsticles
« Reply #8 on: 12 Jan 2005, 23:17:15 »
@Clees

You're right, there will be something like this in the native ofp code. For instance i think that's how the ai manages urban navigation in actual island towns, and how they keep formation, and how they check for line of sight to other players etc.
What you are talking about is a trace, right? You have a starting position and an endpoint, and you move an item along this path until it hits something or reaches the end.
Actually, this isn't quite right. There is not necessarily any object involved, its more just a mathematical collision check between the trace's position and any overlapping objects.

With any luck since 1.96 is the last(?) patch, Bis will open source at least some of their code, or provide a detailed editor or something. We can only hope.

I don't know about deliberately hijacking cpu time to focus only on your function, but i do know that this pretty much happens anyway if your function loops with 'do...while' whilst waiting for an object to be destroyed or disappear... a really noticeable drop in fps... :P
 
i made a couple of line-of-sight functions to get by this which were purely mathematical. They checked if an ai soldier could 'see' another soldier or object, but the problem was they had to treat ALL in game objects as 1.) the same size, and 2.) as simple geometric objects, i.e a rectangular prism.
« Last Edit: 12 Jan 2005, 23:23:12 by Fragorl »

HotShotAce

  • Guest
Re:Urban area's ... obsticles
« Reply #9 on: 13 Jan 2005, 00:22:24 »
i understand now... simple but effective, hope you can pull it off, thnx for explaining (btw, recent urban script is nothin like this, just positions on map.)

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Urban area's ... obsticles
« Reply #10 on: 14 Jan 2005, 04:42:35 »
this sounds really cool, so I'm workin on it for now.

no promises though!  ::)

Offline Sentinel

  • Contributing Member
  • **
  • World is tough and I'm tougher!!
Re:Urban area's ... obsticles
« Reply #11 on: 14 Jan 2005, 23:19:39 »
I came up with an idea of listing dimensions of most common houses (are there that many house types  ???) and use that as a database. Then it would be needed to define ai that those areas where the houses are, aren't passable (or a point to move).

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Urban area's ... obsticles
« Reply #12 on: 15 Jan 2005, 01:30:36 »
the idea i had was using OFPs clipping problems to find objects

sending 8 invisible things out a 45 degree intervals and move em out until the move i set them at isn't where they are.

using while..do to loop it and getpos/setpos to move the object outward

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Urban area's ... obsticles
« Reply #13 on: 15 Jan 2005, 05:23:43 »
@Sentinel
I might be able to incorporate the house sizes into my function(s) perhaps, if you gave me the dimensions relative to the direction of the house

@Triggerhappy
Did it work?

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Urban area's ... obsticles
« Reply #14 on: 15 Jan 2005, 17:17:17 »
haven't finished it yet, i haven't found anything that will clip (i tried sticking a gamelogic in a building and used hint format to tell the pos and it didn't move)

i suppose a bullet would work, but i'm not sure how to camcreate one