SDL2 MAngband interface
Posted: Mon 02.02.2015, 22:33
Hail, all.
To any with an ear on IRC, some of this was mentioned there (acenoid recommended I echo info here).
Due to wanting to play MAngband w/ a few others (all using different operating systems), I spent some time last week writing an SDL2 interface for MAngband (pict-enabled) tied to the 1.1.2 release. I originally tried to work with the SDL interface, but building on OS X proved to be annoying, so I figured it wouldn't be too bad to write it in SDL2 - I also tried to port SDL->SDL2 first, but got annoyed and just wrote the whole thing from scratch.
It was certainly fun learning how "z-term" stuff works and studying the code to figure out how to map everything properly (not hard, but interesting).
At any rate, I had a few key questions:
What code base would be best to integrate this with?
As stated, this is tied to the 1.1.2 release. However, I merged my main-sdl2 stuff (and a few checks in a couple places) with the latest from git, but it wasn't possible to test due to network-related failures (even a self-hosted server using the same git version, it had various packet errors). What code-base would be best to tie this to?
Do accurate MAngband pict table maps exist?
Given that I'm a boor who likes graphics (what started this whole endeavor, really), is there a graphics file and pict "table map"(high-bit set char/attr pairs) that matches MAngband? I apologize if this information is already available, but I was not met with much luck finding one that worked. In the attached screenshot, I put some basic mappings to test things out, such as the store doors and "grass" to the rocks sprite. The 1.1.2 included graphics and pict table maps did not seem to match up with MAngband (although a handful of items did).
I've been holding off on creating my own MAngband pict table map (and modified graphics file) as it's a bit of busy-work that isn't the most thrilling due to the hope that there may exist one already. I am dubious, however, as a forum post here (from 2009, mind you) mentions that char/attr pairs need to be remapped.
Short of there existing appropriate maps, I was going to make a script that gathers all MAngband objects (and their appropriate types) and populates a spritesheet based on their index number (e.g., assuming rows to consist of 16 cols, object id 17 would fall on the coords 1x1). Following this, a previously defined pict table map could be used to move old sprite locations to their new, id-specific locations. Unless I'm missing something, it'd be logically easier to map graphics in a way that corresponds to the underlying game data, but I could be mistaken since I don't know MAngband/Angband's rational too well.
I do not want to create a significantly different way of doing stuff that breaks compatibility with other interfaces, so some guidance/discussion would be much appreciated.
----
I haven't entirely completed the client, as I need to study the z-term to figure out how exactly to send key commands/keypresses, but it should be ready soon (around 650 lines of code at the moment, including some comments).
Beyond compiling/running on OS X, it also works fine on Windows 7 and Linux. I'm currently using SDL2's multiple window support, but I will implement single-window virtualized terms (easily done since I'm not rendering directly to screen, but rather to framebuffer textures for each window - it'd just be a matter of rendering in a single window's context with offsets).
Also, sorry about the IRC spam - I noticed that the "mangband" bot announces connection/disconnection status, and I have been doing much of that due to client testing. :)
To any with an ear on IRC, some of this was mentioned there (acenoid recommended I echo info here).
Due to wanting to play MAngband w/ a few others (all using different operating systems), I spent some time last week writing an SDL2 interface for MAngband (pict-enabled) tied to the 1.1.2 release. I originally tried to work with the SDL interface, but building on OS X proved to be annoying, so I figured it wouldn't be too bad to write it in SDL2 - I also tried to port SDL->SDL2 first, but got annoyed and just wrote the whole thing from scratch.
It was certainly fun learning how "z-term" stuff works and studying the code to figure out how to map everything properly (not hard, but interesting).
At any rate, I had a few key questions:
What code base would be best to integrate this with?
As stated, this is tied to the 1.1.2 release. However, I merged my main-sdl2 stuff (and a few checks in a couple places) with the latest from git, but it wasn't possible to test due to network-related failures (even a self-hosted server using the same git version, it had various packet errors). What code-base would be best to tie this to?
Do accurate MAngband pict table maps exist?
Given that I'm a boor who likes graphics (what started this whole endeavor, really), is there a graphics file and pict "table map"(high-bit set char/attr pairs) that matches MAngband? I apologize if this information is already available, but I was not met with much luck finding one that worked. In the attached screenshot, I put some basic mappings to test things out, such as the store doors and "grass" to the rocks sprite. The 1.1.2 included graphics and pict table maps did not seem to match up with MAngband (although a handful of items did).
I've been holding off on creating my own MAngband pict table map (and modified graphics file) as it's a bit of busy-work that isn't the most thrilling due to the hope that there may exist one already. I am dubious, however, as a forum post here (from 2009, mind you) mentions that char/attr pairs need to be remapped.
Short of there existing appropriate maps, I was going to make a script that gathers all MAngband objects (and their appropriate types) and populates a spritesheet based on their index number (e.g., assuming rows to consist of 16 cols, object id 17 would fall on the coords 1x1). Following this, a previously defined pict table map could be used to move old sprite locations to their new, id-specific locations. Unless I'm missing something, it'd be logically easier to map graphics in a way that corresponds to the underlying game data, but I could be mistaken since I don't know MAngband/Angband's rational too well.
I do not want to create a significantly different way of doing stuff that breaks compatibility with other interfaces, so some guidance/discussion would be much appreciated.
----
I haven't entirely completed the client, as I need to study the z-term to figure out how exactly to send key commands/keypresses, but it should be ready soon (around 650 lines of code at the moment, including some comments).
Beyond compiling/running on OS X, it also works fine on Windows 7 and Linux. I'm currently using SDL2's multiple window support, but I will implement single-window virtualized terms (easily done since I'm not rendering directly to screen, but rather to framebuffer textures for each window - it'd just be a matter of rendering in a single window's context with offsets).
Also, sorry about the IRC spam - I noticed that the "mangband" bot announces connection/disconnection status, and I have been doing much of that due to client testing. :)