Initial commit
This commit is contained in:
commit
9b47e374c7
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
* text=auto eol=lf
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
15
.gitignore
vendored
Normal file
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
*
|
||||
!*/
|
||||
!*.go
|
||||
!*.mod
|
||||
!*.sum
|
||||
!*.md
|
||||
!*.gd
|
||||
!*.import
|
||||
!*.svg
|
||||
!*.tres
|
||||
!*.tscn
|
||||
!.gitignore
|
||||
!.gitattributes
|
||||
!project.godot
|
||||
.godot/
|
10
client/Client.gd
Normal file
10
client/Client.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends Node
|
||||
|
||||
const PLAYER = preload("res://player/Player.tscn")
|
||||
var udp := PacketPeerUDP.new()
|
||||
|
||||
func _ready():
|
||||
udp.connect_to_host("127.0.0.1", 4242)
|
||||
var player = PLAYER.instantiate()
|
||||
add_child(player)
|
||||
print("Ready.")
|
7
player/Player.gd
Normal file
7
player/Player.gd
Normal file
@ -0,0 +1,7 @@
|
||||
extends Node3D
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
rotate_y(delta)
|
12
player/Player.tscn
Normal file
12
player/Player.tscn
Normal file
@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://2lcnu3dy54lx"]
|
||||
|
||||
[ext_resource type="Script" path="res://player/Player.gd" id="1_8gebs"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_8125v"]
|
||||
|
||||
[node name="Player" type="Node3D" groups=["Player"]]
|
||||
script = ExtResource("1_8gebs")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
|
||||
mesh = SubResource("BoxMesh_8125v")
|
94
project.godot
Normal file
94
project.godot
Normal file
@ -0,0 +1,94 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Battle of Mages"
|
||||
run/main_scene="res://world/World.tscn"
|
||||
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||
config/icon="res://ui/icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
Client="*res://client/Client.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/vsync/vsync_mode=0
|
||||
|
||||
[gui]
|
||||
|
||||
theme/custom="res://ui/theme.tres"
|
||||
|
||||
[input]
|
||||
|
||||
move_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_forward={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_backward={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
jump={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
toggle_fullscreen={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":true,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194342,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
shoot={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
aim={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
crouch={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
menu={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
17
server/core/Client.go
Normal file
17
server/core/Client.go
Normal file
@ -0,0 +1,17 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Client represents a UDP client.
|
||||
type Client struct {
|
||||
address *net.UDPAddr
|
||||
lastPacket time.Time
|
||||
}
|
||||
|
||||
// String shows the client address.
|
||||
func (c *Client) String() string {
|
||||
return c.address.String()
|
||||
}
|
115
server/core/Server.go
Normal file
115
server/core/Server.go
Normal file
@ -0,0 +1,115 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Handler is a byte code specific packet handler.
|
||||
type Handler func([]byte, *Client)
|
||||
|
||||
// Server represents a UDP server.
|
||||
type Server struct {
|
||||
socket *net.UDPConn
|
||||
clients map[string]*Client
|
||||
handlers [256]Handler
|
||||
}
|
||||
|
||||
// New creates a new server.
|
||||
func New() *Server {
|
||||
return &Server{
|
||||
clients: make(map[string]*Client),
|
||||
}
|
||||
}
|
||||
|
||||
// AddHandler adds the handler for the given byte code.
|
||||
func (s *Server) AddHandler(code byte, handler Handler) {
|
||||
s.handlers[code] = handler
|
||||
}
|
||||
|
||||
// SendTo sends the data to a client.
|
||||
func (s *Server) SendTo(data []byte, client *Client) {
|
||||
_, err := s.socket.WriteToUDP(data, client.address)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Error sending response:", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Run starts the server on the given port.
|
||||
func (s *Server) Run(port int) {
|
||||
s.socket = listen(port)
|
||||
defer s.socket.Close()
|
||||
|
||||
s.read()
|
||||
}
|
||||
|
||||
// listen creates a socket for the server and starts listening for incoming packets.
|
||||
func listen(port int) *net.UDPConn {
|
||||
addr, err := net.ResolveUDPAddr("udp", fmt.Sprintf(":%d", port))
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
connection, err := net.ListenUDP("udp", addr)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return connection
|
||||
}
|
||||
|
||||
// read is a blocking call which will read incoming packets and handle them.
|
||||
func (s *Server) read() {
|
||||
buffer := make([]byte, 4096)
|
||||
|
||||
for {
|
||||
n, addr, err := s.socket.ReadFromUDP(buffer)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Error reading from UDP connection:", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if n == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
go s.handle(buffer[:n], addr)
|
||||
}
|
||||
}
|
||||
|
||||
// handle deals with an incoming packet.
|
||||
func (s *Server) handle(data []byte, addr *net.UDPAddr) {
|
||||
c := s.getClient(addr)
|
||||
c.lastPacket = time.Now()
|
||||
// fmt.Printf("Received %d bytes from %s: %s\n", len(data), c, string(data))
|
||||
|
||||
handler := s.handlers[data[0]]
|
||||
|
||||
if handler == nil {
|
||||
fmt.Println("Unknown packet type.")
|
||||
return
|
||||
}
|
||||
|
||||
handler(data, c)
|
||||
}
|
||||
|
||||
// getClient either returns a new or existing client for the requested address.
|
||||
func (s *Server) getClient(addr *net.UDPAddr) *Client {
|
||||
c, exists := s.clients[addr.String()]
|
||||
|
||||
if exists {
|
||||
return c
|
||||
}
|
||||
|
||||
c = &Client{
|
||||
address: addr,
|
||||
}
|
||||
|
||||
s.clients[addr.String()] = c
|
||||
return c
|
||||
}
|
3
server/go.mod
Normal file
3
server/go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module server
|
||||
|
||||
go 1.21.6
|
17
server/main.go
Normal file
17
server/main.go
Normal file
@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"server/core"
|
||||
)
|
||||
|
||||
func main() {
|
||||
server := core.New()
|
||||
|
||||
server.AddHandler(0, func(data []byte, client *core.Client) {
|
||||
// count := data[1]
|
||||
// fmt.Println(count)
|
||||
server.SendTo(data, client)
|
||||
})
|
||||
|
||||
server.Run(4242)
|
||||
}
|
8
ui/FPS.gd
Normal file
8
ui/FPS.gd
Normal file
@ -0,0 +1,8 @@
|
||||
extends Label
|
||||
|
||||
func _ready():
|
||||
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)
|
||||
|
||||
func _process(_delta):
|
||||
var fps = Engine.get_frames_per_second()
|
||||
text = str(fps)
|
38
ui/Ping.gd
Normal file
38
ui/Ping.gd
Normal file
@ -0,0 +1,38 @@
|
||||
extends Label
|
||||
|
||||
const HISTORY_SIZE = 8
|
||||
|
||||
var pingCount := 0
|
||||
var pingSent: Array[float] = []
|
||||
|
||||
func _ready():
|
||||
var timer := Timer.new()
|
||||
add_child(timer)
|
||||
timer.autostart = true
|
||||
timer.wait_time = 1
|
||||
timer.connect("timeout", self._ping)
|
||||
timer.start()
|
||||
|
||||
pingSent.resize(HISTORY_SIZE)
|
||||
|
||||
func _process(_delta):
|
||||
if Client.udp.get_available_packet_count() > 0:
|
||||
#print("Received: %s" % udp.get_packet().get_string_from_utf8())
|
||||
var bytes := Client.udp.get_packet()
|
||||
var count := bytes.decode_u8(1)
|
||||
var timeSent := pingSent[count]
|
||||
var duration := Time.get_unix_time_from_system() - timeSent
|
||||
var ping := duration * 1000
|
||||
text = str(snapped(ping, 0.01))
|
||||
|
||||
func _ping():
|
||||
var buffer := StreamPeerBuffer.new()
|
||||
buffer.put_8(0)
|
||||
buffer.put_8(pingCount)
|
||||
Client.udp.put_packet(buffer.data_array)
|
||||
|
||||
pingSent[pingCount] = Time.get_unix_time_from_system()
|
||||
pingCount += 1
|
||||
|
||||
if pingCount >= HISTORY_SIZE:
|
||||
pingCount = 0
|
41
ui/UI.tscn
Normal file
41
ui/UI.tscn
Normal file
@ -0,0 +1,41 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bxotvk73tbgw0"]
|
||||
|
||||
[ext_resource type="Script" path="res://ui/FPS.gd" id="1_128dk"]
|
||||
[ext_resource type="Script" path="res://ui/Ping.gd" id="2_m7fhx"]
|
||||
|
||||
[node name="UI" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer"]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 50.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FPSLabel" type="Label" parent="CanvasLayer/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "FPS:"
|
||||
|
||||
[node name="FPS" type="Label" parent="CanvasLayer/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "0"
|
||||
script = ExtResource("1_128dk")
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="CanvasLayer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PingLabel" type="Label" parent="CanvasLayer/MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Ping:"
|
||||
|
||||
[node name="Ping" type="Label" parent="CanvasLayer/MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "0"
|
||||
script = ExtResource("2_m7fhx")
|
1
ui/icon.svg
Normal file
1
ui/icon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>
|
After Width: | Height: | Size: 950 B |
37
ui/icon.svg.import
Normal file
37
ui/icon.svg.import
Normal file
@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://biplb56hj51h7"
|
||||
path="res://.godot/imported/icon.svg-57a480398ce0db3d1582eb3ec78dffaa.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ui/icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-57a480398ce0db3d1582eb3ec78dffaa.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
10
ui/theme.tres
Normal file
10
ui/theme.tres
Normal file
@ -0,0 +1,10 @@
|
||||
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://caqphxkvcu3tb"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://b7mov13kwi8u8" path="res://ui/ubuntu_nf_regular.ttf" id="1_1unma"]
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource("1_1unma")
|
||||
MarginContainer/constants/margin_bottom = 5
|
||||
MarginContainer/constants/margin_left = 5
|
||||
MarginContainer/constants/margin_right = 5
|
||||
MarginContainer/constants/margin_top = 5
|
38
ui/ubuntu_nf_regular.ttf.import
Normal file
38
ui/ubuntu_nf_regular.ttf.import
Normal file
@ -0,0 +1,38 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://b7mov13kwi8u8"
|
||||
path="res://.godot/imported/ubuntu_nf_regular.ttf-feed7a5a59b6d10a4a32843efe52a9da.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ui/ubuntu_nf_regular.ttf"
|
||||
dest_files=["res://.godot/imported/ubuntu_nf_regular.ttf-feed7a5a59b6d10a4a32843efe52a9da.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[{
|
||||
"chars": [],
|
||||
"glyphs": [],
|
||||
"name": "New Configuration",
|
||||
"size": Vector2i(16, 0)
|
||||
}]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
3
world/CameraAttributes.tres
Normal file
3
world/CameraAttributes.tres
Normal file
@ -0,0 +1,3 @@
|
||||
[gd_resource type="CameraAttributesPractical" format=3 uid="uid://b835orxyqq6w5"]
|
||||
|
||||
[resource]
|
8
world/Environment.tres
Normal file
8
world/Environment.tres
Normal file
@ -0,0 +1,8 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=3 uid="uid://dixa0yso2s1u3"]
|
||||
|
||||
[ext_resource type="Sky" uid="uid://b0q75qnaj0r5h" path="res://world/Sky.tres" id="1_utnj1"]
|
||||
|
||||
[resource]
|
||||
sky = ExtResource("1_utnj1")
|
||||
ambient_light_source = 3
|
||||
reflected_light_source = 2
|
4
world/ProceduralSky.tres
Normal file
4
world/ProceduralSky.tres
Normal file
@ -0,0 +1,4 @@
|
||||
[gd_resource type="ProceduralSkyMaterial" format=3 uid="uid://b7q6crweeh3jv"]
|
||||
|
||||
[resource]
|
||||
ground_bottom_color = Color(0.0313726, 0.0470588, 0.160784, 1)
|
6
world/Sky.tres
Normal file
6
world/Sky.tres
Normal file
@ -0,0 +1,6 @@
|
||||
[gd_resource type="Sky" load_steps=2 format=3 uid="uid://b0q75qnaj0r5h"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://b7q6crweeh3jv" path="res://world/ProceduralSky.tres" id="1_7mt7h"]
|
||||
|
||||
[resource]
|
||||
sky_material = ExtResource("1_7mt7h")
|
21
world/World.gd
Normal file
21
world/World.gd
Normal file
@ -0,0 +1,21 @@
|
||||
extends Node
|
||||
|
||||
func _ready():
|
||||
# Capture mouse
|
||||
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
# Mute audio
|
||||
var master_sound = AudioServer.get_bus_index("Master")
|
||||
AudioServer.set_bus_mute(master_sound, true)
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("toggle_fullscreen"):
|
||||
var mode = DisplayServer.window_get_mode()
|
||||
|
||||
match mode:
|
||||
DisplayServer.WINDOW_MODE_FULLSCREEN:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
_:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
|
||||
return
|
22
world/World.tscn
Normal file
22
world/World.tscn
Normal file
@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b40y7iuskv1ar"]
|
||||
|
||||
[ext_resource type="Script" path="res://world/World.gd" id="1_2lci4"]
|
||||
[ext_resource type="Environment" uid="uid://dixa0yso2s1u3" path="res://world/Environment.tres" id="1_qb8w4"]
|
||||
[ext_resource type="CameraAttributesPractical" uid="uid://b835orxyqq6w5" path="res://world/CameraAttributes.tres" id="2_1nt3m"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxotvk73tbgw0" path="res://ui/UI.tscn" id="4_c6x8y"]
|
||||
|
||||
[node name="World" type="Node"]
|
||||
script = ExtResource("1_2lci4")
|
||||
|
||||
[node name="UI" parent="." instance=ExtResource("4_c6x8y")]
|
||||
|
||||
[node name="Camera" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5)
|
||||
fov = 90.0
|
||||
|
||||
[node name="Sun" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.904299, 0.26004, -0.33856, 0, 0.793066, 0.609135, 0.4269, -0.55084, 0.717169, 0, 0, 0)
|
||||
|
||||
[node name="Environment" type="WorldEnvironment" parent="."]
|
||||
environment = ExtResource("1_qb8w4")
|
||||
camera_attributes = ExtResource("2_1nt3m")
|
Loading…
Reference in New Issue
Block a user