Future Tutorials, Pathfinding

Posted by DesertFox on Aug. 6, 2010, 9:52 p.m.

So guys, tell me what you want me to do for future C#/XNA tutorials. Next tutorial will cover C# classes (a more in-depth look) with a few more XNA concepts. Also, was the last tutorial too long, or could you follow it all right?

So here's another edition of "What is DF working on today?"

Pathfinding! Yay! But more complex than that! That is my implementation of a modified A* heuristic algorithm. In other words, RTS pathfinding AI. So what can this baby do? Well, first off an explanation of the image!

On the left, you can see a horde of red dots, with a bunch of white lines. The red dots are units, the white lines are the paths they are going to take to get to where they need to. On the right, you see that they have stopped moving, and in fact, clumped together as a group, each on their own square. That's right - it even conforms around terrain! And it runs quite fast, as well. I may make it look easy, but there's a lot more to it under the hood.

Pros:

Fast. I even ditched the closed lists, instead having an iterating SearchID.

Dynamic - you can add stuff like buildings on the fly.

Islanding - AKA if two areas are inaccessible from each other, it returns no-path immediately.

Cons: Currently only grid-based, though I could switch over to any-point without dropping anything. I'd have to re-sort figuring out how to "land" a group

Unfinished: Unit movement cooperation. Currently, while objects are moving they can go through each other. Reconciling this will take the form of each node having an "occupant" and if a unit needs to go through, it basically asks "would you kindly GTFO my path?" However, as shown, they still end up in their proper places, spread out. Should not be too difficult, an example of emergent behavior (aka LIFE, simple rules create complex behavior)

And now for the bonus material

Bonus material removed, after proof of intelligent life after all - at least on the yyg-chat. Turns out the abuse of power had good intentions, and apologies were had by all. A more civilized debate occurred, in which several points were illustrated:

C++ is more powerful and flexible.

In terms of preference, people's opinions will get in the way.

Regardless of your preference, C++ is stronger, assuming you are knowledgeable.

Your opinion is yours to have. You may think that one is better than the other, and as long as it has nothing to do with performance or other quantitative specifications, it is just that - an opinion.

In short, my thoughts that C++ was quantitatively better were realized, and their opinion that GM is a good tool so long as one keeps within GM's boundaries was realized.

This unfortunately is only a small subset of the YYG, and I cannot help you if you venture deeper, for the map is incomplete.

Comments

Mush 14 years, 2 months ago

Looking solid.

Scott_AW 14 years, 2 months ago

This will be very useful to me.

Juju 14 years, 2 months ago

If nobody pushes the boundaries, the boundaries never move. You will only ever see the same games instead of innovation. There is no question that should go unasked.

Astryl 14 years, 2 months ago

Wait… wasn't this the debate that I was stubbornly fighting in?

Juju 14 years, 2 months ago

Who's Mega. Dammit guess, make an introduction blog.

shawn 14 years, 2 months ago

Alright, I have little to no knowledge when it comes to C or XNA or whatever.

What is the difference between C++, C#, and XNA respectively and what are they each used for?

Juju 14 years, 2 months ago

C++ and C# are programming languages, like Visual Basic and GML are programming languages. XNA is an SDK (software development kit) in a matter similar to Game Maker. You use XNA like you would the in-built functions in Game Maker to create a game but use C# to program in.

shawn 14 years, 2 months ago

What is the difference between C++ and C#? Also while I'm at it, what is PHP( I know its used for coding websites but not much after that.) and what medium is it used in? Like what Gamemaker is it GML as blank is to PHP?

Thanks for helping me out here by the way.

Juju 14 years, 2 months ago

PHP is a bit different. It's a scripting language, that is, another program on the server comes along, reads it and executes actions. Strictly speaking GML is a scripting language as well since it is interpreted by the the runtime executable (basically speaking, your game interprets it).

The different between C++ and C# is mainly to do with programming technique, age and memory management - C# is object orientated only, C# is newer and C# does a lot of the memory management for you. C# is also usually considered to be a little easier to get to grips with.

KaBob799 14 years, 2 months ago

I've found that knowing GML (and to a lesser extent, Java) helped me learn PHP very quickly. Not quite so much with c++, but I'm also much less motivated to learn c++.