Skip to content

Slideshow776/Terfenstein-3D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Terfenstein 3D

Official Trailer

Trailer thumbnaik

Buy it on Steam?

Main Capsule

image

Read on below for project specifics.

  1. Game Design Document
  2. Credits
  3. Project Comments
  4. Other
  5. Project Kanban Board

Game Design Document πŸ’–

  1. πŸ’™ Overall Vision

    • Write a short paragraph explaining the game:

      This is a first person shooter (fps) about infiltrating gender fascists facility and disabling their weapons of mass destruction.

    • Describe the genre:

      First-person shooter (FPS) is a sub-genre of shooter video games centered on gun and other weapon-based combat in a first-person perspective, with the player experiencing the action through the eyes of the protagonist and controlling the player character in a three-dimensional space. --wikipedia

    • What is the target audience?

    The average player is assumed to be aware of the transphobic pressure that exists to transgendered peope by the media and TERFs

    • Why play this game?
  2. πŸ’œ Mechanics: the rules of the game world

    • What are the character's goals?

    • What abilities does the character have?

    • What obstacles or difficulties will the character face?

    • What items can the character obtain

    • What resources must be managed?

  3. ❀️ Dynamics: the interaction between the player and the game mechanics

    • What hardware is required by the game?

      • Desktop needs to have a functional mouse, keyboard, and screen. This game will not require a powerful computer.
    • What type of proficiency will the player need to develop to become proficient at the game?

    • What gameplay data is displayed during the game?

    • What menus, screens, or overlays will there be?

    • How does the player interact with the game at the software level?

  4. πŸ’š Aesthetics: the visual, audio, narrative, and psychological aspects of the game

    • Describe the style and feel of the game.

    • Does the game use pixel art, line art, or realistic graphics?

    • What style of background music, ambient sounds will the game use?

    • What is the relevant backstory for the game?

    • What emotional state(s) does the game try to provoke?

    • What makes the game fun?

  5. πŸ’› Development

    • List the team members and their roles, responsibilities, and skills.

      This project will be completed individually; graphics and audio will be obtained from third-party websites that make their assets available under the Creative Commons license, and so the main task will be programming and creating some graphics.

    • What equipment is needed for this project?

      A computer (with keyboard, mouse, and speakers) and internet access will be necessary to complete this project.

    • What are the tasks that need to be accomplished to create this game?

      This project will use a simple Kanban board hosted on the project's GitHub page. The main sequence of steps to complete this project is as follows:

      • Setting up a project scaffold
      • Programming game mechanics and UI
      • Creating and obtaining graphical assets
      • Obtaining audio assets
      • Controller support
      • Polishing
      • Deployment
    • What points in the development process are suitable for playtesting?

      The main points for playtesting are when the basic game mechanics of the level screen are implemented, and when it is visualised. The questions that will be asked are:

      • Is the gameplay and UI understandable?
      • Is the gameplay interesting?
      • How do the controls feel?
      • How is the pace of the game?
      • Are there any improvement suggestions?
    • What are the plans for publication?

Credits

Project comments

Wall clipping

To stop the wall from clipping out of sight it is necessary to set the camera.near to a very tiny amount, like so:

camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.lookAt(0, 0, 0);
camera.near = .01f;
camera.far = 100f;
camera.update();

Player movement

The cursor can be locked to the window like this line of code: Gdx.input.setCursorCatched(true);. In HTML this needs to be triggered multiple times to ensure the correct application behaviour.

Keyboard movement is as simple as this:

private void keyboardPolling(float dt) {
   if (Gdx.input.isKeyPressed(Input.Keys.W))
      stage.moveCameraForward(speed * dt);
   if (Gdx.input.isKeyPressed(Input.Keys.A))
      stage.moveCameraRight(speed * dt);
   if (Gdx.input.isKeyPressed(Input.Keys.S))
      stage.moveCameraForward(-speed * dt);
   if (Gdx.input.isKeyPressed(Input.Keys.D))
      stage.moveCameraRight(-speed * dt);
}

Mouse movement is this simple line:

private void mousePolling() {
    turnBy(rotateSpeed * Gdx.input.getDeltaX() * BaseGame.mouseMovementSensitivity);
    stage.turnCamera(rotateSpeed * Gdx.input.getDeltaX() * BaseGame.mouseMovementSensitivity);
}

Collisions

While the game is 3D viewed from a birds perspective the area of movement is 2D, and thus we can implement a simple/standard 2D collision detection system using these functions found in BaseActor3D.java:

  • setBaseRectangle()
  • setBasePolygon()
  • getBoundaryPolygon()
  • overlaps(BaseActor3D other)
  • preventOverlap(BaseActor3D other)

Frustum Culling

demo

As explained in this blog one can save computer resources by only drawing the 3D world entities that are visible, this is called frustum culling. Feature added in this commit.

Ray Picking

image

Mathematically, a ray is the portion of a line that originates from a fixed point and extends indefinitely in a particular direction. A ray always travels in a straight line in a medium until it hits the boundary of the medium that it is traveling in.

Once it hits that boundary, it can either get reflected, refracted, absorbed, or undergo all three operations partially. >-- techcenturion.com

Ray picking was implemented following this tutorial and can be seen in this commit.

Tile Maps

Tile maps were implemented like so.

image

Directional Sprites

Eight directional sprites were added in this commit. The play can now circle an enemy and see it from behind, etc. This allows for gameplay where the enemy is not always facing the player ready to attack.

eight directional sprites example

Enemy Ray Picking

You don't need a camera to ray pick. The algorithm was expanded to support simple non-camera rays too =>

public static int getRayPickedListIndex(Vector3 origin, Vector3 direction, Array<BaseActor3D> list) {
    Ray ray = new Ray(origin, direction);
    return getClosestListIndex(ray, list);
}

public static int getRayPickedListIndex(int screenX, int screenY, Array<BaseActor3D> list, PerspectiveCamera camera) {
    Ray ray = camera.getPickRay(screenX, screenY);
    return getClosestListIndex(ray, list);
}

private static int getClosestListIndex(Ray ray, Array<BaseActor3D> list) {
    int index = -1;
    float distance = -1;
    for (int i = 0; i < list.size; ++i) {
        final float dist2 = list.get(i).modelData.intersects(ray);
        if (dist2 >= 0f && (distance < 0f || dist2 <= distance)) {
            index = i;
            distance = dist2;
        }
    }
    return index;
}

This allows for the enemy to scan for the player to detect them, and also to be able to shoot them. Raypicking should be used sparingly, this game runs the algorithm for all enemies not dead, facing the player, at it's own interval.

Pathfinding

LibGDX's AI library was included in this and this commits following this excellent tutorial. The pathfinding is a directional improvement upon Dijkstra's algorithm and enables us to tell the enemies where to go. This algorithm is used sparingly whenever there is a sound the enemy should respond to or get the last position of the player's last sighting. This opens up more interesting gameplay.

Dijkstra's improved algorithm A*

Decals

A decal is a 2D image in a 3D world. In this project it's used to generate an effect where the bullet hits stuff, e.g. a wall. This project implements this with a parent class manager that can be extended, and then used like so.

Vector3 temp = new Vector3().set(ray.direction).scl(player.distanceBetween(shootable.get(i)) - (Tile.diagonalLength / 2)).add(ray.origin);
bulletDecals.addDecal(temp.x, temp.y, temp.z);

This code will get the wall's position, and create a new Decal at roughly the wall's facing surface.

Camera Rolling

For a lean-into-walking-direction effect: roll demo camera-movement

private void keyboardPolling(float dt) {
    if (Gdx.input.isKeyPressed(Keys.A))
        rollAngle = MathUtils.clamp(rollAngle -= ROLL_INCREMENT, -ROLL_ANGLE_MAX, ROLL_ANGLE_MAX);

    if (Gdx.input.isKeyPressed(Keys.D))
        rollAngle = MathUtils.clamp(rollAngle += ROLL_INCREMENT, -ROLL_ANGLE_MAX, ROLL_ANGLE_MAX);

    if (!Gdx.input.isKeyPressed(Keys.A) && !Gdx.input.isKeyPressed(Keys.D)) {
      if (rollAngle > 0)
          rollAngle -= ROLL_INCREMENT;
      else if (rollAngle < 0)
          rollAngle += ROLL_INCREMENT;
    }
}   
public void rollCamera(float angle) {
    camera.up.set(Vector3.X);
    camera.rotate(camera.direction, angle);
}

Level Design

Some level design facets that are used are:

  • lights
  • affordances
  • visual guidance
  • pickups
  • pacing (remember downbeats)
  • leading lines
  • local landmarks
  • avoid straights
  • junctions
  • choices of traversal
  • gating
  • bread crumbs
  • negative space
  • readability (is it easy to know where to go?)
  • environmental storytelling
  • illusion of space

These, and more, are covered in this book.

image

Convert .jar to .exe

Follow this tutorial to do so. To automate this process checkout the desktop build file.

Alternatively use packr with the following commands

java -jar packr-all-4.0.0.jar 
--platform "windows64" 
--jdk "C:\Program Files\Java\jdk-15.0.1" 
--useZgcIfSupportedOs 
--executable "Terfenstein 3D" 
--classpath "C:\Users\Sandra Moen\dev\Terfenstein 3D\source code\desktop\build\lib\Terfenstein 3D.jar" 
--mainclass "no.sandramoen.terfenstein3D.DesktopLauncher" 
--resources "C:\Users\Sandra Moen\dev\Terfenstein 3D\source code\assets" 
--output "C:\Users\Sandra Moen\Desktop\Terfenstein 3D\packr build files"

Other

For other project specifics check out the commits.

Go back to the top.

About

⭐ My first 3D shooter game, made with LibGDX ⭐

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

 

Languages