GithubHelp home page GithubHelp logo

andres6936 / doryen Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 4.0 9.48 MB

Doryen based in Libtcod 1.5.1 - Refactoring struct and clear code, deleted the old C code and added new features and algorithms. The objective is a small 2D rendering engine (based in grid or tiles). It is written in an effort to create an engine being as lightweight and conceptually clean as possible.

Home Page: https://github.com/libtcod/libtcod

License: Other

CMake 3.67% C++ 96.33%
library roguelike roguelike-library developer-tools cpp libtcod fov-algorithms noise-generator roguelikedev pathfinding field-of-view refactoring clean-code doryen

doryen's Introduction

Doryen Based in Libtcod 1.5.1

Based on the new guidelines taken by Libtcod and based on the state project, I have decided to take matters into my own hands and fork version 1.5.1, which by then had a minimal support for CMake, but it still served as a starting point to start the refactoring and cleaning of the code.

The guidelines taken by Libtcod are:

  • "stopped adding C++ implementations into libtcod." Reference Issue 71

  • "As much as I liked using C++ over C it has made the code less portable and made the C ABI harder to maintain. I now plan on rewriting the code in C and porting to C++ instead of the other way around." Reference Issue 39

This project leaves aside those guidelines taken by Libtcod and its place took as a starting point the implementation of new functionality in C++.

Differences with Libtcod 1.5.1

The code has been completely restructured, modified the structure of the project to match the recommendations made by GitLab about how to structure the project, several modules have been removed, the API has been changed and full support has been given to CMake.

We have chosen to fully support CMake, beyond allowing the construction of the project on various platforms as to allow the use this tool as a Content Package Manager, that will allow you to download Doryen as a dependency without the need to embed the project within of each application you want to use it.

Features

Keyboard Input and Mouse Input

The keyboard module supports both turn-by-turn and real time games.

True color console

Don’t limit yourself to monochrome or 16 color roguelikes. True colors create a whole world of new visual possibilities.

Antialiased bitmap font support

Antialiasing makes it possible to have better looking fonts, even when you’re using characters as small as 8×8.

Sub-cell resolution & SDL callback

Use a few special characters within a font to simulate pixels half the size of a console cell or directly apply SDL post-processing on the image.

High quality pseudo-random number generation

Using Mersenne twister algorithm.

BMP and PNG image support

You can blit images onto your console background.

Perlin noise toolkit

Support for Perlin, simplex and wavelet noises.

Heightmap toolkit

Tools to generate heightmaps.

A field of view toolkit

Supported algorithms:

  • Basic raycasting.
  • Recursive shadowcasting.
  • Diamond raycasting.
  • Precise permissive fov.
  • Restrictive shadowcasting a.k.a. MRPAS.
Path finding toolkit

Using A* or Dijkstra algorithms, with either a builtin map data structure or your own internal data structure through function callbacks.

BSP toolkit

For regions, cities, dungeons building.

Compiling from source

Requirements
  • Compiler with Support to C++17 (GCC, Clang, MSV, etc ...)
  • CMake Version >= 3.15
  • SDL Version === 1.2.15
Commands

You can clone with Git via the GitHub repository.

git clone --recursive --depth=1 https://github.com/Andres6936/Doryen.git
cd Doryen && mkdir Build
cd Build && cmake .. -DDORYEN_BUILD_SAMPLES=ON
make

How to use the library as a downloadable dependency

To use this library, you need the script written by TheLartians, named CPM.cmake (acronym for CMake Package Manager). Add it to your project, for example, under the CMakeModules and then in your CMakeFiles.txt write the following:

  • The directory CMakeModules is used to store CMake Scripts, in case you use another directory for these purposes it will be necessary that references properly CPM.cmake to be able to download the dependency.
Include(CMakeModules/CPM.cmake)

CPMAddPackage(
  NAME Doryen
  VERSION 2021.0124
  GITHUB_REPOSITORY Andres6936/Doryen
)
 
TARGET_LINK_LIBRARIES(<TARGET> PRIVATE Doryen::Framework)
Please, in the VERSION option you should preferably specify the latest version available consult here

Example

#include <Doryen/Doryen.hpp>

using namespace Doryen;

int main()
{
   Console console {50, 50};
   
   while (console.isRunning())
   {
      console.clear();
      console.writeString(1, 1, "The answer is 42.");
      console.draw();
   }
}
All screenshots come from the Doryen sample source code.
Click for see Screenshots

A B C D E F G H I J K

doryen's People

Contributors

andres6936 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

doryen's Issues

[Feature] Array2D

  • (Referece)[https://en.wikipedia.org/wiki/Row-_and_column-major_order]
  • (Representation)[https://softwareengineering.stackexchange.com/questions/212808/treating-a-1d-data-structure-as-2d-grid]

Overflow with the Color class

Describe the bug
Overflow with the Color class

To Reproduce
Steps to reproduce the behavior:
Add, Multiply, ... Color with values components to limit.

Expected behavior
The value component will be set to 255 avoid the overflow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.