Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
53 changes: 53 additions & 0 deletions 3d/first_person_shooter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# First-Person Shooter

This is a demo implementing a retro-styled first-person shooter with a 2.5D
aesthetic (level is 3D, but enemies are 2D sprites).

Controls:

- Mouse, arrow keys or <kbd>Gamepad Right Stick</kbd>: Look around
- <kbd>W</kbd>, <kbd>Gamepad Left Stick</kbd>: Move forward
- <kbd>S</kbd>, <kbd>Gamepad Left Stick</kbd>: Move backward
- <kbd>A</kbd>, <kbd>Gamepad Left Stick</kbd>: Move left
- <kbd>D</kbd>, <kbd>Gamepad Left Stick</kbd>: Move right
- <kbd>Space</kbd>, <kbd>Right mouse button</kbd>, <kbd>Gamepad A/Cross</kbd>: Jump
- <kbd>Left mouse button</kbd>, <kbd>Gamepad Right Trigger</kbd>: Attack (or respawn if dead)
- <kbd>F</kbd>, <kbd>Thumb mouse buttons</kbd>, <kbd>Gamepad B/Circle</kbd>: Toggle flashlight
- <kbd>Escape</kbd>, <kbd>Gamepad D-Pad Up</kbd>: Quit

Language: GDScript

Renderer: Forward Plus

## How does it work?

The base vehicle uses a
[`VehicleBody`](https://docs.godotengine.org/en/latest/classes/class_vehiclebody.html)
node. The trailer truck is tied together using a
[`ConeJointTwist`](https://docs.godotengine.org/en/latest/classes/class_conetwistjoint.html)
node, and the tow truck is tried together using a chain made of
[`RigidBody`](https://docs.godotengine.org/en/latest/classes/class_rigidbody.html)
nodes which are pinned together using
[`PinJoint`](https://docs.godotengine.org/en/latest/classes/class_pinjoint.html) nodes.

## Screenshot

![Screenshot](screenshots/first_person_shooter.webp)

## License

- `player/shotgun/spritesheet.png`, `player/shotgun/*.wav` and
`enemy/spritesheet.png` are Copyright © 2001-2022
[Contributors to the Freedoom project](https://freedoom.github.io/)
and are licensed under
[3-clause BSD](https://github.com/freedoom/freedoom/blob/master/COPYING.adoc).
- `player/water_splash_in.ogg` and `player/water_splash_out.ogg` are Copyright ©
2009-2019 [Red Eclipse Team](https://www.redeclipse.net/) and are licensed under
[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)
- `player/rain.ogg` is
[Copyright © Paul Hertz ("ignotus")](https://freesound.org/people/ignotus/sounds/14779/)
and is licensed under
[CC BY 3.0](https://creativecommons.org/licenses/by/3.0/).
- `fonts/vga-rom-font.png` is edited from
<https://doomwiki.org/wiki/File:Vga-rom-font.png>, which is considered to be
ineligible for copyright and therefore in the public domain.
15 changes: 15 additions & 0 deletions 3d/first_person_shooter/addons/bsp_importer/bsp_editor_plugin.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@tool
extends EditorPlugin


var import_plugin


func _enter_tree():
import_plugin = preload("bsp_importer_plugin.gd").new()
add_import_plugin(import_plugin)


func _exit_tree():
remove_import_plugin(import_plugin)
import_plugin = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://mcabx7bw2p6k
63 changes: 63 additions & 0 deletions 3d/first_person_shooter/addons/bsp_importer/bsp_import_preset.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
extends Resource

class_name BSPImportPreset

## Number of Quake units per meter
@export var inverse_scale_factor := 32.0
## Flags the BSP Reader will ignore when generating geometry (Quake 2 Only)
@export var ignored_flags : PackedInt64Array = []
## If true, automatically generate materials from the textures.
@export var generate_texture_materials := true
## {texture_name} will be replaced by the texture name in the BSP file.
@export var material_path_pattern := "res://materials/{texture_name}_material.tres"
## Optional texture name to material remapping dictionary
@export var texture_material_rename := { &"texture_name1_example" : "res://material/texture_name1_material.tres" }
## Will write the material and texture files generated from the BSP file.
@export var save_separate_materials := true
## Generate a new matertial to replace existing one (useful if you update palette or textures compiled into BSP file).
@export var overwrite_existing_materials := false
## {texture_name} will be replaced by the texture name in the BSP file.
@export var texture_path_pattern := "res://textures/{texture_name}.png"
## {texture_name} will be replaced by the texture name in the BSP file.
@export var texture_emission_path_pattern := "res://textures/{texture_name}_emission.png"
## Optional texture name to material remapping dictionary
@export var texture_path_remap := { &"texture_name1_example" : "res://textures/texture_name1_example.png" }
## "{" is the default transparency texture indicator for Quake. This will be stripped off the name and allow the texture to be used as a transparent surface.
@export var transparent_texture_prefix := "{"
## Palette .lmp file used when loading paletted textures.
@export var palette_palette_path := "res://textures/palette.lmp"
## Range of colors that willl be fullbright (emission). Usually the last 32 colors.
@export var fullbright_range : PackedInt32Array = [224, 255]
## Will overwrite texture png files with the ones loaded from the BSP File. Be careful with this! Useful if you need to change the palette
@export var overwrite_existing_textures := false
## Water brushes from the BSP file will be replaced with this scene. It should have an Area3D as the root. Brush collision will be added as children.
@export var water_scene_template : PackedScene = preload("res://addons/bsp_importer/examples/water_example_template.tscn")
## Slime brushes from the BSP file will be replaced with this scene. It should have an Area3D as the root. Brush collision will be added as children.
@export var slime_scene_template : PackedScene = preload("res://addons/bsp_importer/examples/slime_example_template.tscn")
## Lava brushes from the BSP file will be replaced with this scene. It should have an Area3D as the root. Brush collision will be added as children.
@export var lava_scene_template : PackedScene = preload("res://addons/bsp_importer/examples/lava_example_template.tscn")
## Entities from the BSP file will use this scene, with {classname} replaced by the the class name string. Use the entity remap if you want to map to specific scenes with different instead. Brush entities should have a CharacterBody3D (or some other body) as the root. Collisions from brushes will be added as children.
@export var entity_path_pattern := "res://entities/{classname}.tscn"
## Remaps an entity classname to a scene. Brush entities should have a CharacterBody3D (or some other body) as the root. Collisions from brushes will be added as children.
@export var entity_remap := { &"trigger_example" : preload("res://addons/bsp_importer/examples/trigger_example.tscn") }
## Some entities, such as health packs, are not centered, or you might need to offset them with this classname to vector3 offset dictionary. Uses Quake units.
@export var entity_offsets_quake_units := { &"example_offset_entity_classname" : Vector3(16, 16, 0) }
## If true, light entities will import as omnilights.
@export var import_lights := true
## Light Brightness Scale
@export var light_brightness_scale := 16.0
## If true, will generate an occlusion mesh from the worldspawn to help cull out lights and objects behind walls.
@export var generate_occlusion_culling := true
## List of textures to exclude from the occlusion culling mesh. Anything with transparency (grates, fences, etc) should be added here.
@export var culling_textures_exclude : Array[StringName] = []
#@export var generate_shadow_mesh := true # This doesn't work properly, yet.
## Break the world down into chunks based on a grid size. This was an experiment to try to improve performance by culling out other rooms but seemed to perform worse, so I'd recommend leaving it off.
@export var separate_mesh_on_grid := false
## Size of grid chunks
@export var mesh_separation_grid_size := 256.0
## If true, use triangle collision from the visual geometry instead of convex brush collisions. Faster to import, but usually slower for the physics performance.
@export var use_triangle_collision := false
## If true, the error message when importing a missing entity will not be printed.
@export var ignore_missing_entities := false
## Script to execute after importing for any custom post-import cleanup.
@export_file("*.gd") var post_import_script := ""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://bblkqbg3tu5cm
Loading
Loading