Skip to content

This is a simple First-Person Shooter (FPS) simulator implemented in C++ using console graphics. It uses Wolfenstein's ray casting algorithm to render a 3D-like environment in the console window.

Notifications You must be signed in to change notification settings

invalid007/First-Person-Simulator-Cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

First Person Simulator Engine

This is a simple First-Person Shooter (FPS) simulator implemented in C++ using console graphics. It uses Wolfenstein's ray casting algorithm to render a 3D-like environment in the console window.

www_screencapture_com_2024-6-8_18_26.mp4

Features

  • Basic 3D rendering using ray casting
  • Simple movement controls (W, A, S, D)
  • Basic collision detection with walls

Simple_raycasting_with_fisheye_correction

-A simple ray casting rendering similar to the Wolfenstein 3D engine. The red dot is the player's location. The orange area represents the player's field of view.

Screenshot 2024-06-08 172327

Requirements

  • Windows OS
  • Visual Studio (or any other C++ compiler supporting Windows API)
  • Unicode support in the console

Getting Started

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/fps-simulator.git
    cd fps-simulator
  2. Open the project in your C++ development environment (e.g., Visual Studio).

  3. Build the project.

Running the Simulator

After building the project, you can run the executable. The simulator will open in a console window.

Controls

  • W: Move forward
  • S: Move backward
  • A: Rotate left
  • D: Rotate right

Code Overview

Main Components

  • Screen Buffer: A character array (wchar_t* screen) used to render the display.
  • Map: A simple string representation of the game world, where # represents walls and . represents open space.
  • Player: The player has a position (fPlayerX, fPlayerY) and an angle (fPlayerA).

Game Loop

  1. Input Handling: Reads the input from the user to move and rotate the player.
  2. Ray Casting: Utilizes Wolfenstein's ray casting algorithm to determine the distance to the nearest wall for each column of the screen.
  3. Rendering: Fills the screen buffer with the appropriate characters to represent walls, floors, and the player.

Key Functions

  • Ray Casting: Determines the distance from the player to the nearest wall for each column of the screen using Wolfenstein's ray casting technique.
  • Collision Detection: Prevents the player from moving through walls.
  • Rendering: Updates the screen buffer with the current game state and displays it.

About

This is a simple First-Person Shooter (FPS) simulator implemented in C++ using console graphics. It uses Wolfenstein's ray casting algorithm to render a 3D-like environment in the console window.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages