JCOD - Java port of roguelike library libTCOD

I’m starting a port of libtcod, the library for roguelikes to LibGDX.

Source: https://bitbucket.org/chuck/jcod

https://dl.dropbox.com/u/52548846/jcod_demo.png

It might strike you as a bit of a odd notion to port a low-fi character display to an advanced graphical engine like GDX, but there’s two reasons: one, the library actually does support fully graphical tiles (not seen in the demo screenshot), and I do plan on supporting more sophisticated graphical effects like animation in the future without sacrificing the simplicity of a character console interface.

The other upshot is is the ability to easily port a number of roguelike projects currently using libtcod to java and gdx, and thus have the ability to run them on android, html5, and iOS as well as desktop. I’m concentrating on desktop at the moment (JCOD is far from optimized) but I’m definitely keeping other platforms in mind for the future.

Awesome…because roguelikes are awesome.

Before I fork it, is the test runnable?

The demo app should be runnable with maven. It only has the color and offscreen console blit demo at the moment, since JCOD at this point lacks the functionality for most of the other demos.

mvn compile exec:java -Dexec.mainClass=net.fishbulb.jcod.demo.DemoDesktop

If you create an IDE project, you’ll need to install the Lombok plugin for your IDE (http://projectlombok.org). After that, you can import the maven pom and run that class too, though you might have to run a maven build once first.

Nice.

I now have the line demo running, which forced me to fix some broken blend modes. Smoking out bugs is why I’m porting those demos after all. Though I probably should skip it and go back to it last, I’m just going through the TCOD demos in order, and the next one is noise, and that’s where I have a question:

I’m not keen on porting TCOD’s C implementation of noise to java, even though it seems fairly decent, so I’m looking for an open source pure java implementation of a variety of noise functions (perlin, simplex, fbm, that sort of thing). Low memory footprint would be a bonus since it’ll eventually have to run on android too. Anyone have suggestions?

There should be links in the wiki page.

Follow up: probably just as interesting is wang tiles. (food for thought)

Wang tiles look nothing to do with noise, but that is some crazy wild stuff that I should totally look into. I had a thought on doing a roguelike RTS sort of thing using aperiodic tiles (specifically to give one “faction” a unique look and feel), but all I knew was Penrose tiles, which would have been a terrible fit on a regular grid. Wang tiles look like just the ticket. I’m doing my best to make the Tile class more polymorphic (while staying unfortunately stateful), so I have a good idea how I’d implement this trick. Thanks for the link :slight_smile:

http://www.java-gaming.org/index.php?topic=22796.0
http://mrl.nyu.edu/~perlin/noise/
http://code.google.com/p/toxiclibs/source/browse/trunk/toxiclibs/src.core/toxi/math/noise/SimplexNoise.java
http://code.google.com/p/mycraft/source/browse/trunk/mycraft/src/org/noise/FBM.java?spec=svn10&r=10

Wang tiling is full of goodness…most of the references will be for textures but you can build 2d-dungeons, geometry…create fast version of noise (via texture lookup) feature point generation…all kinds of stuff. Humm…needs a wiki page.

Perhaps someone should create one.

Oho, this is nice, and shows some relation to of Wang tiles to noise. A bit over my head to implement though :stuck_out_tongue:

ykACzjtR6rc

I now support TCOD’s image tools (using gdx Pixmap) including scaled and rotated blits. Alpha is used instead of key colors for normal blits; subpixel blits don’t do alpha because they’re too much of a hack. I’m not sure how useful it all is, given how easy it is to draw a real image anywhere, but it made the noise demo a lot smoother looking anyway.

I started working on FOV support, then decided I really hated TCOD’s implementations, so I’m adapting the algorithms from the awesome SquidLib instead. Stuff like LOS and FOVare making a pretty extreme departure from TCOD as it is, so I suspect I’ll be ditching TCOD API compatibility everywhere else sooner rather than later.

Still TODO: Finish FOV and LOS, then start on pathfinding and BSP. At that point I’m pretty much feature-complete as TCOD functionality goes.

I really need to write this down and use it when somebody asks me what exactly game programming is about.

What, too many TLAs? Eat your alphabet soup, it’s good for you :wink: