Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: a different approach to AI waypoints  (Read 349 times)
Dragoon
Community Member
*
Posts: 385


« on: July 14, 2008, 06:27:42 PM »

hrrm, recently I mad a C++ waypoint manager ( we had to create a game in Ogre)
I don't know how TV3D goes about waypoint management, but here's my 'creative' and probably 'over-done-use-as-little-memory-as-possible' approach

imagine a situation with 3 waypoints
A: (10,0)
B: (0,10)
C: (10,10)

I'd store those locations in a struct (1 per waypoint)

then, for the 'connections' between the waypoints (to create actual paths)
I use a set of bits.
I'd allocate 3*3 bits and assign 3 bits to every waypoint.

so I'd have

A: (10,0)  000
B: (0,10)  000
C: (10,10) 000

now, if we'd want a connection  A -> B, B -> C, and C -> A
I would end up with this.

(1st) A: (10,0)  010
(2nd) B: (0,10)  001
(3rd) C: (10,10) 100

this example shows, that the first bit represents wether or not the waypoint is connected to waypoint A, the second with waypoint B, 3rd = C, etc.

resulting in needing only 9 bits (just over 1 byte) for keeping track of 'all' the connections in your '3 waypointed' world

just thought I'd share this, 'creative approach' to waypoint management.
not that you'll probably need it with today's gigabyte size memory Roll Eyes

if anyone is interested, I'll try to find a host, and upload the C++ source to all this madness.  Wink
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks