Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Development (http://angband.oook.cz/forum/forumdisplay.php?f=10)
-   -   Future-proof cross-platform interface library, only GCU / ncurses? (http://angband.oook.cz/forum/showthread.php?t=8819)

droof February 8, 2018 23:25

Future-proof cross-platform interface library, only GCU / ncurses?
 
When I try to compile older angband variants, I see all kinds of libraries break. SDL 1 breaks, because SDL 2 is the new standard and is not backward compatible. GTK breaks too. If the variant is no longer maintained, these probably no longer compile.

It looks like only GCU / ncurses and X11 always compile consistently even for unmaintained variants. And ncurses also has built-in Windows and Mac support (not X11?). So does that mean ncurses is the only future-proof interface that will work on any platform, or is there another cross-platform interface library that is highly recommended today?

Pete Mack February 9, 2018 08:32

X11 works on Mac with a bit of effort. (On Windows too, but I hate it.) At some point you are just better dropping in a new(er) main-xxx.c file and a modern makefile. (All you need to change is makefile.src)

Nick February 9, 2018 09:16

There has been an SDL2 interface written for V, but Ihaven't looked at it properly and am not sure how complete it is.

PowerWyrm February 9, 2018 12:25

What's wrong with SDL 1? The libs are still available, so you shouldn't have any problem compiling...

Gwarl February 9, 2018 14:15

Quote:

Originally Posted by droof (Post 127871)
When I try to compile older angband variants, I see all kinds of libraries break. SDL 1 breaks, because SDL 2 is the new standard and is not backward compatible. GTK breaks too. If the variant is no longer maintained, these probably no longer compile.

It looks like only GCU / ncurses and X11 always compile consistently even for unmaintained variants. And ncurses also has built-in Windows and Mac support (not X11?). So does that mean ncurses is the only future-proof interface that will work on any platform, or is there another cross-platform interface library that is highly recommended today?

What I did of course was use a javascript terminal emulator to provide a frontend - everything then runs everywhere. There are no graphics though. Yet.

But I hope to one day find the time to do it. Plain text output is very ordered and it wouldn't be difficult to give a computer a general description of what an angband output is attempting to display in order to present it graphically.

fph February 9, 2018 14:50

What is your goal here? Compiling old versions of Angband, or figuring out which interface you should use for a variant you are developing?

droof February 9, 2018 20:46

I'm trying to find my way through the Unangband codebase. It's huge and I'd prefer not to worry about interfaces and platform compatibility as I focus on gameplay changes without causing bugs on specific interfaces.

I see a lot of custom code for platform-specific interfaces. X11 for Linux, Win32 for Windows, Carbon for Mac. Each interface has a lot of custom code.

Ideally I'd prefer a single worry-free maintenance-free write-once interface for all platforms, so that all platforms run on the same code and making testing easier.

From compiling older unmaintained variants, ncurses and X11 seem code maintenance free. These always work and never cause trouble for me, even if the last code update was 2003 (like zangband). Even though I'm running the latest Ubuntu.

SDL 1 does still work with some lib dependency effort, but the SDL 2 compatibility break doesn't make it maintenance free like ncurses or X11.

Ncurses says it supports Windows natively since version 5.8, so if that works as easy as any other Windows application, this might be my best bet.

Is there any other interface library that is worth reading up on for me, to create a "write once, use anywhere, don't worry about the singular interface code anymore and just focus on gameplay" kind of interface?

Can ncurses or X11 run on Windows without the user having to jump through hoops to get it running if they have a pre-compiled binary?

AnonymousHero February 9, 2018 21:57

Quote:

Originally Posted by droof (Post 127893)
Is there any other interface library that is worth reading up on for me, to create a "write once, use anywhere, don't worry about the singular interface code anymore and just focus on gameplay" kind of interface?

Ah, the old "write once, use anywhere" idea :). The closest you're probably going to get is if you represent everything using an RGB bitmap and just write that to some abstract "screen". However, that leaves you without (true) console support and you'd have to write basically everything yourself (or rely on libraries).

(Input is a separate matter, but keyboard is usually not *that* bad to just map more-or-less directly. However, it does have to integrate cleanly into the event loop.)

Most graphical UIs can support this type of application with minimal "shim" code, but performance can be an issue, especially on high-resolution screens. (If you're using e.g. OpenGL or similar, you should be fine, but... that's not really universal, so...)

Quote:

Originally Posted by droof (Post 127893)
Can ncurses or X11 run on Windows without the user having to jump through hoops to get it running if they have a pre-compiled binary?

No. (Well, ncurses maybe, but I'm doubtful.)

Gwarl February 9, 2018 23:27

It'll work fine with a precompiled binary. You may have to do some hacks with pdcurses to compile said binary though.

droof February 10, 2018 15:42

The abstract screen approach is a fun idea. That sounds like a graphical equivalent of ncurses. If someone ever decided to pick that idea up, I'll use it :)

PDcurses works like a charm, that's great! I can compile for linux natively with ncurses and cross-compile for windows with pdcurses. Mac can probably do ncurses as well. PDcurses also supports SDL 1 and 2, very interesting if I can get the SDL library to cross-compile.

Now my GCU colors are messed up. My terminal only has 16 colors by default, so I'll optimize for those 16 colors and hope the Windows console build can use equivalent colors. Then back to the fun part, gameplay ^^

Thanks everyone!


All times are GMT +1. The time now is 04:16.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.