Online roguelike gamedev @ ANSI C

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++)”.

And after I’ve read a few articles about C myself, I’ve recognized this: every programmer should know C language, no matter which language do you use in your daily work. And the most fun to learn it – is to look into online roguelikes code sources!
 
So for all those who want to come closer to understanding – how online roguelikes works or want to help with developing, I wanna share a few useful links, to begin with:
 
1) wiki: C language, ANSI C
2) online roguelikes source code repositories:

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 🙂

 
So.. To get into the development process, you should:
 
1) learn ANSI C basics (book or online tutorial would do)
2) create very simple roguelike game yourself (good tutorial – RogueLulz, Part I: Drawing the Map, Walking Around, Basic Monsters and Attacking)
3) ‘read’ source code and understand how it works
4) add a tiny feature and make it work. Eg: change the color of UI, add an indicator of buff/debuff, add a new window with minimap etc
5) join our discord and catch up with the dev process together! 🙂
 
Please don’t hesitate to add more information, useful links, tutorials or anything considering this topic in our discord, so I’ll add it there.
 

Coding FAQ:

Explain why your ATTR is 16 bit? I gather you need more values than 127, but could you elaborate? Also, is this in V?

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.

Leave a Reply

Your email address will not be published. Required fields are marked *