All trinity of online roguelikes written in ANSI C programming language (~ C89-C99 standard) as they all were initially based at Angband source code.
C is a very powerful programming language. When I first asked C.Blue (TomeNET maintainer) about C, he said: “…some people even say that ANSI C is the most efficient C-variant and the Linux kernel is actually written in it (instead of for example C++)”.
3) Read the book about C. There are a lot of books about ANSI C; my personal favorite one is “C Primer Plus” by Stephen Prata. C it’s a language which you should not learn fast, as you need to understand a lot of deep internal stuff. Don’t be hurry 🙂
Yes, because tilesets can be bigger than 128×128. Also GCU client uses special attributes greater than 128 because of Necklace of the Eye frontend. For example: it’s not possible to use @ symbols because NotEye uses @ to track the position of the player so you could use a smily face instead (0x263A).
Give a bird’s-eye view of how the dungeon levels are aligned in memory in V/PWMA nowdays? (e.g., in mang it’s horrid cave[-4096 to 127] array, with wilderness indexes spiraling in negative dimensions (as you well know))
Levels are now stores in a [x/y/z] array. Wilderness is rectangular. Towns or wilderness areas are (x,y,0). Then at location (x,y) you can have a dungeon with floors from 1 to 127 on z axis.
Is there also a function like get_player_level(struct player*p) which uses p->world_x, p->world_y, p->depth or something similar? and are there accessors like that?
No, only a get_cave.
Are monsters/objects still stored globally with references into levels, or are they now part of level struct?
Part of level. Everyhting is in the cave now: mobs, objects, traps.
How to debug the game?
Install C++Builder Community Edition
There are two ways to do it – via ready solution or manual:
1) solution: download project file for the server (RMB → ‘Save file as…’)
- create new project
- counsole application → C
- specify project source, choose “main.c” in /src/server
- save the project with the name:
mangbandinto /src/bcb6 (first it will save .h file; and afterwards new window appear with *.cbproj) // name is important so it will generate server binary as mangband.exe
- now lets configure the game: project tab → try to find the “options”
- Building →
C++ Shared Options → Final output directory → choose PWMAngband (main source folder)
- C++ Compiler → ‘Use classic Borland compiler’ → true
- Directories and Conditionals → conditional defines:
- Directories and Conditionals → Include file search path we need to add
to do so click on “…” to add a line
- Directories and Conditionals → Object file output directory → PWMAngband
- Pre-compiled headers → cache: true
- now we need to add all files into the project; first the files in “common”, all .c files
right click project.exe and click add
add everything except net-unix.c
it will appear in project folder (expand to see the files)
- now add all the files from the /server except main.c
- last file to add is “angband.rc” from /win
- project -> make … if it’s linking – we are good 🙂
- check is .exe files generated (should be in PWMAngband folder)
- execute (green arrow)
- now open “game-world.c”
- find “void exit_game_panic(void)” (ctrl-f shoulds open search wndow)
- let’s make breakpoint here: click in the margin on the left, on the line (red marker dot will appear)
- now close the server window (which is running as you executed it previously); use ctrl+c for closing it (closing with “x” can crash)
- now we will luanch server in debug mode: click on button next to green arrow (Run)
- it is now in debug mode: “exit_game_panic” is the function that is called when there is a crash; so when the game crashes, the debugger will stop on that line
- open a window called “stack view” in debug menu: view → call stack (it will appear on the left)
- when the program stops, you get the line where the crash occurs, so you can fix the code immediately!