libTCOD review and prototype

I’ve been working on a new prototype which makes use of the libtcod library.

The code samples which come with the library makes it easy to learn how everything works. Also, the library provides an all-purpose container which can be used as an array, list, or stack. I’m excited to be working with libtcod and I hope the prototyping process produces some results worthy of making a full game. If I can get to that point, I already have a theme in mind and a few mechanics based on that theme.

I’m still working out some of the theme ideas and rules for how the narrative world works but I’ll be sure to post updates on any progress. I’m somewhat conflicted though since anything I post could potentially become a spoiler if I do release a game based on the theme. I’ll give it some thought and share what I can without depriving players from any “aha” moments.

Because of the nature of prototyping the code-base is quite messy but with the help of libtcod I already have randomly generated dungeons and enemies with pathfinding. I mean look how easy it is to walk an enemy towards a player!

int enemy_x, enemy_y;
int player_x, player_y;

// set positions, etc.

TCOD_path_t path = TCOD_path_new_using_map(map, 1.41f);
TCOD_path_compute(path, enemy_x, enemy_y, player_x, player_y);

do {
    TCOD_path_walk(path, &enemy_x, &enemy_y, true);
} while(!TCOD_path_is_empty(path))

As I continue to work with the library I’ll post more little bits of code. Take care!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s