1) You might be tempted to say if(myString)…
…and this would appear to work, for a while. However, it’s really the wrong way to go about this. Observe… Continue reading →
The classic for loop
And if that’s the case, then you should never, ever use anything you see in this article, because from here on out you will be exposed to some Seriously Cool Code.
This is just a quick little function I find pretty useful. It allows you to round any number to an arbitrary value, and can be useful for when you’re working with and rendering to a grid or want a slider that increments by a certain step… Continue reading →
Field of view, which involves determining which tiles are visible to the player, is a particularly fun aspect of writing roguelikes, in my opinion. When writing a field of view algorithm, you often find yourself trading quality for performance, or vice versa. Some algorithms get around this with a bit of trickery, like the Rogue algorithm. Other algorithms have no visible artifacts and in fact are quite pleasing visually, but pay for this with a definite decrease in performance… Continue reading →
In this article, I’ll be discussing how to generate neat-looking fully connected caves using cellular automata. This algorithm builds off of another algorithm which can be found here. As noted, the linked algorithm is incomplete and cannot be used for generating dungeons that are suitable for a real roguelike. This article is about the method I used to make that algorithm workable.
First off, the basic algorithm:
To begin, let’s take a look at basic algorithm behind generating nice-looking cave levels with cellular automata… Continue reading →
So, let’s take a look at the code required initialize a basic 80 by 25 console and draw a few characters with the display class… Continue reading →
If you’re writing a game that incorporates both a terrain of some sort and enemies that walk around, the chances are you’ll need some version of pathfinding to control the enemy movement patterns. The thing is, pathfinding is serious business–it’s not easy to grasp. To make things worse, there aren’t many good pathfinding resources–most of the articles that turn up on Google and such only serve to confuse you further. That’s why I’ve taken the time to compile this list of pathfinding resources that I’ve found to be actually helpful, as opposed to confusing or just plain wrong. Continue reading →
The forEach loop behaves pretty much like your standard for loop, except that it’s a function that you call only on arrays. It looks like this… Continue reading →