Files
tactical-shooter/test/netfox/servers/rollback-simulation-server.test.gd
shawn b0c83af092 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>
2026-07-02 20:55:20 -04:00

115 lines
3.4 KiB
GDScript

extends VestTest
func get_suite_name() -> String:
return "RollbackSimulationServer"
func before_case(__):
# Makes sure local peer is 1, otherwise identifiers get random local IDs
Vest.get_tree().root.multiplayer.multiplayer_peer = OfflineMultiplayerPeer.new()
func suite() -> void:
define("is_predicting()", func():
test("should predict non-owned node", func():
var state_node := await get_node()
var input_node := await get_node()
var input_snapshot := _Snapshot.of(1, [[input_node, "name", "Input"]], [])
state_node.set_multiplayer_authority(2)
RollbackSimulationServer.register_rollback_input_for(state_node, input_node)
expect(RollbackSimulationServer._is_predicting(input_snapshot, state_node))
)
test("should predict owned node without input", func():
var input_snapshot := _Snapshot.new(0)
var state_node := await get_node()
var input_node := await get_node()
RollbackSimulationServer.register_rollback_input_for(state_node, input_node)
expect(RollbackSimulationServer._is_predicting(input_snapshot, state_node))
)
test("should predict non-owned inputless", func():
var input_snapshot := _Snapshot.new(0)
var state_node := await get_node()
state_node.set_multiplayer_authority(2)
expect(RollbackSimulationServer._is_predicting(input_snapshot, state_node))
)
test("should not predict owned inputless", func():
var input_snapshot := _Snapshot.new(0)
var state_node := await get_node()
expect_not(RollbackSimulationServer._is_predicting(input_snapshot, state_node))
)
test("should not predict owned with input", func():
var state_node := await get_node()
var input_node := await get_node()
var input_snapshot := _Snapshot.of(1, [[input_node, "name", "Input"]], [input_node])
RollbackSimulationServer.register_rollback_input_for(state_node, input_node)
expect_not(RollbackSimulationServer._is_predicting(input_snapshot, state_node))
)
)
define("get_nodes_to_simulate()", func():
test("should not simulate without input", func():
var node := RewindableNode.new()
var input_node := Node.new()
var server := _RollbackSimulationServer.new()
server.register(node._rollback_tick)
server.register_rollback_input_for(node, input_node)
var snapshot := _Snapshot.new(1)
expect_empty(server._get_nodes_to_simulate(snapshot))
)
test("should simulate with input", func():
var node := RewindableNode.new()
var input_node := Node.new()
var server := _RollbackSimulationServer.new()
server.register(node._rollback_tick)
server.register_rollback_input_for(node, input_node)
var snapshot := _Snapshot.new(1)
snapshot.set_property(input_node, "editor_description", "Test input node")
snapshot.set_auth(input_node, true)
expect_equal(server._get_nodes_to_simulate(snapshot), [node])
)
test("should simulate mutated", func():
var node := RewindableNode.new()
var input_node := Node.new()
var server := _RollbackSimulationServer.new()
server.register(node._rollback_tick)
server.register_rollback_input_for(node, input_node)
var snapshot := _Snapshot.new(1)
NetworkRollback.mutate(node)
expect_equal(server._get_nodes_to_simulate(snapshot), [node])
)
)
class RewindableNode extends Node:
func _rollback_tick(_dt, _t, _if) -> void:
pass
func get_node() -> Node:
var node := Node.new()
Vest.get_tree().root.add_child.call_deferred(node)
await node.ready
return node