Git Product home page Git Product logo

awk-raycaster's Introduction

awkaster

Bring some old-school fun to your terminal! Explore the dungeon and shoot monsters in this pseudo-3D game inspired by the classic Wolfenstein 3D and Doom.

Screenshot

Running the game

gawk -f awkaster.awk

You need gawk version >= 4.0.0

OS X users must install gawk first. The easiest way to do this is to use Homebrew. Once it has been installed, run the following commands:

brew update
brew install gawk

NetBSD users require gawk. The easiest way to do it is install it with pkgin:

pkgin install gawk

Alternatively install from sources using the pkgsrc framework:

cd /usr/pkgsrc/lang/gawk && make install

OpenBSD users require gawk. The easiest way to do it is install it with pkg_add:

pkg_add gawk

Alternatively install from sources using the OpenBSD ports:

cd /usr/ports/lang/gawk && make install clean

Your machine will now be ready to run awkaster.

How to play

Your objective is to navigate the map and activate exit elevator, killing hordes of monsters in the process.

Controls:

  • WASD - movement
  • J/L - turn left/right. Hold shift to turn quicker
  • spacebar - shoot
  • num 1-4 - change color mode
  • x - activate elevator (arrives after 1000 moves)

Adjusting resolution

By default game resolution is 64x48 "pixels", which are just a pair of ASCII symbols. That means your terminal needs to be at least 128 chars wide. You may change variables w and h to your liking.

Game engine

Wall rendering is done using ray casting. Monsters and projectiles are added after that as sprites. Ray casting is a simple rendering algorithm that doesn't require any 3d modeling or complex computation.

You can find an excellent tutorial here: http://lodev.org/cgtutor/raycasting.html

awk-raycaster's People

Contributors

bliti avatar kloun avatar krytarowski avatar pporada-gl avatar rodrigohahn avatar seemethere avatar themozg avatar timoteostewart avatar

Stargazers

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

Watchers

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

awk-raycaster's Issues

if using gawk features, it no longer is an awk program

gawk is a superset if awk, so a program using gawk features nis not longer an awk program.

Please change the repo title from

Pseudo-3D shooter written completely in awk using raycasting technique

to

Pseudo-3D shooter written completely in gawk using raycasting technique

for exactness.

Error on Ubuntu 15.10 - gawk 4.1.1

$ gawk -f awkaster.awk
gawk: awkaster.awk:5:
gawk: awkaster.awk:5: ^ syntax error
gawk: awkaster.awk:6:
gawk: awkaster.awk:6: ^ unexpected newline or end of string
gawk: awkaster.awk:8:
gawk: awkaster.awk:8: ^ invalid char ''' in expression

OSX's awk blows up.

src/awk-raycaster - [master] » awk -f awkaster.awk
awk: syntax error at source line 23 source file awkaster.awk
 context is
      >>>  sprite[0][ <<< 0]
awk: illegal statement at source line 24 source file awkaster.awk
awk: illegal statement at source line 24 source file awkaster.awk

Rendering/display speedup suggestion

function redraw() {
  str = "\033[1;1H"
  ...

The above sends the cursor to the top-right of the terminal without clearing it.

FWIW, I like the scroll-to-redraw effect - it's kinda reminiscent of a bouncy CRT - but the above change results in much less work for old/dumb terminals like xterm, making the whole thing a lot faster ( and decreasing dizziness by 100% everywhere :D).

An overview on escape sequences can be found in man console_codes (Linux manpages-specific); a more in-depth analysis can be found in dtterm(5), an absolutely ancient doc but the most comprehensive I've yet found (test what you read everywhere before trusting it tho).

The escape sequence listed above is practically standard and I would be very gobsmacked if you ever got an incompatibility report on it.

Also - this thing is awesome and I'll definitely be studying it at some point, awk seriously FTW! :D
(And kudos for making this tidbit such an easy fix!)

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.