Coder Social home page Coder Social logo

mapgenerator's Introduction

== C++ Map Generator ==

I'm creating a map generator based on Perlin Noise.

First, we need to install the Libnoise Library (https://github.com/qknight/libnoise) as follows

git clone https://github.com/qknight/libnoise
cd libnoise
mkdir build
cd build
cmake ..
make
sudo make install

Once you've done this, you can erase the libnoise folder.

Now, its time to include it to our program:

#include <noise/noise.h>

using namespace noise;

Makefile as an example to show how to include the library while compiling.

CFLAGS = -o
STD = -std=c++11
CC = g++

MG: main.o 
	$(CC) main.o $(CFLAGS) MG.out -I/usr/local/include -L/usr/local/lib -lnoise

main.o:
	$(CC) $(STD) -c main.cpp

clean:
	rm -f core *.o *.out

Once you've compiled, try to execute the binary. It is possible that you get the following error:

error while loading shared libraries: libnoise.so: cannot open shared object file: No such file or directory

It it is the case, do the following:

sudo find / -name libnoise.so
echo $LD_LIBRARY_PATH

if there is nothing to be displayed, add the default path value

LD_LIBRARY_PATH=/usr/local/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/libnoise.so
export LD_LIBRARY_PATH

Then you should be able to run your application.

NOTE: If you are using noiseutils library (http://libnoise.sourceforge.net/downloads/noiseutils.zip), do not forget to include noiseutils.cpp into the main file.

Find below some examples

Map1 Map2 Map3 Map4

Here are some mono-color examples

Map5 Map6 Map7

Also, an aplication of this library could be a blood moon generator:

BM1 BM2 BM3 BM4

mapgenerator's People

Contributors

isalfati avatar

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.