Code Monkey home page Code Monkey logo

cog's Introduction

=======
  cog
=======

an experimental 3d roguelike game written in c.

~~~~~~~~~~~~~~~~~~~
  technology used
~~~~~~~~~~~~~~~~~~~

3d rendering is done via raycasting. this is not the same as
ray tracing, in fact it is far more efficient, with severe
technical limitations in terms of what can be rendered. it was
pioneered by wolfenstien 3d, the first game (that i know of) to
use this rendering technique. basically the way it works is 
the map is a grid of either nothing (' ') or a wall ('#').
for example, consider this map:

+-----------+
|#####=#####|
|#         #|
|#  ##  @  #|
|###########|
+-----------+

(the |, -, and + outlines serve simply as a demonstration, they
are meaningless.)

the @ symbol represents the player character (in typical roguelike
fashion).

let's say the player is looking in the direction of the door ('='),
this would be rendered by casting a ray outwards from the players
position for each column of the view (terminal cell). once it
colides with some wall, the distance from the player is recorded,
and used to render a column of cells on the screen with an appropriate
height.

~~~~~~~~
  maps
~~~~~~~~

cog maps are stored as ascii encoded text files. they translate literally
to the map that will be rendered by cog. the diagram above demonstrating
rendering, is in fact, a valid map. large maps are split into "chunks" and
rendered in different map buffers (see map.h).

  +-----------+
  |  example  |
  +-----------+

  the following ascii could be copy and pasted into a map file
  (unindented), and it should work:

      ##################
  #####                #  #####
  #                    ####   #
  #                           #
  #            @              #
  #                           #
  #                           #
  #############################

  +-------+
  | chars |
  +-------+

  each character in a map means something, most of these are yet to be
  implemented, but here's what they will mean in the end:

  # wall
  @ player
  = door
  a-z teleport
  A-Z corresponding teleport exit 

~~~~~~~~~~~~
  building
~~~~~~~~~~~~

run make to build cog. by default it will also run the program.
the binary will be located in dist/cog.

  $ make

to build a production build (optimized compilation, stripped
debug functions) set the BUILD variable to production in the
makefile

  $ make BUILD=production

~~~~~~~~~~~~~~~~
  dependencies
~~~~~~~~~~~~~~~~

ncurses:
  # dnf install ncurses-devel

cog's People

Contributors

swisschili avatar

Watchers

 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.