caveexplorer

command module
v0.0.0-...-b8d9494 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2021 License: BSD-3-Clause Imports: 23 Imported by: 0

README

CaveExplorer

Copyright (c) 2019, Luis Quesada Torres - https://github.com/lquesada | www.luisquesada.com

CaveExplorer is a voxel-based videogame proof-of-concept, written in Go and on the G3N Go 3D game engine.

Binary

Check the releases page at https://github.com/lquesada/CaveExplorer/releases for binary Linux releases and videos.

Features

  • Physics engine
    • Simplified cylinder-based collisions (center, radius, height)
    • Cross-frame collision-checks to avoid objects going through objects
  • Entity system
    • Basic entities: characters (player and enemies), items (equipables, consumables, others), and attacks
    • Humanoid: humanoid equipables, inventory, hud
  • Voxel-based models
    • Includes tooling to process and load voxel models designed with MagicaVoxel (https://ephtracy.github.io),
    • Articulated and animated characters and equipable items
    • Node system that enables composing models with different transparency and tint values
  • Map generator
    • Start room -> critical path (n rooms) -> end room (+ extra N rooms)
    • Rooms are fully configurable, with connection points to other rooms and logic
  • Contents
    • Humanoid characters: human, orc, skeleton, and zombie
    • ~50 equipables (weapons, shields, armor, boots, helmets, amulets, rings, pants, etc.)
    • Basic story: get to the final level, grab the artifact, go all the way out

Known issues

  • Need to update to newer versions of G3N, paying attention to propagating the custom fixes
  • There is a memory leak triggered when building G3N nodes, which happens thousands of times per frame. Gameplays of 30-60 minutes use up several GBs of RAM. Maybe the newer versions of g3n fix this
  • Attack and defense are not properly calculated (e.g. attack and defense in ammo items or equipped items other than the weapon are not be considered)
  • Missing lots of contents, e.g. other weapon types such as bows, wands; projectiles, etc.
  • The user interface for the inventory is incomplete (and ugly)
  • With some OpenGL setups, when pressing two keys at once (e.g. arrow left+arrow up), one of them takes some delay to go through
  • Many things are not properly tweaked, e.g.
    • Position of objects in inventory or when dropped so they don't appear floating
    • Strengh of enemies when pushing the player
  • Acute lack of documentation and presence of hacks/workarounds in the (very prototypish) code
  • The proof-of-concept game is, from a pure gaming perspective, NOT fun, and quite boring
    • Player is practically immortal
    • Story is bland
    • Enemy, player, and item values (defense, attack, etc.) aren't calibrated

Structure

CaveExplorer is sort of a game engine built on top G3N, and an instantiation of the engine.


G3N offers all the OpenGL logic.

Please note that the G3N library included at lib/g3n is a modified version of (an outdated version of) the G3N Go 3D game engine (https://github.com/g3n/engine):

  • Enable Viewport to work in panels with y > 0. there was no metric to be passed with "y"
  • Allow reading textures from []bytes so as to load models from arrays encoded in the binary
  • Allow translucent materials.

Please refer to lib/customfixes for the diffs.


The following directories compose the CaveExplorer sort-of-game-engine:

  • ./entity: Defines and implements basic entity logic (e.g. characters, attacks, collisions, and items)
    • ./entity/humanoid: Defines and implement basic humanoid-specific logic (e.g. humanoid inventory, humanoid animations)
  • ./game: Implements the game state, basic game state logic (attacks hurting characters, picking up objects, etc.), and physics (collisions with walls, collisions with other entities, etc.)
  • ./helpers: Implements helpers to be used during asset and game instance definition
  • ./hud: Defines the interface for a HUD
  • ./input: Implements the input library for mouse and keyboard (including moving, angles, attacking, repeat attacks, jumping, etc.)
  • ./lib/*: Contains modified libraries
    • ./lib/g3n: Contains the modified G3N 3D Go Game Engine library
  • ./model: Defines and implements model and node classes to work with MagicaVoxel nodes, compose them, and alter transparency and tint.
  • ./world: Defines and implements tiles, rooms, the world, and a world generator.

The following files and directories compose an instantiation of the CaveExplorer sort-of-game-engine:

  • ./main.go: Contains all game logic for an instance, including how to generate the world, the player, and the enemies, what happens when moving a level forward or backward, what to put in the last level, when to exit the game, etc. Relies heavily on helpers and uses the assets listed below.
  • ./assets: Contains definitions and implementations for all entities in the game
    • ./assets/consumables: Consumable entities (unused, incomplete)
    • ./assets/enemies: Instantiation of enemies (orcs, skeletons, zombies) with proper values so they can be used in the game
    • ./assets/equipables: Objects equipable by characters in general (anything that fits in a hand/paw regardless of the size of the character)
    • ./assets/humanoid: Assets related to humanoid characters
    • ./assets/humanoid/customization: Customization features for humanoids (basically faces)
    • ./assets/humanoid/equipables: Humanoid-equipable items (armors, pants, helmets, boots, anything that fits a humanoid with a specific size)
    • ./assets/humanoid/human: Human-looking humanoid... Can use all humanoid equipables (armor, etc.) and equipables (weapons, shields, etc.)
    • ./assets/humanoid/orc: Orc-looking humanoid
    • ./assets/humanoid/skeleton: Skeleton-looking humanoid
    • ./assets/humanoid/zombie: Zombie-looking humanoid
    • ./assets/miscitems: Miscellaneous items (unused, incomplete)
    • ./assets/player: Instantiation of a human with proper values and plumbed to the input library so it can be used in the game
    • ./assets/scenery: Tiles, walls, doors, etc.
  • ./sources: Contains the MagicaVoxel source files and exported files used by the assets

How to build or run from the code

First, download and install all dependencies:

$ go get github.com/lquesada/CaveExplorer

First regenerate all models from MagicaVoxel source and exported files. Please refer to regenmodels.sh or https://github.com/lquesada/voxel-3d-models/tree/master/tools/voxobjrename for details on this step.

$ bash regenmodels.sh

Then compile and run:

$ go run main.go

or

$ go build main.go
$ ./main

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
lib
g3n/engine/animation
Package animation
Package animation
g3n/engine/audio
Package audio contains sub packages for binding to external audio libraries and implements a spatial audio player.
Package audio contains sub packages for binding to external audio libraries and implements a spatial audio player.
g3n/engine/audio/al
Package al implements the Go bindings of a subset of the functions of the OpenAL C library.
Package al implements the Go bindings of a subset of the functions of the OpenAL C library.
g3n/engine/audio/ov
Package ov implements the Go bindings of a subset of the functions of the Ogg Vorbis File C library.
Package ov implements the Go bindings of a subset of the functions of the Ogg Vorbis File C library.
g3n/engine/audio/vorbis
Package vorbis implements the Go bindings of a subset (only one function) of the functions of the libvorbis library See API reference at: https://xiph.org/vorbis/doc/libvorbis/reference.html
Package vorbis implements the Go bindings of a subset (only one function) of the functions of the libvorbis library See API reference at: https://xiph.org/vorbis/doc/libvorbis/reference.html
g3n/engine/camera
Package camera contains common camera types used for rendering 3D scenes.
Package camera contains common camera types used for rendering 3D scenes.
g3n/engine/camera/control
Package control implements controllers for cameras
Package control implements controllers for cameras
g3n/engine/core
Package core implements some basic types used by other packages.
Package core implements some basic types used by other packages.
g3n/engine/experimental/collision
Package collision implements collision related algorithms and data structures.
Package collision implements collision related algorithms and data structures.
g3n/engine/experimental/physics
Package collision implements collision related algorithms and data structures.
Package collision implements collision related algorithms and data structures.
g3n/engine/experimental/physics/constraint
Package constraint implements physics constraints.
Package constraint implements physics constraints.
g3n/engine/experimental/physics/equation
Package equation implements SPOOK equations based on the 2007 PhD thesis of Claude Lacoursière titled "Ghosts and Machines: Regularized Variational Methods for Interactive Simulations of Multibodies with Dry Frictional Contacts"
Package equation implements SPOOK equations based on the 2007 PhD thesis of Claude Lacoursière titled "Ghosts and Machines: Regularized Variational Methods for Interactive Simulations of Multibodies with Dry Frictional Contacts"
g3n/engine/experimental/physics/solver
Package physics implements a basic physics engine.
Package physics implements a basic physics engine.
g3n/engine/geometry
Package geometry implements several primitive geometry generators.
Package geometry implements several primitive geometry generators.
g3n/engine/gls
Package gls implements a loader of OpenGL functions for the platform and a Go binding for selected OpenGL functions.
Package gls implements a loader of OpenGL functions for the platform and a Go binding for selected OpenGL functions.
g3n/engine/graphic
Package graphic implements scene objects which have a graphic representation.
Package graphic implements scene objects which have a graphic representation.
g3n/engine/gui
Package gui implements the GUI infraestructure and several widgets.
Package gui implements the GUI infraestructure and several widgets.
g3n/engine/gui/assets
Code generated by go-bindata.
Code generated by go-bindata.
g3n/engine/light
Package light contains common light types which can be add to a 3D scene to illuminate it.
Package light contains common light types which can be add to a 3D scene to illuminate it.
g3n/engine/loader/collada
Package collada
Package collada
g3n/engine/loader/gltf
Package gltf
Package gltf
g3n/engine/loader/obj
Package obj
Package obj
g3n/engine/material
Package material contains several types of materials which can be used to set the appearance of graphic object
Package material contains several types of materials which can be used to set the appearance of graphic object
g3n/engine/math32
Package math32 implements basic math functions which operate directly on float32 numbers without casting and contains types of common entities used in 3D Graphics such as vectors, matrices, quaternions and others.
Package math32 implements basic math functions which operate directly on float32 numbers without casting and contains types of common entities used in 3D Graphics such as vectors, matrices, quaternions and others.
g3n/engine/renderer
Package renderer implements the scene renderer.
Package renderer implements the scene renderer.
g3n/engine/renderer/shaders
Package shaders contains the several shaders used by the engine
Package shaders contains the several shaders used by the engine
g3n/engine/text
Package text implements text font support.
Package text implements text font support.
g3n/engine/texture
Package texture contains several types of textures which can be added to materials.
Package texture contains several types of textures which can be added to materials.
g3n/engine/tools/g3nshaders
g3nshaders reads shaders files with ".glsl" extensions and generates a Go file containing strings with the content of these files.
g3nshaders reads shaders files with ".glsl" extensions and generates a Go file containing strings with the content of these files.
g3n/engine/util/logger
Package logger implements an hierarchical logger used by other packages.
Package logger implements an hierarchical logger used by other packages.
g3n/engine/window
Package window abstracts the OpenGL Window manager Currently only "glfw" is supported
Package window abstracts the OpenGL Window manager Currently only "glfw" is supported

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL