Fresh start: replace with naxIO/netfox-cs-sample foundation
Complete replacement of the tactical-shooter project with the netfox-cs-sample (MIT) — a CS 1.6 inspired multiplayer FPS built with Godot 4 and netfox. ## What's new - Full CS-style gameplay: teams (T/CT), rounds, economy, buy menu - 6 weapons: Knife, Glock, USP, AK-47, M4A1, AWP - Bomb plant/defuse with 2 bombsites - Flashbang & smoke grenades - Proper netfox rollback netcode at 64 tick - Network popup UI for host/join - HUD, crosshair, round timer, scoreboard - All netfox singletons registered as autoloads (works in exported builds) ## Architecture - Listen-server (host from client, no dedicated server binary) - Multiplayer-fps game lives at examples/multiplayer-fps/ - Netfox addons registered as autoloads for exported build compat - Godot 4.7 with Forward+ renderer ## Removed - Old headless-server architecture (client_main, server_main, player.gd, etc.) - Custom netfox bootstrap with ENet fallback - Old ChaffGames FPS template (2,420 lines, 844 KB) - SimulationServer GDExtension stub - Godot-jolt physics (netfox sample uses default Godot physics) - Duplicate weapon_data.gd, anti_cheat.gd, round_manager.gd, etc. - Server browser API Python venv (87 MB) - test_range map and modular assets ## Preserved - Git history - Server config at config/default_server_config.cfg - Windows export preset - Build directory (gitignored) Co-authored-by: naxIO <naxIO@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
extends VestTest
|
||||
|
||||
func get_suite_name() -> String:
|
||||
return "BiMap"
|
||||
|
||||
func suite():
|
||||
test("should return by key", func():
|
||||
var bimap := _BiMap.new()
|
||||
bimap.put(1, "foo")
|
||||
bimap.put(2, "bar")
|
||||
|
||||
expect_equal(bimap.get_by_key(1), "foo")
|
||||
)
|
||||
|
||||
test("should return by value", func():
|
||||
var bimap := _BiMap.new()
|
||||
bimap.put(1, "foo")
|
||||
bimap.put(2, "bar")
|
||||
|
||||
expect_equal(bimap.get_by_value("foo"), 1)
|
||||
)
|
||||
|
||||
test("should return null on unknown key", func():
|
||||
var bimap := _BiMap.new()
|
||||
bimap.put(1, "foo")
|
||||
bimap.put(2, "bar")
|
||||
|
||||
expect_equal(bimap.get_by_key(3), null)
|
||||
)
|
||||
|
||||
test("should return null on unknown value", func():
|
||||
var bimap := _BiMap.new()
|
||||
bimap.put(1, "foo")
|
||||
bimap.put(2, "bar")
|
||||
|
||||
expect_equal(bimap.get_by_value("quix"), null)
|
||||
)
|
||||
|
||||
test("should rewrite on known key", func():
|
||||
var bimap := _BiMap.new()
|
||||
bimap.put(1, "foo")
|
||||
bimap.put(2, "bar")
|
||||
|
||||
bimap.put(1, "quix")
|
||||
|
||||
expect_equal(bimap.get_by_key(1), "quix")
|
||||
expect_equal(bimap.get_by_value("foo"), null)
|
||||
)
|
||||
|
||||
test("should rewrite on known value", func():
|
||||
var bimap := _BiMap.new()
|
||||
bimap.put(1, "foo")
|
||||
bimap.put(2, "bar")
|
||||
|
||||
bimap.put(1, "quix")
|
||||
|
||||
expect_equal(bimap.get_by_value("quix"), 1)
|
||||
expect_equal(bimap.get_by_value("foo"), null)
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cmvjg7a72hjmg
|
||||
@@ -0,0 +1,40 @@
|
||||
extends VestTest
|
||||
|
||||
func get_suite_name() -> String:
|
||||
return "Bitset"
|
||||
|
||||
func suite():
|
||||
test("should be empty on create", func():
|
||||
var bits := _Bitset.new(2)
|
||||
expect_false(bits.get_bit(0))
|
||||
expect_false(bits.get_bit(1))
|
||||
)
|
||||
|
||||
test("get_set_indices()", func():
|
||||
var bits := _Bitset.of_bools([0, 1, 1, 0])
|
||||
expect_equal(bits.get_set_indices(), [1, 2])
|
||||
)
|
||||
|
||||
test("set_bit()", func():
|
||||
var bits := _Bitset.new(4)
|
||||
var expected := _Bitset.of_bools([0, 1, 0, 1])
|
||||
bits.set_bit(1)
|
||||
bits.set_bit(3)
|
||||
expect_equal(bits, expected)
|
||||
)
|
||||
|
||||
test("clear_bit()", func():
|
||||
var bits := _Bitset.of_bools([0, 1, 1, 0])
|
||||
var expected := _Bitset.of_bools([0, 0, 1, 0])
|
||||
bits.clear_bit(1)
|
||||
bits.clear_bit(3)
|
||||
expect_equal(bits, expected)
|
||||
)
|
||||
|
||||
test("toggle_bit()", func():
|
||||
var bits := _Bitset.of_bools([0, 1, 1, 0])
|
||||
var expected := _Bitset.of_bools([1, 0, 1, 0])
|
||||
bits.toggle_bit(0)
|
||||
bits.toggle_bit(1)
|
||||
expect_equal(bits, expected)
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bil8ugs8ol5h4
|
||||
@@ -0,0 +1,36 @@
|
||||
extends VestTest
|
||||
|
||||
func get_suite_name() -> String:
|
||||
return "Graph"
|
||||
|
||||
func suite():
|
||||
var cases := [
|
||||
["tiny", 16, 2, 2048],
|
||||
["medium", 128, 4, 2048],
|
||||
["large", 1024, 16, 2048]
|
||||
]
|
||||
|
||||
for case in cases:
|
||||
var name := case[0] as String
|
||||
var items := case[1] as int
|
||||
var depth := case[2] as int
|
||||
var batch := case[3] as int
|
||||
|
||||
test("queries - %s graph, %d / %d" % [name, items, depth], func():
|
||||
var graph := _Graph.new()
|
||||
for i in items:
|
||||
for j in depth:
|
||||
graph.link(i, i + j)
|
||||
|
||||
benchmark("get_linked_from()", func(__):
|
||||
var nodes := graph.get_linked_from(randi() % items)
|
||||
).with_duration(1.).with_batch_size(batch).run()
|
||||
|
||||
benchmark("get_linked_to()", func(__):
|
||||
var nodes := graph.get_linked_to(randi() % items)
|
||||
).with_duration(1.).with_batch_size(batch).run()
|
||||
|
||||
benchmark("has_link()", func(__):
|
||||
var nodes := graph.has_link(randi() % items, randi() % items)
|
||||
).with_duration(1.).with_batch_size(batch).run()
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
uid://brow8r8ya3xa0
|
||||
@@ -0,0 +1,48 @@
|
||||
extends VestTest
|
||||
|
||||
func get_suite_name() -> String:
|
||||
return "Graph"
|
||||
|
||||
func suite():
|
||||
test("should add link", func():
|
||||
var graph := _Graph.new()
|
||||
graph.link("foo", "bar")
|
||||
|
||||
expect_linked(graph, "foo", "bar")
|
||||
expect_equal(graph.get_linked_from("foo"), ["bar"])
|
||||
expect_equal(graph.get_linked_to("bar"), ["foo"])
|
||||
)
|
||||
|
||||
test("should remove link", func():
|
||||
var graph := _Graph.new()
|
||||
graph.link("foo", "bar")
|
||||
graph.link("quix", "baz")
|
||||
|
||||
graph.unlink("foo", "bar")
|
||||
|
||||
expect_unlinked(graph, "foo", "bar")
|
||||
expect_linked(graph, "quix", "baz")
|
||||
expect_empty(graph.get_linked_from("foo"))
|
||||
expect_empty(graph.get_linked_to("bar"))
|
||||
)
|
||||
|
||||
test("should erase", func():
|
||||
var graph := _Graph.new()
|
||||
graph.link("foo", "bar")
|
||||
graph.link("foo", "baz")
|
||||
graph.link("quix", "baz")
|
||||
graph.link("oof", "foo")
|
||||
|
||||
graph.erase("foo")
|
||||
|
||||
expect_unlinked(graph, "foo", "bar")
|
||||
expect_unlinked(graph, "foo", "baz")
|
||||
expect_unlinked(graph, "oof", "foo")
|
||||
expect_linked(graph, "quix", "baz")
|
||||
)
|
||||
|
||||
func expect_linked(graph: _Graph, from: Variant, to: Variant):
|
||||
expect(graph.has_link(from, to), "Link %s -> %s was not present!")
|
||||
|
||||
func expect_unlinked(graph: _Graph, from: Variant, to: Variant):
|
||||
expect_not(graph.has_link(from, to), "Link %s -> %s was present!" % [from, to])
|
||||
@@ -0,0 +1 @@
|
||||
uid://dm1d6ldar45q8
|
||||
@@ -0,0 +1,69 @@
|
||||
extends VestTest
|
||||
|
||||
func get_suite_name() -> String:
|
||||
return "HistoryBuffer"
|
||||
|
||||
func suite() -> void:
|
||||
var empty_buffer := _HistoryBuffer.new()
|
||||
var filled_buffer := _HistoryBuffer.of(16, { 2: "foo", 4: "bar", 8: "baz" })
|
||||
|
||||
define("get latest", func():
|
||||
test("should not have latest if empty", func():
|
||||
expect_not(empty_buffer.has_at(16))
|
||||
expect_not(empty_buffer.has_latest_at(16))
|
||||
)
|
||||
|
||||
test("should not have latest out of bounds", func():
|
||||
expect_not(filled_buffer.has_latest_at(0))
|
||||
)
|
||||
|
||||
test("should return self on known item", func():
|
||||
expect_equal(filled_buffer.get_latest_index_at(2), 2)
|
||||
expect_equal(filled_buffer.get_latest_index_at(4), 4)
|
||||
expect_equal(filled_buffer.get_latest_index_at(8), 8)
|
||||
)
|
||||
|
||||
test("should return latest on unknown", func():
|
||||
expect_equal(filled_buffer.get_latest_index_at(3), 2)
|
||||
expect_equal(filled_buffer.get_latest_index_at(5), 4)
|
||||
expect_equal(filled_buffer.get_latest_index_at(9), 8)
|
||||
)
|
||||
)
|
||||
|
||||
define("set_at()", func():
|
||||
test("should set behind tail", func():
|
||||
var buffer := filled_buffer.duplicate()
|
||||
buffer.set_at(1, 4)
|
||||
expect(buffer.has_at(1))
|
||||
)
|
||||
|
||||
test("should not set behind limit", func():
|
||||
var buffer := filled_buffer.duplicate()
|
||||
buffer.set_at(-64, 4)
|
||||
expect_not(buffer.has_at(-64))
|
||||
)
|
||||
|
||||
test("should update prev buffer if in bounds", func():
|
||||
var buffer := filled_buffer.duplicate()
|
||||
buffer.set_at(6, "quoo")
|
||||
expect_not(buffer.has_at(7))
|
||||
expect(buffer.has_latest_at(7))
|
||||
expect_equal(buffer.get_latest_at(7), "quoo")
|
||||
)
|
||||
|
||||
test("should update prev buffer if after head", func():
|
||||
var buffer := filled_buffer.duplicate()
|
||||
buffer.set_at(14, "quoo")
|
||||
expect_not(buffer.has_at(11))
|
||||
expect(buffer.has_latest_at(11))
|
||||
expect_equal(buffer.get_latest_at(11), "baz")
|
||||
)
|
||||
|
||||
test("should jump if way after head", func():
|
||||
var buffer := filled_buffer.duplicate()
|
||||
buffer.set_at(130, "quoo")
|
||||
expect_not(buffer.has_at(8))
|
||||
expect_not(buffer.has_latest_at(8))
|
||||
expect_equal(buffer.size(), 1)
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
uid://d0u5k1vxoddjo
|
||||
@@ -0,0 +1,30 @@
|
||||
extends VestTest
|
||||
|
||||
func get_suite_name() -> String:
|
||||
return "IntervalScheduler"
|
||||
|
||||
func suite() -> void:
|
||||
test("should never schedule on zero interval", func():
|
||||
var interval := _IntervalScheduler.new(0)
|
||||
expect_false(interval.is_now())
|
||||
expect_false(interval.is_now())
|
||||
expect_false(interval.is_now())
|
||||
)
|
||||
|
||||
test("should always schedule on one interval", func():
|
||||
var interval := _IntervalScheduler.new(1)
|
||||
expect_true(interval.is_now())
|
||||
expect_true(interval.is_now())
|
||||
expect_true(interval.is_now())
|
||||
)
|
||||
|
||||
test("should schedule on interval", func():
|
||||
var interval := _IntervalScheduler.new(3)
|
||||
expect_false(interval.is_now())
|
||||
expect_false(interval.is_now())
|
||||
expect_true(interval.is_now())
|
||||
|
||||
expect_false(interval.is_now())
|
||||
expect_false(interval.is_now())
|
||||
expect_true(interval.is_now())
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
uid://014vcn6wjlpc
|
||||
@@ -0,0 +1,122 @@
|
||||
extends VestTest
|
||||
|
||||
func get_suite_name() -> String:
|
||||
return "Set"
|
||||
|
||||
#region add() + values()
|
||||
func test_add_should_persist() -> void:
|
||||
# Given
|
||||
var set := _Set.new()
|
||||
var expected := [2, "foo"]
|
||||
|
||||
# When
|
||||
set.add(2)
|
||||
set.add("foo")
|
||||
|
||||
# Then
|
||||
expect_equal(set.values(), expected)
|
||||
expect_equal(set.size(), 2)
|
||||
expect(not set.is_empty())
|
||||
|
||||
#endregion
|
||||
|
||||
#region has()
|
||||
func test_should_have_known_items() -> void:
|
||||
# Given
|
||||
var set := _Set.new()
|
||||
set.add(2)
|
||||
|
||||
# When + Then
|
||||
expect(set.has(2))
|
||||
|
||||
func test_should_not_have_unknown_items() -> void:
|
||||
# Given
|
||||
var set := _Set.new()
|
||||
set.add(2)
|
||||
|
||||
# When + Then
|
||||
expect_not(set.has("Foo"))
|
||||
|
||||
#endregion
|
||||
|
||||
#region size() + is_empty()
|
||||
func test_new_set_should_be_empty() -> void:
|
||||
# Given
|
||||
var set := _Set.new()
|
||||
|
||||
# Then
|
||||
expect(set.is_empty())
|
||||
expect_equal(set.size(), 0)
|
||||
|
||||
func test_set_should_not_be_empty() -> void:
|
||||
# Given
|
||||
var set := _Set.new()
|
||||
|
||||
# When
|
||||
set.add("foo")
|
||||
set.add("bar")
|
||||
|
||||
# Then
|
||||
expect_not(set.is_empty())
|
||||
expect_equal(set.size(), 2)
|
||||
#endregion
|
||||
|
||||
#region erase() + clear()
|
||||
func test_erase_should_remove() -> void:
|
||||
# Given
|
||||
var set := _Set.of(["foo", "bar", "quix"])
|
||||
var expected = ["foo", "quix"]
|
||||
|
||||
# When
|
||||
set.erase("bar")
|
||||
|
||||
# Then
|
||||
expect_equal(set.values(), expected)
|
||||
|
||||
func test_clear_should_make_empty() -> void:
|
||||
# Given
|
||||
var set := _Set.of(["foo", "bar", "quix"])
|
||||
|
||||
# When
|
||||
set.clear()
|
||||
|
||||
# Then
|
||||
expect_empty(set)
|
||||
#endregion
|
||||
|
||||
#region iteration
|
||||
func test_empty_should_not_be_iterable() -> void:
|
||||
# Given
|
||||
var set := _Set.new()
|
||||
|
||||
# When + then
|
||||
expect_not(set._can_iterate(), "Set shouldn't be iterable")
|
||||
|
||||
func test_should_be_iterable() -> void:
|
||||
# Given
|
||||
var set := _Set.of([2, "Foo"])
|
||||
|
||||
# When + then
|
||||
expect(set._can_iterate(), "Set should be iterable")
|
||||
|
||||
func test_iterate_should_yield_values() -> void:
|
||||
# Given
|
||||
var set := _Set.of([1, 2, "Foo", {}])
|
||||
var expected := [1, 2, "Foo", {}]
|
||||
var iterated := []
|
||||
|
||||
# When
|
||||
for item in set:
|
||||
iterated.append(item)
|
||||
|
||||
# Then
|
||||
expect_equal(iterated, expected)
|
||||
#endregion
|
||||
|
||||
func test_min_max() -> void:
|
||||
# Given
|
||||
var set := _Set.of([2, 1, 3])
|
||||
|
||||
# When + Then
|
||||
expect_equal(set.min(), 1)
|
||||
expect_equal(set.max(), 3)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bowionq1hw1gd
|
||||
Reference in New Issue
Block a user