Giter VIP home page Giter VIP logo

xenkofogofwardirectional's Introduction

Xenko FogOfWarDirectional (System)

This is a directional fog of war system written for Xenko, feel free to use it directly or as an example. I am an amature so comments and/or PR's are welcomed. It consists of the following:

  • When the project is launched there is a lengthy pause while the fog map is computed
  • The fog map is a tile based visibility grid computed from customizable parameters
  • Fog parameters are specifed in game studio in/on the FogOfWarSystem class
  • There is a fog of war pre material overlaid on the map
  • There is a fog of war post material attached to the camera which moves with the player
  • A dual camera system, one perspective camera, one orthographic camera
  • Orthographic camera renders to a texture in an isolated render group, this is used by the fog of war post material
  • Perspective camera has two passes, one for the world, the second for the fog of war
  • The fog of war pre material uses a shader which takes an array of floats which equate to opacity
  • The fog of war post material is a result of the pre material pumped through a dedicated post effects pipeline
  • Fog characteristics can be changed in the post effects settings through game studio (compositor)
  • For smoother fog not only can you adjust post effects settings, but also the scale of tiles
  • Game profiler is attached, control-shift-p, WASD to move around

+Runs quickly as it only uses table lookups and simple up/down logics.

Video can be found here

NOTE: Before the scene renders there is a lenghty delay while the fog map is generated. Ideally you would write the fog map/ visiblity data to a JSON or some other custom game data file and read it from disk to avoid the lengthy startup.

NOTE: This current project does not handle transparency of enemy units. This can be added easily by registering units with the fog of war system and doing a location lookup (truncation of current Pos) on the fog map, retrieving the Visibility value and pumping it through a transparency shader applied the enemy unit. An example of this can be seen in my XenkoFogOfWarPlus on the enemy unit shader. This way enemy units or characters will fade into visibility as fog is revealed.

xenkofogofwardirectional's People

Contributors

herocrab avatar

Watchers

James Cloos 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.