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

Vance_Kimiyoshi 14 years, 2 months ago

Experience with GM/GML will hurt your ability to do game programming with other languages/libraries and much as it will help it.

KaBob799 14 years, 2 months ago

It didn't hurt my ability at all.

Castypher 14 years, 2 months ago

Learning Java actually helps with C#, as they share a lot of similarities.

I also disagree with Vance. GML might be easier and completely different, but it teaches some basic programming ideas that can be carried over to most languages. Even if it's not context, it can be things like concepts.

You use variables, for loops, algebra, data structures, and various other things present in all programming languages.

The only reason I have trouble with C# is because admittedly I don't have the time or patience to sit with it. It has very little to do with the fact that I use GM. The only reason there is an effect is because GM does everything for you, and highly limits you in that regard. Not like the things you have to do yourself are all that hard, just tedious.

Dictionary: Tedious doesn't mean hard, it means repetitive and often boring. Just so nobody embarrasses themselves when they want to argue with my language.

DesertFox 14 years, 2 months ago

Oh, kilin, don't be so tedious.

:D

shawn 14 years, 2 months ago

Thanks again guys, for bearing with me here.

So if somebody were to want to make/code a website, they would buy a domain and server and then… what? Do they log into their server and input code directly through a website or something?

Castypher 14 years, 2 months ago

Typically, you use an FTP to log in to your site. There you'll either upload your files or edit them (I edit mine through Notepad, but I'm an old-fashioned son of a bitch).

There are some cases (forgot how) that I worked with where an network item resembling a hard drive acted as the FTP, and I'd just move the files to that directory and it'd upload automatically.

Don't forget to always back up your files, especially the ones you happen to be working with. Mistakes happen. A lot.

KaBob799 14 years, 2 months ago

I made a file editer out of PHP cause ftp gets annoying and the usual built in file manager has some annoying problems. Whenever I use it I usually end up hitting enter on the file name field which saves the open file, instead of opening the new file. Can't say how many time I broke pages because of that <_< Eventually it annoyed me so much that I just made a better replacement =p

But yeah, normally if you get a server there will be phpymadmin and a file manager on the server admin panel.