Pages: [1] 2 3
  Print  
Author Topic: Chesee finder - pathfinding and collision engine  (Read 11703 times)
Offline (Unknown gender) The 11th plague of Egypt
Posted on: September 18, 2010, 09:50:19 AM
Member
Joined: Dec 2009
Posts: 285

View Profile
I guess you need something simple yet effective. I think I've got a solid solution to your problems,
wheter you are coding top-down shooters, RPG or a RTS games, this engine can help you moving
your units fast and reliably.

Doesn't matter how big your maps are, or how big your armies are, this thing is designed to SCALE
for all your needs. I've tested labyrinthic maps full of bottlenecks and get it to work smoothly.

I won't lie to you, this thing is pretty advanced, but I've worked to make it as easy to use, but with
a radical design in mind, you are the one in control. You get to know how it works when you design
map, but you can change the most important parameters of your units without a need to understand
all the underlying math. However, if you are curious to know how it works, the code is commented.

Still i suggest you watching this video tutorial in order to get started. BTW Can't incorporate vieo in post?

Download

Here is a partial list of features:

Path-finding:
- quick and simple BFS algorithm
- incorporated smoothing
- GM-functions free (no mp_grids)
- full GML, no dlls

Path following
- units can avoid each other without smashing into walls
- can handle queues and bottlenecks
- customizable steering options

Collision engine:
- doesn't use sprites (will be easy to port on Enigma)
- can handle really fast units
- "collision_line_width" like functions
- "collision_line_first" like functions can be implemented
- splits the maps into cells to cut down pointless checks

Editor:
- easy to use
- lets you build your own paths
- eliminates the need of having dozens of wall objects

Others:
- supports units of various sizes
- GM save and load won't work, use the custom replacement

To do:
- 3d support, can be achieved through layers
- more tutorials, on demand

Notes:
- units will never give up seeking their way until they can see their destination, can be changed on demand
- if the destination point is too close to a wall, units won't even try to get there, no quick fix
Logged
Offline (Unknown gender) freezway
Reply #1 Posted on: September 19, 2010, 12:12:35 AM

Member
Joined: Dec 2009
Posts: 220

View Profile
FUCK YES! is it bbox or pixel or both, I'll check it out when I have time.

EDIT: Your Indian?
« Last Edit: September 19, 2010, 12:16:06 AM by freezway » Logged
if you drop a cat with buttered toast strapped to its back, which side lands down?
joshdreamland: our languages are based on the idea that it's going to end up FUBAR
/kick retep998
Offline (Unknown gender) The 11th plague of Egypt
Reply #2 Posted on: September 19, 2010, 06:30:39 AM
Member
Joined: Dec 2009
Posts: 285

View Profile
No BBox nor pixels, your units are treated as circles by the collision system so that they can and turn in place when needed, like in most RTS games,
but, unlike in most RTS, units will never overlap.
However, this may not be good for a car race game because of the simplified physics.

I'm Italian, btw, sorry for the accent.
« Last Edit: September 19, 2010, 06:33:41 AM by The 11th plague of Egypt » Logged
Post made September 21, 2010, 01:17:24 AM was deleted at the author's request.
Offline (Unknown gender) The 11th plague of Egypt
Reply #4 Posted on: September 21, 2010, 05:29:01 AM
Member
Joined: Dec 2009
Posts: 285

View Profile
Ah, yes. Waypoint pathfinding. Valve's solution to bots :P.
Units can go outside of the waypoints connections as long as they don't cross walls.
It has some similarities to a navgraph.

I'll post this on the GMC when I'll get some input from this community. I posted on the U3D forum too.

So, any suggestions?
Logged
Post made September 22, 2010, 01:14:18 PM was deleted at the author's request.
Offline (Unknown gender) The 11th plague of Egypt
Reply #6 Posted on: September 23, 2010, 05:17:08 PM
Member
Joined: Dec 2009
Posts: 285

View Profile
Sigh, no time to do that. I'm already trying to port this in a 3d environment.

I need 2 script (pure gml please):
- one to measure the distance of a segment from a given triangle in 3d (needed to know if a bullet pierced the floor) <- more difficult
- one to find the z value of a triangle point given its x and y (needed to move units according to the height of the floor)
Logged
Offline (Unknown gender) The 11th plague of Egypt
Reply #7 Posted on: September 24, 2010, 11:08:14 AM
Member
Joined: Dec 2009
Posts: 285

View Profile
I've been making some projects. I found a site full of useful C++ code. Now I need to convert this C++ code to GML.

Here's the code for a segment-triangle distance script. .cpp and .h <- more important

Here's the code for a rectangle-triangle distance script. .cpp and .h

If somebody needs a prize in order to help me, we can talk about that.
Logged
Offline (Female) IsmAvatar
Reply #8 Posted on: September 24, 2010, 11:21:37 AM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 891

View Profile Email
I thought I might be able to be of help, so I opened up the .cpp file and started reading. About 2 lines in I said "Oh... guess not." C != C++.
Logged
Offline (Unknown gender) The 11th plague of Egypt
Reply #9 Posted on: September 24, 2010, 03:34:32 PM
Member
Joined: Dec 2009
Posts: 285

View Profile
Thanks for trying, that's some complex C++ indeed. I know some of it, but objects and classes are out of my reach.

btw is Josh still around?
Logged
Offline (Male) retep998
Reply #10 Posted on: September 24, 2010, 06:03:05 PM

Member
Location: Where else?
Joined: Jan 2010
Posts: 248
MSN Messenger - retep998@charter.net AOL Instant Messenger - retep998 Yahoo Instant Messenger - retep998
View Profile Email
I understand all the syntax in that shit, but my mind does not follow what is going on there.
If I spent an hour or so analyzing the code thoroughly I'd have you a beautiful gml script in no time.
Logged
Offline (Male) Josh @ Dreamland
Reply #11 Posted on: September 24, 2010, 08:09:17 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2946

View Profile Email
No, Josh went to college and abandoned everyone. Twice.

Don't worry Ism, that's not even what I'd consider "good" C++. I'm sure someone out there appreciates it. Rusky probably does. But I'm not a fan of making a template to do a regular class's job. Especially when it makes that many assumptions about what class Real contains.

They seem to have, however, circumvented my biggest beef with templates, being the lack of extern-ability. How did they do this? wellfuckifiknowillbetitwontevencompileinenigma

Furthermore, I can't retrieve the first .cpp file, or I'd tell you what it did. As for the second source, the first thing I notice is that it won't compile with -pedantic. Not that I make ENIGMA do so, but I've found that serious collaborations compile with -Wall -Werror -pedantic, meaning if the compiler even glances at anything funny, compile fails.

My synopsis is that they whore everything new unceremoniously. I doubt it'll compile in GCC or VStudio due to the lack of extern template in either of them. Not that they explicitly denoted that, anyway. "Wild Magic" is about the size of it.

As far as distance calculations go, the math is like all others. Except encased in uncompilable filth. I would sooner get GLibC to compile in G++ than this project.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) The 11th plague of Egypt
Reply #12 Posted on: September 25, 2010, 01:09:13 AM
Member
Joined: Dec 2009
Posts: 285

View Profile
Thank you for the extensive answer. Somebody probably tryed too hard to "be smart" with that cryptic coding. What a pity.
I found the new distance functions from Wild Magic 5, maybe these work properly, although I doubt it.

segment to segment .cpp and .h
segment to triangle .cpp and .h
segment to triangle .cpp and .h

Do you know of a place where I could find similar scripts? I am no matematician.

btw is there some way I could get you to convert this to gml so that it compiles? :)
« Last Edit: September 25, 2010, 01:37:48 AM by The 11th plague of Egypt » Logged
Offline (Male) Josh @ Dreamland
Reply #13 Posted on: September 25, 2010, 09:02:08 AM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2946

View Profile Email
I'm not sure about where to get a really good script for that. The typical strategy for working with rectangles is storing a center point and some lengthdir params.

I don't think the Wild Magic people were trying to act smart. Though it makes me wonder what compiler they were using, since it clearly wasn't VStudio or GCC. (GCC -does- offer an export template extension, but it's explicit).

Anyway, the sources you linked to only have a fraction of the code. They inherit the rest. It's like Rusky's dream system. So if you want to see everything that's going on in the code... well, have fun tracking down all the classes you inherit from.

A quick Google search will find thousands of capable geometric collision examples. Here's one. But collisions are one place I don't even trust my own math skills to generate the most efficient test function, let alone some stranger's from GameDev.net. Or that of some group using Compiler from Hell.

I also don't understand why you needed it converted to GML; are you trying to get it to work in Game Maker as well? G++ compatible C++ can just be copied into WhiteSpace in ENIGMA and used like any other function. Including the code on that GameDev.net link I gave above. Right now, the syntax checker has problems with variable.function(), but I will have that working sometime this week.

When the fix is in the stable repo, I will let you know how to use his code.
« Last Edit: September 25, 2010, 09:03:39 AM by Josh @ Dreamland » Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Rusky
Reply #14 Posted on: September 25, 2010, 10:35:04 AM

Resident Troll
Joined: Feb 2008
Posts: 960
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
That is the most amazing C++ in the world!

:troll:
Logged
Pages: [1] 2 3
  Print