Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
f4d9687
Add enum loading for auto attacks
cmkrist Nov 17, 2025
cc475af
Add entity state machines
cmkrist Nov 17, 2025
65f950b
Add component registry to prevent overlaps, fix cmake header
cmkrist Nov 17, 2025
4742c71
add player components
cmkrist Nov 17, 2025
3dd884b
Add System Context as map of systems implemented
cmkrist Nov 17, 2025
2d71ce6
add player manager, new packet for lobby full
cmkrist Nov 17, 2025
0e6ceca
minor xml updates
cmkrist Nov 17, 2025
be77969
ignore markdown files (code audits)
cmkrist Nov 17, 2025
dfa5c90
Add combat, spawn, sync, movement, coordinator and other system to en…
cmkrist Nov 17, 2025
ad96a40
Spawn champions
Ploinky Nov 17, 2025
2097a33
Add some comments to entity xsd for clarity
Ploinky Nov 17, 2025
2e38613
Update TemplateComponent type id and register in component registry
Ploinky Nov 17, 2025
51cd081
Handle player move packet
Ploinky Nov 17, 2025
0a61055
Add input system to manage player input
cmkrist Nov 18, 2025
e479380
Move collisions to new system
cmkrist Nov 18, 2025
9aa9496
Movement System Refactor for Readability
cmkrist Nov 18, 2025
644b61a
Make players use A* instead of direct movement
cmkrist Nov 18, 2025
49ec73e
Add basic hashing for stats component checking
cmkrist Nov 18, 2025
605c1b2
fix header
cmkrist Nov 18, 2025
458a79f
fix other files for entity_stats packet
cmkrist Nov 18, 2025
ccf8723
Add a few stats for debugging
cmkrist Nov 18, 2025
c2318e6
Revert hashing
cmkrist Nov 18, 2025
19b9cc4
add proper entity cleanup with state sync logic
cmkrist Nov 18, 2025
2cf800e
Add input validation (so player doesn't walk out of bounds)
cmkrist Nov 18, 2025
8d0b381
Add stat packets
cmkrist Nov 18, 2025
75ffe4b
Entity Serialization
cmkrist Nov 18, 2025
b3a47c7
Merge pull request #5 from OpenChamp/champion-spawn
Ploinky Nov 19, 2025
09d415d
Use maths library functions instead of utility helpers
Ploinky Nov 19, 2025
19eb32f
fix minor linux compilation error
cmkrist Nov 19, 2025
e1ff9c2
1s delay between minion spawns
cmkrist Nov 19, 2025
c007253
Remove unused demo code
cmkrist Nov 19, 2025
3927193
fix cmake, remove unnecesary comments
cmkrist Nov 19, 2025
76e7d2f
Add Visualizer to server for debugging (--visualize)
cmkrist Nov 19, 2025
a230335
Add launch options for vizualizer
cmkrist Nov 19, 2025
b806aa3
NPC system implementation
Ploinky Nov 21, 2025
1c7f78e
Return minion to path when chasing too far
Ploinky Nov 21, 2025
c55a658
Merge pull request #7 from OpenChamp/npc-system
cmkrist Nov 21, 2025
8517678
Add npc component with npc type
Ploinky Nov 24, 2025
cdc0d3f
add chase_distance to xml and integrate
cmkrist Nov 24, 2025
9872030
Move vectors to 2D
cmkrist Nov 24, 2025
16848a7
Move moment logic to all 2d
cmkrist Nov 24, 2025
8b0190c
Properly pick npc entities by npc component
Ploinky Nov 24, 2025
d65666f
Avoid invalid vector access
Ploinky Nov 24, 2025
e212548
XML AI Updates
cmkrist Nov 25, 2025
fdc1bc2
remove entity duplication, 5s first wave
cmkrist Nov 25, 2025
a4ca854
Targeting System
cmkrist Nov 25, 2025
46b2786
Attack Execution System
cmkrist Nov 25, 2025
5610b47
Auto Attack System
cmkrist Nov 25, 2025
5d62566
Update gamplay systems for combat
cmkrist Nov 25, 2025
33417fe
build fix
cmkrist Nov 25, 2025
8fe8e2c
Combat System Decoupling, data loader updates for combat attributes
cmkrist Nov 25, 2025
1954bdd
New packets
cmkrist Nov 25, 2025
c2b6b76
collision fix
cmkrist Nov 25, 2025
dfbc7bb
divert attak-moving to movement system
cmkrist Nov 25, 2025
420ed66
NPC Brain, debugging for minions with 1hp
cmkrist Nov 25, 2025
778a55e
move files into new folders for better readability
cmkrist Nov 25, 2025
113ac44
fix headers
cmkrist Nov 25, 2025
af1e091
Combat System Refactor
cmkrist Nov 25, 2025
e41ff19
Update map navmesh to support rotation (godot core)
cmkrist Nov 26, 2025
45dbef1
Add navmesh, bounds, and other QOL features to visualizer
cmkrist Nov 26, 2025
02fc362
fix player input
cmkrist Nov 26, 2025
459f39b
logic refactor 2
Ploinky Dec 1, 2025
3e79d9f
Do not recalculate pathing too often
Ploinky Dec 1, 2025
30a9fc3
Add Navigational Grid to existing systems
cmkrist Dec 2, 2025
25230f5
Update visualizer to use files, add NavGrid Support
cmkrist Dec 2, 2025
1f57ea2
Player Input Prioritization & Champion Metadata (clientside)
cmkrist Dec 2, 2025
698cd9a
Add OBJ parsing for navmesh, replaces tscn parsing
cmkrist Dec 2, 2025
7a07988
unlimited/autostart on 0 max players
cmkrist Dec 4, 2025
f6c59f9
Remove unnecesary debugging
cmkrist Dec 4, 2025
ac8229f
Polygon grid builder
cmkrist Dec 4, 2025
995eea4
New XML
cmkrist Dec 4, 2025
7d2ec0e
Visualizer updates (toggles, faster poll, icon lib)
cmkrist Dec 4, 2025
7fff0d7
Direct movement stays in grid
cmkrist Dec 4, 2025
768434e
Navmesh grid fixes for A*
cmkrist Dec 4, 2025
d5c9f11
Add structures, more navgrid fixes, and set minions to target Cores
cmkrist Dec 4, 2025
6d1ba58
fix magic minion autos
cmkrist Dec 4, 2025
09d904b
Add Structure Entities (no attacking)
cmkrist Dec 4, 2025
3be4e79
Visualizer minor UI updates
cmkrist Dec 5, 2025
0183242
State machine and ID Fixes
cmkrist Dec 5, 2025
6d34f50
Remove data directory from tracking (will be added as submodule)
cmkrist Dec 5, 2025
c3a25f8
Add data as submodule
cmkrist Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build
*.tscn
*.tscn
*.md
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "data"]
path = data
url = https://github.com/OpenChamp/data.git
51 changes: 47 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,60 @@
{
"version": "0.2.0",
"configurations": [

{
"name": "Win(x64) Debug",
"name": "Win(D) Visual",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/_output/windows_x64/Debug/gameserver.exe",
"args": ["--visualize"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [{"name": "MAP_NAME", "value": "konda"}],
"console": "integratedTerminal"
},
{
"name": "Win(D) Visual Autostart",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/_output/windows_x64/Debug/gameserver.exe",
"args": ["--visualize"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [{"name": "MAP_NAME", "value": "konda"}, {"name": "MAX_CLIENTS", "value": "0"}],
"console": "integratedTerminal"
},
{
"name": "Win(D) Debug",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/_output/windows_x64/Debug/gameserver.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [{"name": "MAP_NAME", "value": "konda"}],
"console": "integratedTerminal"
},
{
"name": "Win(R) Visual",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/_output/windows_x64/Release/gameserver.exe",
"args": ["--visualize"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [{"name": "MAP_NAME", "value": "konda"}],
"console": "integratedTerminal"
},
{
"name": "Win(R) Debug",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/_output/windows_x64/Release/gameserver.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"console": "externalTerminal"
"environment": [{"name": "MAP_NAME", "value": "konda"}],
"console": "integratedTerminal"
}
]
}
80 changes: 80 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"files.associations": {
"algorithm": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"deque": "cpp",
"exception": "cpp",
"filesystem": "cpp",
"format": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"queue": "cpp",
"random": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"variant": "cpp",
"array": "cpp"
}
}
61 changes: 27 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,48 +51,41 @@ set(GAMESERVER_SOURCES
# Services
src/services/navigation_service.cpp
src/services/astar_pathfinding.cpp
# Systems
src/systems/combat_system.cpp
src/services/visualizer_service.cpp
src/services/network_service.cpp
src/systems/data_loader.cpp
# Systems - Core
src/systems/gameserver.cpp
src/systems/map_system.cpp
src/systems/combat_system.cpp
src/systems/movement_system.cpp
src/systems/serialization_system.cpp
src/systems/wave_system.cpp
src/systems/gameplay_coordinator.cpp
# Systems - Core Game Logic
src/systems/core/collision_system.cpp
src/systems/core/combat_system.cpp
src/systems/core/brain_system.cpp
src/systems/core/input_system.cpp
src/systems/core/movement_system.cpp
src/systems/core/network_sync_system.cpp
src/systems/core/npc_system.cpp
src/systems/core/spawning_system.cpp
src/systems/core/wave_system.cpp
# Systems - Utilities
src/systems/util/combat_calculator.cpp
src/systems/util/data_loader.cpp
src/systems/util/packet_handler.cpp
src/systems/util/player_manager.cpp
src/systems/util/serialization_system.cpp
src/systems/util/targeting_utility.cpp
)

# Header files (for IDE organization)
set(GAMESERVER_HEADERS
src/systems/gameserver.hpp
src/components/game_state.hpp
src/entities/player.hpp
src/systems/packet_validator.hpp
src/components/errors.hpp
src/systems/entity_manager.hpp
src/components/component.hpp
src/components/movement.hpp
src/components/stats.hpp
src/systems/math.hpp
src/components/map.hpp
src/components/navmesh.hpp
src/services/navigation_service.hpp
src/services/astar_pathfinding.hpp
src/services/network_service.hpp
src/systems/data_loader.hpp
src/systems/map_system.hpp
src/systems/combat_system.hpp
src/systems/movement_system.hpp
src/systems/serialization_system.hpp
src/systems/wave_system.hpp
)
# Header files are now included via consolidated headers:
# - <components/component.hpp> for all component types
# - <systems/system.hpp> for all system types
# - <services/service.hpp> for all service types
# No individual header listing needed.

set(LIBRARY_SOURCES
src/libs/pugixml.cpp
)

add_executable(gameserver ${GAMESERVER_SOURCES} ${GAMESERVER_HEADERS} ${LIBRARY_SOURCES})
add_executable(gameserver ${GAMESERVER_SOURCES} ${LIBRARY_SOURCES})

# Include directories
target_include_directories(gameserver PRIVATE
Expand All @@ -116,7 +109,7 @@ enable_testing()
# Add test executable
add_executable(gameserver_tests
tests/tests.cpp
src/systems/data_loader.cpp
src/systems/util/data_loader.cpp
src/libs/pugixml.cpp
)

Expand Down
155 changes: 155 additions & 0 deletions count.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#!/bin/bash

# --- Configuration ---
OUTPUT_FILE="count.md"

# Define common extensions for files to EXCLUDE from the main character/line count.
EXCLUDE_EXTENSIONS=("jpg" "jpeg" "png" "gif" "bmp" "ico" "mp3" "mp4" "mov" "avi" "zip" "rar" "gz" "tar" "bin" "exe" "dll" "so" "o" "class" "pdf" "doc" "docx" "xls" "xlsx")

# Define common extensions for files you want to explicitly list in the breakdown table
# All other code/text files will be grouped under "Other Code/Text"
KNOWN_CODE_EXTENSIONS=("sh" "bash" "py" "js" "ts" "html" "css" "scss" "php" "c" "cpp" "h" "java" "go" "md" "txt" "yaml" "json" "xml")


# Convert the exclusion array to a regex pattern for use with 'find -not -regex'
EXCLUDE_PATTERN=$(printf "\.%s\\|" "${EXCLUDE_EXTENSIONS[@]}" | sed 's/|$/$/')
EXCLUDE_PATTERN="${EXCLUDE_PATTERN/\\|/\|}"
EXCLUDE_PATTERN=".*($EXCLUDE_PATTERN)"

# Start by clearing the output file
echo "# 📁 Directory Content Analysis" > "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
echo "Analysis started from: \`$(pwd)\`" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"

# --- 1. Total Code/Text Lines and Characters Count (Unchanged) ---

echo "## 💻 Code/Text Lines & Characters" >> "$OUTPUT_FILE"
echo "*(Excluding files with extensions: ${EXCLUDE_EXTENSIONS[*]::$(( ${#EXCLUDE_EXTENSIONS[@]} > 5 ? 5 : ${#EXCLUDE_EXTENSIONS[@]} ))}[...] for brevity)*" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"

find . -type f -not -regex "$EXCLUDE_PATTERN" -print0 | xargs -0 wc -lcm | awk '
BEGIN {
lines = 0;
chars = 0;
}
END {
if (NF >= 3) {
lines = $1;
chars = $2;
}
print "| Metric | Count |"
print "| :--- | :--- |"
print "| **Total Lines** | " lines " |"
print "| **Total Characters** | " chars " |"
}' >> "$OUTPUT_FILE"

echo "" >> "$OUTPUT_FILE"

# --- 2. File Classification and Summary Count (Updated Logic) ---

declare -A EXTENSION_COUNTS
CODE_COUNT=0
BINARY_COUNT=0
TOTAL_FILES=0
OTHER_CODE_COUNT=0

# Loop through all regular files to classify and count them
while IFS= read -r FILE; do
# Get the file's extension, defaulting to "None" if no extension is found
EXTENSION=$(echo "$FILE" | awk -F'.' '{if (NF>1) {print $NF} else {print "None"}}' | tr '[:upper:]' '[:lower:]')

# Check if the extension is considered Binary/Media
IS_BINARY=0
for EXT in "${EXCLUDE_EXTENSIONS[@]}"; do
if [[ "$EXTENSION" == "$EXT" ]]; then
IS_BINARY=1
break
fi
done

# Count based on classification for the top-level summary
if [[ $IS_BINARY -eq 1 ]]; then
((BINARY_COUNT++))
# Log binary files by their extension
EXTENSION_COUNTS["**Binary/Media**"]=$((${EXTENSION_COUNTS["**Binary/Media**"]:-0} + 1))
else
((CODE_COUNT++))

# Check if the code/text extension is one we want to explicitly list
IS_KNOWN_CODE=0
for EXT in "${KNOWN_CODE_EXTENSIONS[@]}"; do
if [[ "$EXTENSION" == "$EXT" ]]; then
IS_KNOWN_CODE=1
break
fi
done

# Group Code/Text files: if known, list extension; if not, group as "Other Code/Text"
if [[ $IS_KNOWN_CODE -eq 1 ]]; then
EXTENSION_COUNTS["$EXTENSION"]=$((${EXTENSION_COUNTS["$EXTENSION"]:-0} + 1))
elif [[ "$EXTENSION" == "None" ]]; then
# Files with no extension are still tracked under "None"
EXTENSION_COUNTS["None"]=$((${EXTENSION_COUNTS["None"]:-0} + 1))
else
# All other (less common) code/text files are grouped here
((OTHER_CODE_COUNT++))
fi
fi

((TOTAL_FILES++))

done < <(find . -type f)

# Add the cumulative "Other Code/Text" count to the tracking array if greater than zero
if [[ $OTHER_CODE_COUNT -gt 0 ]]; then
EXTENSION_COUNTS["**Other Code/Text**"]=$OTHER_CODE_COUNT
fi


# --- 3. Output Top-Level Summary Table (Unchanged) ---

echo "## 📊 File Type Summary" >> "$OUTPUT_FILE"
echo "| File Type | Count | Percentage |" >> "$OUTPUT_FILE"
echo "| :--- | :--- | :--- |" >> "$OUTPUT_FILE"

# Calculate percentages
if [[ $TOTAL_FILES -gt 0 ]]; then
CODE_PERCENT=$(awk "BEGIN {printf \"%.1f\", ($CODE_COUNT/$TOTAL_FILES)*100}")
BINARY_PERCENT=$(awk "BEGIN {printf \"%.1f\", ($BINARY_COUNT/$TOTAL_FILES)*100}")
else
CODE_PERCENT=0.0
BINARY_PERCENT=0.0
fi

echo "| **Code/Text Files** | $CODE_COUNT | $CODE_PERCENT% |" >> "$OUTPUT_FILE"
echo "| Binary/Media Files | $BINARY_COUNT | $BINARY_PERCENT% |" >> "$OUTPUT_FILE"
echo "| **TOTAL** | **$TOTAL_FILES** | **100.0%** |" >> "$OUTPUT_FILE"

echo "" >> "$OUTPUT_FILE"

# --- 4. Output Extension Breakdown Table (Updated Logic) ---

echo "## 🔍 File Count by Extension Breakdown" >> "$OUTPUT_FILE"
echo "| Extension | Count | Percentage |" >> "$OUTPUT_FILE"
echo "| :--- | :--- | :--- |" >> "$OUTPUT_FILE"

# Sort the extensions by count in descending order
for EXTENSION in "${!EXTENSION_COUNTS[@]}"; do
echo "$EXTENSION ${EXTENSION_COUNTS[$EXTENSION]}"
done | sort -nr -k2 | while read EXTENSION COUNT; do
PERCENTAGE=$(awk "BEGIN {printf \"%.1f\", ($COUNT/$TOTAL_FILES)*100}")

# Custom display logic for grouping headers
if [[ "$EXTENSION" == "**Binary/Media**" || "$EXTENSION" == "**Other Code/Text**" ]]; then
echo "| $EXTENSION | $COUNT | $PERCENTAGE% |" >> "$OUTPUT_FILE"
elif [[ "$EXTENSION" == "None" ]]; then
echo "| **$EXTENSION** | $COUNT | $PERCENTAGE% |" >> "$OUTPUT_FILE"
else
echo "| .$EXTENSION | $COUNT | $PERCENTAGE% |" >> "$OUTPUT_FILE"
fi
done

echo "" >> "$OUTPUT_FILE"
echo "---" >> "$OUTPUT_FILE"
echo "Analysis complete. Output saved to \`$OUTPUT_FILE\`."
Loading