# Roguelike plugin - C2 rot.js interface

0 Favourites
• 43 posts
• For all Roguelike fans, here is a C2 interface to an excellent rot.js javascript roguelike library.

"Generate map" action generates the map data and stores it in the plugin internal dictionary (the plugin is based on the Dictionary plugin): the key represents map coordinates and is of the format "x,y" (e.g. "12,34"); the value is a text character - "." for floors/passable tiles and "#" for walls/solids.

Plugin can compute a discrete (map cell based) FOV (Field of vision) from a given map coordinate:

Plugin can compute a discrete (map cell based) path (Dijkstra algorithm) from a given map coordinate to a given map coordinate:

Configurable room width & height and corridor length:

Loop through all rooms and access room edges and center (useful for a map object placement):

Added door hooks. You can get X & Y coords foor each room's door...

• Finally!

Is there a way in rot.js to get cell numbers for FOV, to gradually fade it out?

• You are welcome

Actually, there is a For each visible map cell condition.

• wow youre fast!

• Really nice work. I'm still working on a few other projects at the moment, but if I do have a chance to test out your plugin, I will!

• I've been playing with this for a while, but i can't get something like this to work. Where FOV with distance 1 = tile 2 and FOV with distance 2 = tile 3.

• Can't you just use the tilemap's "set tile range"?

• Since you have the map coordinates of the FOV tiles, you could test the tile distance with a Pythagorean theorem and than round the result to get an integer. Then you could set a tile frame as desired...

• Since you have the map coordinates of the FOV tiles, you could test the tile distance with a Pythagorean theorem and than round the result to get an integer. Then you could set a tile frame as desired...

Can't you just use the tilemap's "set tile range"?

hehe yeah... I was looking at the "Roguelike" object in the events, and completely forgot that it's just a simple plain tilemap in the end

• Thanks for this fantastic plugin and also adding in my previous request! It's verrry handy indeed

• Actually this is just my inexperience with Construct, I've gotten the pathfinding plugin to do what I want now! I guess the roguelike's pathfinding is more useful for setting up locked doors and exits/entrances. Lots of good stuff here, thanks so much

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• UnusualCadence Thanks! Glad you like the plugin and find it useful. In what concerns your questions, actually, there is an option build in the library, as explained by this excerpt from lib docs:

Fourth constructor [of the pathfinding object] option is a configuration object; so far, only one key is supported: topology (values 4/6/8, default 8). A topology of 4 allows only orthagonal movement, 8 allows diagonal movement and 6 supports hexagonal grids.

I wanted to implement the bare essentials for the roguelike creation first, since I like roguelikes very much. You can expect this feature implemented in about a week (I'm very busy now righting my PhD thesis).

P.s. A hex topology is supported by the lib, but it demands a whole new plugin layer Maybe at some point in the future...

• Been playing with rot.js in Phaser a lot, nice to see it ported to C2, nice work!

• After this https://www.scirra.com/tutorials/999/ra ... node-based was really getting a pain in the a* for a beginner (or "me" <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">) in C2, this plugin features a whole lot of what I needed... gonna think about putting my old .capx into my archive and taking this plugin...

@Lunarovich, you are a hero! Thanks for this awesome work! Good luck on your PhD thesis - and keep us up to date (please) ;D

Regards,

Proxymity

• Proxymity, thanks man! Glad I can help

If you find any bugs or have any comments or request, please, do not hesitate to write here.