• Stars
    star
    297
  • Rank 140,075 (Top 3 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Roguelike Toolkit - Modern C++ (14) SFML-based toolkit for creating roguelikes.

rltk : Roguelike Toolkit - Modern (C++14) SFML-based toolkit for creating roguelikes.

It's very early days, but I hope that this can be a useful tool. Black Future was getting messy, and I needed to separate out some engine logic from game logic for my sanity; I realized that others might find the underlying engine code useful.

Right now, it's a very fast ASCII (code-page 437) terminal renderer compatible with fonts from libtcod and Dwarf Fortress. Eventually, it will provide assistance with a number of game-related topics including path-finding, line-plotting, and probably some of the entity-component-system I've been enjoying.

Credit to Pyridine for the REXPaint format code. Original located at: https://github.com/pyridine/REXSpeeder

Building from source

You need SFML for your platform, Boost, and cmake. Make a "build" folder, and use CMake to generate build files for your platform (I'll expand upon this later, when this is a more useful library).

Building on Visual Studio 2017

  • Setup VCPKG, following the instructions here
  • Ensure that you've integrated it, with vcpkg integrate install (see here)
  • Install packages: vcpkg install sfml and vcpkg install cereal. These take a while.
  • Open Visual Studio 2017, and use "Open Folder" to open the RLTK folder to which you cloned everything. The CVPKG stuff will ensure that SFML is linked correctly.
  • If you've previously opened the project in VS2017, use the CMake menu to delete your cache and regenerate everything. You really shouldn't have to do this, but CMake integration is young.
  • You should now be able to select an output, and build/run it.

Included Examples (with lots of comments!)

I'll write proper documentation as the library evolves; I don't really want to write up a lot of docs and have to revise them heavily as things solidify. I'm doing my best to include examples evolving towards a real roguelike. Currently, these are:

Example 1: Hello World

Hello World

Example 1: demonstrates a Hello World with frame-rate.

Example 2: Randomly moving @

Randomly Moving @

Example 2: a randomly moving yellow @ on a field of white dots.

Example 3: Bresenham's Line Pathing

Bresenham Line Pathing

Example 3: our @ dude again, this time using Bresenham's line to find his way. It also renders additional glyphs, as Mr @ finds his way to his destination.

Example 4: A-Star Pathing

A Star Pathing

Example 4: our @ dude again, now on a defined map with obstacles and using A* to find his way to the heart. This demonstrates using templates to specialize map support - we won't force you to use a specific map representation!

Example 5: Mouse Controlled Path-Finding

Mouse Driven A Star Pathing

Example 5: our @ dude again, using A* pathing to find his way to the mouse cursor. Click and he goes there.

Example 6: Visibility

Visibility

Example 6: Example 5, but now we have true visibility plotted as you wander.

Example 7: Multi-font ASCII Layout

ComplexGui

Example 7: A complex GUI with multiple fonts and layers, dynamically resizable.

Example 8: Owner draw, and retained-mode GUI elements

RetainedMode

Example 8: Demonstrates an "owner draw" panel (with SFML render target callback), drawing a background image. Some ASCII consoles are spawned, and one is populated with a mouse-over, a checkbox, radio-button set, a list-box and some status bars. The other panel displays the results.

Example 9: Sparse layer with effects

Sparse

Example 9: This demo uses a regular console layer to draw the map, and a "sparse" console layer for the character and traversal path. It uses sub-character alignment to smoothly move the @ around, and demonstrates rotation of the @ by leaning left or right as he travels (not an effect I recommend for a game, but it works as a demo!).

Example 10: The beginnings of a roguelike

Sparse

Example 10: This example generates a random map, and you can move your @ around with the arrow keys. It is the first example to use the Entity-Component-System (ECS) provided by RLTK; it makes for a relatively straightforward and modern way to design a roguelike - with very little code, we have the basics of wandering around a map. Note: message passing isn't implemented yet; when it is - this example will be even smaller!

Example 11: REXPaint support (http://www.gridsagegames.com/rexpaint/)

RexPaint

Example 11: This example is basically Hello World, but with a REX Paint image loaded (Nyan Cat) and displayed.

Example

The goal is to keep it simple from the user's point of view. The following code is enough to setup an ASCII terminal, and display Hello World with a frame-rate displayed (around 100 FPS on my workstation):

#include "../../rltk/rltk.hpp"
#include <sstream>

using namespace rltk;
using namespace rltk::colors;

void tick(double duration_ms) {
	std::stringstream ss;
	ss << "Frame duration: " << duration_ms << " ms (" << (1000.0/duration_ms) << " FPS).";
	console->print(1, 1, "Hello World", WHITE, BLACK);
	console->print(1, 2, ss.str(), YELLOW, BLUE);
}

int main()
{
	init(config_simple_px("../assets"));
	run(tick);
  return 0;
}

More Repositories

1

HandsOnRust

The source code that accompanies Hands-on Rust: Effective Learning through 2D Game Development and Play by Herbert Wolverson
Rust
302
star
2

bgame

Nox Futura - sort of like Dwarf Fortress in space.
C++
183
star
3

noxfutura

Nox Futura is a Rust port of the C++ project of the same name. It's a Dwarf Fortress like, in 3D (and a futuristic setting). It's also a passion project, so I'm not expecting formalized release dates!
Rust
122
star
4

rustyroguelike

Following along with the /r/roguelikedev tutorial session, in Rust and implementing my own library as well!
Rust
116
star
5

roguelike-celebration-2020

Code for my Procedural Map Generation talk at the Roguelike Celebration 2020
Rust
61
star
6

secbot-2021-7drl

7-day Roguelike, 2021 (Success)
Rust
23
star
7

bevy-test

A quick and dirty Space Invaders type game in Bevy, with attached tutorial.
Rust
20
star
8

dankestdungeon

A 7DRL Project, using Emscripten to create a simple roguelike system in C++ that runs in the browser.
C++
19
star
9

png2rex

A quick utility for turning PNG files into REXPaint xp files.
C++
15
star
10

rust_brain_teasers

Source code to accompany the Rust Brain Teasers book.
Rust
15
star
11

bqos-oss

Bracket QOS - a Quality of Service/Experience server system writtin in Rust. Derived from the excellent LibreQOS Project.
Rust
14
star
12

ArdanUltimateRustFoundations

Course Material for Ardan Labs - Ultimate Rust: Foundations
Rust
14
star
13

Ardan-1HourAsync

Code accompanying the 1 Hour Dive into Async live stream.
Rust
13
star
14

png2rex_rs

Utility for converting PNG files to REX Paint .xp files.
Rust
9
star
15

rf-signals

RF planning system for WISPs, and a port of various RF algorithms to pure Rust.
JavaScript
9
star
16

cpumap-pping

A work-in progress experimenting with merging xdp-pping and xdp-cpumap-tc into one BPF program, with a view to helping LibreQoS and BracketQOS obtain this information in a scalable manner.
C
6
star
17

pyrite_box

Fun project making something that looks a bit like the old SSI Gold Box games.
Rust
6
star
18

libre_qos_rs

Some helpers for LibreQOS, written in Rust.
Rust
4
star
19

TechSupportRL

A quick roguelike for fun, as a break from writing Black Future. Should work as an RLTK example.
C++
4
star
20

bracket-ui

A user-interface library for bracket-lib.
Rust
3
star
21

rltk2

The Roguelike Toolkit, Version 2 - Very Much in development, I don't recomend trying to use it yet!
C++
3
star
22

rusty-jam-2

Entry for Rusty Jam 2 ( https://itch.io/jam/rusty-jam-2 )
Rust
3
star
23

gravity_well

A simple two-player (shared keyboard) game in which you collect salvage and try not to fall into a black hole.
Rust
3
star
24

Ardan-NR-2023-07

Rust
2
star
25

noxunreal

Unreal Engine version of Nox Futura. Relies on libnox.
Lua
2
star
26

ArdanRustDebugOptimize

In-Development repo for Rust Debugging & Optimization
Rust
2
star
27

Ardan_2023_07_24_Live

Live code repo for Ardan 2023/07/24 training
Rust
1
star
28

llm_rust_article_1

Rust
1
star
29

Ardan_2023_05_18_Live

Live coded repo for 2023-05-18 Rust 1
Rust
1
star
30

UltimateRust1-EcoSystem

Code to accompany Ardan Labs - Ultimate Rust 1, Condensed class.
Rust
1
star
31

ArdanLabs_RustInYourEnterprise

Code that accompanies the Introducing Rust into your Company Ecosystem talk
Rust
1
star