TomeNET is a multiplayer online roguelike game based on Angband with a client-server architecture using UDP networking with a reliable transmission layer built on top.
src/server/- Server code (game logic, networking, world simulation)src/client/- Client code (UI, input handling, graphics/sound)src/common/- Shared utilities (networking, data structures, random)src/account/- Account management utilitieslib/game/- Game data files (*_info.txt format)lib/scpt/- Lua script files for game logiclib/config/- Configuration files (tomenet.cfg)lib/data/- Runtime server data (logs, scores, etc.)lib/save/- Player save files and server state
tomenet- Client executabletomenet.server- Server executableaccedit- Account editor utility
- Main makefile:
src/makefile- Primary build configuration - Platform variants:
makefile.mingw- Windows cross-compilationmakefile.gcu- ncurses terminal clientmakefile.osx- macOS specific
- Client variants:
- X11 GUI:
-DUSE_X11flag - ncurses terminal:
-DUSE_GCUflag - Windows:
-DWIN32flag
- X11 GUI:
- Features:
- SDL sound:
-DSOUND_SDLwith SDL2_mixer dependency - Lua integration: Built-in with embedded interpreter and tolua bindings
- Preprocessor support: cpp for conditional compilation in Lua files
- SDL sound:
- Main server:
src/server/main.c- Entry point withplay_game()game loop - Network layer:
src/server/nserver.c- Connection states and packet handling - Scheduler: Turn-based gameplay using
sched()function
- Lua integration:
src/server/script.cwithexec_lua()andpern_dofile() - Script files:
lib/scpt/directory contains game logic scripts - Preprocessing: Lua files support cpp conditional compilation
- Format: Structured text files (*_info.txt)
- Key files:
r_info.txt- Monster definitionsk_info.txt- Object/item definitionsa_info.txt- Artifact definitionsd_info.txt- Dungeon definitionst_info.txt- Town/terrain definitions
- Main config:
lib/config/tomenet.cfg - Contains: Game settings, network options, admin controls
- Additional: banlist.txt, badnames.txt, server_portals.cfg
- Keep functions short and descriptive
- No excessive commenting - code should be self-explanatory
- No defensive programming or unnecessary try/catch blocks
- No function docstrings
- Avoid list comprehensions
- Use common sense with newlines - don't add extras everywhere
- One import per line, reorder logically when editing Python files
/cacommand: Add all new/changed files and commit with generated message/cbcommand: Same as/cabut message is just "backup"- Files ending in
~are ignored (backup files)
- Use appropriate venv (typically
.venv) for Python code - For editing system files (
/etc), use sudo shell commands instead of direct file editing - Don't use exclamation marks in terminal commands
- Post-commit hook copies binaries from
src/to root directory - Use
make installor manually copy binaries after building - Object files (*.o) are automatically ignored
*.o- Object files*~- Editor backup files*.tmp,*.dna,*.xhtml- Temporary fileslib/data/*- Runtime server datalib/save/*- Save files- Generated tolua and preproc files
make # Build all targets
make tomenet # Build client only
make tomenet.server # Build server only
make clean # Clean build artifacts./runserv- Simple server startup script./runserv3- More complex server startup with additional options./tomenet- Client executable
./accedit- Account editor utility- Account data stored in
tomenet.acc
- UDP-based with reliability layer
- Client-server model
- Connection state management in nserver.c
- Packet-based communication protocol
- Embedded Lua interpreter
- tolua bindings for C<->Lua interface
- Script files in
lib/scpt/ - Preprocessor support for conditional compilation
- Main script functions:
exec_lua(),pern_dofile()
This reference should be updated as new information about the codebase structure and development practices is discovered.