Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsShowcase → sodium pathfinding robots
sodium pathfinding robots
2006-01-21, 3:04 PM #1
i implemented pathfinding into sodium engine for a project for class (had to apply something we learned in AI).

Download (987kb):
http://binarydemons.com/~strike/files/pathfind_test.zip

Note: If your JK directory does not match c:\Program Files\Lucasarts\Jedi Knight
then please modify script.ss. Otherwise, you should just be able to unzip and run.


Screenshot (with 200 pathfinding bots. The download has 5. You could modify the script though...)
[http://binarydemons.com/~strike/files/pathfind.JPG]


Screenshot of the ai path nodes that are built using sector adjoins
[http://binarydemons.com/~strike/files/linkedpathnodes.JPG]
[ B A H ]
Bad *** by nature,
Hackers by choice
2006-01-21, 3:06 PM #2
your stuff looks awesome, but please please telll me what this stuff is actually for?

Can u improve the general engine for mods and levels, if so, hook me up my good man, and I will pay you handsomely*

*payment in the form of pictures of johnny Depp.
Code:
if(getThingFlags(source) & 0x8){
  do her}
elseif(getThingFlags(source) & 0x4){
  do other babe}
else{
  do a dude}
2006-01-21, 11:40 PM #3
Currently you could consider it sort of a JK clone, in that it will load many of JK's resource files such as textures, models, levels, and others.

What I'd really like is to create a complete game with a small team of 2 or 3 people, and allow others to mod it or use the sodium engine to customize the game completely to their mods' needs.

If anyone is genuiously interested in any of the following, leave a post with your aim or msn:
- creating / maintaining a project page
- engine development / coding C++
- gameplay development / scripting (sodiumscript is very similar in syntax to COG)
- art / textures
- art / models
- art / levels

Sodium using custom textures and built-in skybox support
(Lighting is a bit screwed up, I've been messing with the vertex light calculation)
[http://binarydemons.com/~strike/files/puresodium.JPG]
[ B A H ]
Bad *** by nature,
Hackers by choice
2006-01-22, 12:44 AM #4
So wait, this is like a new engine using JK resources?
SnailIracing:n(500tpostshpereline)pants
-----------------------------@%
2006-01-22, 2:01 AM #5
I don't quite fully grasp the concept, but that sure is pretty, what with all the colors and all.

So how many of JK's resources will work in this engine?
"Well ain't that a merry jelly." - FastGamerr

"You can actually see the waves of me not caring in the air." - fishstickz
2006-01-22, 3:33 AM #6
Quote:
So wait, this is like a new engine using JK resources?

Right now yeah, more or less. Later I hope to create enough of my own custom tools that it is a complete package, but right now JK (more importantly: JK's fan-created editing tools) are going to guide the project along.


Quote:
I don't quite fully grasp the concept, but that sure is pretty, what with all the colors and all.

So how many of JK's resources will work in this engine?

The solid green lines are the projected path for an AI object (the robots). A solid red line is the current 'path node' for the bot. The blurry color effects are just particle emitters that were easy to hook up and look cool lol.


As for the supported file formats:
- jk models .3do (with full support for model hierarchy)
- jk animations .key (not done yet, but it animates keyframes on models)
- jk levels .jkl (mostly done, still working on visibility determination. doesnt load things)
- jk colormaps .cmp (for converting 8-bit textures)
- jk materials .mat (8-bit, 16-bit both 565 RGB and 1555 ARGB. solid color textures, multi-cell textures, mipmapped textures, and transparent textures are all supported)
- jk container .gob (self explainatory.. can load files from within .gobs)
- sodiumscript .ss (proprietory scripting language, very similar to but more powerful than COG - includes full support for strings, user-defined functions, recursion, local variables, user-defined callback functions)

Using (or supporting) many of jk's file formats such as 3do, key, and mat should be pretty easily to maintain for the life of the engine. Levels, however, are a different story. There are a couple possibilities I have in mind:
- modify JED and customize for sodium's needs
- create a JED plugin that extends the capabilities of JED for sodium's needs
- create a custom level editor (not likely any time soon lol - I hope to later on..)
[ B A H ]
Bad *** by nature,
Hackers by choice
2006-01-22, 9:42 AM #7
Sign me up.
AIM - DPatMassassi

Looks good, and I'd go with creating your own custom level editor, and I could help you with the layout, interworkings, tools, and coding. As you know, I have some C++ codin skills. I can help with engine development, and I like to think of myself (with my inflated ego n all, as Massassi knows me to be) as a master cogger, therefore I should be able to use Na script good. Plus I'm an okay modeler too. ;) :p :cool:
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2006-01-22, 3:10 PM #8
Well, I'd help with coding, but I don't have much time availiable to me. I could possibly help with debugging or some coding areas as time permits.

I won't be signed into my aim for a bit, so I won't post it for now.
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2006-01-22, 4:23 PM #9
If in the event you want to help, aim me chickenshtstrike
[ B A H ]
Bad *** by nature,
Hackers by choice
2006-01-22, 4:46 PM #10
Quote:
Screenshot of the ai path nodes that are built using sector adjoins


Could you explain how you're doing that?
Historians are the most powerful and dangerous members of any society. They must be watched carefully... They can spoil everything. - Nikita Khrushchev.
Kill one man, and you are a murderer. Kill millions of men, and you are a conqueror. Kill them all, and you are a god. - Jean Rostand.
2006-01-23, 2:27 AM #11
Here's a simplified, but complete, pseudo-code form of the pathfinding node generation code:

Code:
// creation phase:
// create enough path nodes for every adjoin (actually only half, because
// an adjoin has two sides, but it is still only one position)

allocate (numLevelAdjoins / 2) of path nodes

for every path node
   for every adjoin in the level
      if the adjoin's mirror has already had a node initialized for it, skip to next adjoin
         otherwise
      initialize the current path node, and set its position to the center
      of the current adjoin's surface
   next adjoin
next node

// linking phase:
// since each sector (or cell) is convex, that means any adjoins that are part of the
// same cell are 'linked', ie: you can travel from one adjoin in a sector to another
// adjoin. Geometrically, there can be no other sectors or surfaces blocking the
// path.

for every sector in the level
   for every adjoin in the current sector
      find the path node that is located at the current adjoin,
      and add a reference to it for the current sector
   next adjoin

   // we now have a list of all the path nodes in the current sector.
   // simply each one to each other, being careful not to link one to itself
   for every path node in the sector 'pathnodeA'
     for every path node in the sector 'pathnodeB'
       if pathnodeA is not pathnodeB, link them to each other
     next path node 'pathnodeB'
   next path node 'pathnodeA'
next sector


From here, the actual pathfinding code is pretty easy as long as you know which sectors the beginning and end points of the path are. This is a level-traversal stage of pathfinding. It can find a path from any position to another in a level, through doorways and windows. What I would really like to shoot for next or at some point later down the line is another layer of pathfinding that is planned for an object within a sector - taking into account things such as doors or barricade 3dos that may be there.

I've been thinking about creating a 3d collision map out of the current sector and its contents, like a 3d box just big enough to contain the sector but filled with packed spheres, each sphere can be 'collidable' or 'non-collidable'. One of these conceptual spheres would be flagged as collidable if it happens to collide with a surface of the sector or with a thing in the sector. A conventional pathfinding algorithm (such as A*) could then be performed using this 3d collision map, with each sphere flagged as non-collidable being a path node.

The result of this would give VERY high quality and sophisticated paths, and could potentially take into account factors such as the character's height, ability to traverse difficult terrain, ability to fly, ability to swim. The best part, as far as performance is concered, this type of method would be utterly scalable, as the collision map's sphere size and count would just have to be adjusted to generate either very general (but fast) or very sophisticated (but slow) paths.


As you might be able to tell, I'm pretty intruiged about this stuff, hehe. I'm really pleased with how well this 'prototype' pathfinding works.
[ B A H ]
Bad *** by nature,
Hackers by choice
2006-01-23, 3:04 AM #12
Here's another download that the other screenshot I posted is from.

Download (1.46mb)
http://binarydemons.com/~strike/files/se_dist.zip

Little objects float around the level, heading towards a charging station. They get charged up, then head randomly to one of 3 different 'dropoff' points, where they lose their energy, head back to the charging station, then find another random dropoff point.

Since they all end up taking the same exact paths, it almost starts to look prescripted. Tap space bar and all the floating robot things will pathfind to your position. Press space bar again and they will return to transporting energy.

Press enter to cycle through path node display modes. The possible modes are:
First mode:
Nothing is displayed

Second mode:
Active AI paths are displayed. Green is the entire preplanned path, red is the path link the ai is currently on.

Third mode:
Same as second mode (active AI paths are displayed), plus all the pregenerated path nodes are displayed and linked together with thin blue lines.
[ B A H ]
Bad *** by nature,
Hackers by choice
2006-01-23, 4:22 AM #13
And I'm still confused as to why you aren't working together with Jon`C for SITH2, since he has already done 90% of this work, in a higher-graphic quality engine. If you could assist him in the proper collision detection and physics of the game, he'd probably able to finish it.
2006-01-23, 7:00 AM #14
What if he doesn't want to? It looks like he's enjoying himself. And besides, I remember he offered his help to Jon who turned it down.
Dreams of a dreamer from afar to a fardreamer.
2006-01-23, 10:01 AM #15
Wow!
"it is time to get a credit card to complete my financial independance" — Tibby, Aug. 2009
2006-01-23, 12:20 PM #16
I considered doing something like this myself with JK, but using positions from adjoins to get path nodes wouldn't do what I wanted. For example, if you have a bot that can't fly, how is it going to get near a path node in the center of a large adjoin surface?
Historians are the most powerful and dangerous members of any society. They must be watched carefully... They can spoil everything. - Nikita Khrushchev.
Kill one man, and you are a murderer. Kill millions of men, and you are a conqueror. Kill them all, and you are a god. - Jean Rostand.
2006-01-23, 12:33 PM #17
Create node paths only along all surfaces marked as floor?
-Hell Raiser
2006-01-23, 2:31 PM #18
That would be possible, after the level is loaded and the pathnodes are being generated, each pathnode could get a flag specifying it is a walkable path, if its adjoin shares verticies with a surface flagged as floor. That, however, wouldn't work for all cases. I'm probably better off not touching the AI stuff anymore for a while (because both sodium *and* I are really not ready for it, this was purely for a class project due in a couple days), and getting some of the more fundamental code nice and solid. Need to go through and clean everything up removing commented code, adding file and function comment headers to the .h's and redo some of the core structure, because frankly it sucks.

This was originally an OpenGL class project, with just a 3do loader that didn't support model hierarchy or even multiple meshes. Most of that code in the rendering subset is from that class project, lol. The compiler, particle emitter, world object (thing) class, resource manager, and all the jkl/model/key/mat/etc loaders are all solid though, and there's much much more sense in just fixing and rewiring together whats broken than starting over. I'm getting so sick of writing windowclass registrations and initializing opengl =P

But yes, I'm having lots of fun working on this, and even if the game we (meaning whoever else is interested) is warped and disturbing, which im sure it will be, it'll all be worth it :)
[ B A H ]
Bad *** by nature,
Hackers by choice
2006-01-23, 5:24 PM #19
Keep us updated, this project definately has me interested!
-El Scorcho

"Its dodgeball time!" -Stormy Waters

↑ Up to the top!