by Lumino
Simple 3D Horror Game
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)
Simple 3D Horror Game
Created: | Last Updated:
Here's a step-by-step guide for using the Simple 3D Horror Game template:
Introduction
This template provides a basic structure for a first-person 3D horror game using WebGL and Three.js. The game features player movement, a flashlight mechanic, and random jumpscares.
Getting Started
-
Click "Start with this Template" to begin using this template in the Lazy Builder interface.
-
Press the "Test" button to deploy the application. This will launch the Lazy CLI and start the deployment process.
-
Once the deployment is complete, you'll receive a dedicated server link to access the game.
Using the Game
When you open the game link in your browser, you'll see a 3D environment with trees. Here's how to interact with the game:
- Click on the game window to enable mouse control for looking around.
- Use the WASD keys to move:
- W: Move forward
- A: Move left
- S: Move backward
- D: Move right
- Press the Spacebar to jump
- Press F to toggle the flashlight on/off
- Hold Shift to sprint (limited by stamina)
The game features a dark, foggy environment with randomly placed trees. You'll hear ambient sounds and footsteps as you move. Random jumpscares will occur periodically, displaying a scary image and playing a sound effect.
Customizing the Game
To customize the game, you can modify the following elements in the code:
- Adjust game parameters:
- Change
moveSpeed
,sprintSpeed
,jumpForce
, orgravity
to alter player movement. - Modify
mapSize
andnumberOfTrees
to change the environment size and density. -
Adjust
fogNearWithoutFlashlight
andfogFarWithoutFlashlight
to change visibility. -
Replace textures and sounds:
-
Update the URLs for ground texture, tree textures, ambient sound, footstep sound, flashlight sound, and jumpscare image/sound to customize the game's look and feel.
-
Modify the jumpscare behavior:
- Adjust the
minDelay
andmaxDelay
in thescheduleJumpscare
function to change the frequency of jumpscares.
Remember to test your changes by pressing the "Test" button after making modifications to ensure everything works as expected.
Integrating the Game
This game runs as a standalone web application. To integrate it into a website or share it with others:
- After deployment, Lazy will provide you with a dedicated server link.
- You can share this link directly with users who want to play the game.
- To embed the game in a website, you can use an iframe. For example:
```html
```
Replace YOUR_LAZY_APP_URL
with the actual URL provided by Lazy after deployment.
By following these steps, you'll have a basic 3D horror game up and running, which you can further customize and share with others.