Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old February 17, 2018, 02:44   #21
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 53
Posts: 7,217
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by droof View Post
Also, the older V version had tile support for X11, but the latest V only supports ascii for X11. Why were tiles dropped for X11?
I believe that happened in the process of getting V GPL-compliant, because the author of the x11 tile code couldn't be tracked down.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old February 17, 2018, 06:16   #22
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,548
Derakon is on a distinguished road
Not having looked extensively at the Z codebase in awhile, I'm still inclined to believe that you'll have better luck "re-implementing" Zangband in Vanilla than the reverse, for the following reasons:

* Vanilla has had more consistent development effort over the years. Most Zangband development halted well over 11 years ago.
* Vanilla's maintainers have made a substantial effort to make the codebase clean and easier to make into a variant, which ought to reduce variant re-implementation costs.
* Conversely, copying Vanilla features over to Zangband's current codebase would be a substantial effort, as some features would require major structural reworks.
* Perhaps most important for the long haul, re-branching Zangband off of modern Vanilla will make it easier to incorporate new features as they get added to Vanilla.

You're looking at a substantial effort either way, though. Re-implementing a variant, especially one with as much history as Zangband, is no joke.
Derakon is offline   Reply With Quote
Old February 17, 2018, 08:44   #23
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,013
Donated: $40
Pete Mack is on a distinguished road
One might aim to rebase with V 3.5, not V4. V4 had massive reorg. 3.5 has most of the code cleanup; the reorg is largely in name changes. But yes. Starting from V would probably be easier, since you'd just be adding or modifying procedures, not refactoring the codebase. That was a few hundred man hours.
Pete Mack is offline   Reply With Quote
Old February 17, 2018, 09:27   #24
t4nk
Swordsman
 
Join Date: May 2016
Posts: 306
t4nk is on a distinguished road
On the other hand, I found that old code (specifically, Sangband and Sil) is just easier to read. There is a lot of indirection in V now, mostly due to so much stuff being in the text files. I don't see value in most of them. Yes, if that stuff is in C, you need to recompile after editing and that's a problem because? Also, the text files break ctags and grep (constants.txt become z_info, etc.)
Also, why is V's main loop (run_main_loop()) so convoluted? (Actually, I think I know why, but I do recommend all of you to (re)read it and try to aswer this question...)
So, if I were contemplating an Angband's variant, I probably wouldn't start with V, even though I have pretty good understanding of how it works (including the parser, main loop, dungeon generation, z_dice, and of course the ui and the command queue...) But I also think that using C for a videogame in the 21st century is a bad idea (unless your goal is to learn C), so.
t4nk is offline   Reply With Quote
Old February 17, 2018, 09:38   #25
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,013
Donated: $40
Pete Mack is on a distinguished road
@t4nk-
It is arguguably easier to read in small chunks, sure. But the new stuff you only have to read once, where previously it was repeated over and over--in the case of spellcasting, roughly a hundred times. And there is no more object flag1 flag2 and flag3, which was just impossible to read.
Moving the data to .txt files and .h files makes the code a lot more maintainable.
Pete Mack is offline   Reply With Quote
Old February 17, 2018, 11:26   #26
t4nk
Swordsman
 
Join Date: May 2016
Posts: 306
t4nk is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
@t4nk-
It is arguguably easier to read in small chunks, sure. But the new stuff you only have to read once, where previously it was repeated over and over--in the case of spellcasting, roughly a hundred times.
I'm not saying the old code was good. Especially what I think was Harrisons code; different parts of the program communicating via obscure globals (inkey_scan?), meaningless names for things (TERM_XTRA_SHAPE?), useless one-liner comments, gigantic functions... But, I'd rather deal with all that than with the huge amount of indirection in V.
Now, this is clearly a matter of taste/opinion, but I think it's reasonable to provide an opinion that is different from yours and Derakons... just for balance, you know

Quote:
And there is no more object flag1 flag2 and flag3, which was just impossible to read.
What? It was stupid, but definitely possible to read. Also LOL. You know, all these flags could just be bools... yeah, that would waste some memory... the horror
Code:
struct object_flags {
    ...
    bool blessed;
    bool burns_out;
    bool takes_fuel;
    ...
};

if (obj->flags.takes_fuel) {
    ...
}
People use stuff like CPython, where everything is a pointer to some compicated struct just to save themselves some (programmer's) time... It's ok to waste several hundred kbs of memory in a roguelike videogame just for better syntax
So I disapprove of bitflags, too

edit: I just recalled that C even has bitfields... no one uses them, though, and I don't quite remember how they work

Quote:
Moving the data to .txt files and .h files makes the code a lot more maintainable.
How so? .txt files are just like .c files, except they require the parser (while c compiler already has its own parser). And define-include trick breaks ctags and grep (and yes, I used that trick too, and I regret it now).

Last edited by t4nk; February 17, 2018 at 12:06.
t4nk is offline   Reply With Quote
Old February 17, 2018, 11:51   #27
droof
Apprentice
 
Join Date: Dec 2013
Posts: 71
droof is on a distinguished road
All this still has to be fun. If I didn't have fun working on my Friendband branch, it would've gone nowhere. Now it's the way I personally prefer to play Unangband when I play that, even if I mangled Unangband with my hacks and no one else likes it. It's still useful to me and I'm having fun with it. It should all be about having fun.

If having fun is measured in gameplay hours, then I've spend most time on Zangband variants. These variants have features that make them more enjoyable to me than angband and angband variants. It's not just the wilderness. I don't want to lose whatever makes Z enjoyable to me.

I want to avoid the netscape problem. Netscape 4.5 was popular, but the code was outdated and considered too difficult by developers. So they rewrote netscape 6 from scratch. As a result, many dedicated netscape 4.5 users were missing features in netscape 6 that made 4.5 popular with them in the first place. In hindsight, netscape should never have rebuilt on a new codebase and lose much of made netscape popular in the process.

Besides migrating or rewriting, maybe there is another refactoring option. Zangband still offers Lua. That language hasn't declined in popularity and has a reputation for being easier and faster to work with. In theory, can parts of Zangband be continued or rewritten in Lua to make refactoring and a careful modern UI integration job less time consuming? Has anything like this been tried before in previous Angband versions?

For migrating, Z 2.7.5 has multiple code files that have a word difference less than 10% with V 3.0.8, the oldest V I could find on github. Looking at changelogs, Z might have kept some files and code in sync with V 2.9.3. If some files can be synced and auto-merged upward in small version steps while fixing any problems in other code files, maybe there is a road to V 3.5.
droof is offline   Reply With Quote
Old February 17, 2018, 11:52   #28
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 53
Posts: 7,217
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by t4nk View Post
IYou know, all these flags could just be bools... yeah, that would waste some memory... the horror
Code:
struct object_flags {
    ...
    bool blessed;
    bool burns_out;
    bool takes_fuel;
    ...
};

if (obj->flags.takes_fuel) {
    ...
}
People use stuff like CPython, where everything is a pointer to some compicated struct just to save themselves some (programmer's) time... It's ok to waste several hundred kbs of memory in a roguelike videogame just for better syntax
So I disapprove of bitflags, too
I'd be more worried about parsing datafiles and writing and reading savefiles.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old February 17, 2018, 16:25   #29
t4nk
Swordsman
 
Join Date: May 2016
Posts: 306
t4nk is on a distinguished road
Quote:
Originally Posted by Nick View Post
I'd be more worried about parsing datafiles
E.g., like this:
https://github.com/martin-tornqvist/.../item_data.cpp
see init_data_list()...
And it would be even better/cleaner in C99 (because C++ is so bad )

Quote:
and writing and reading savefiles.
It's a struct full of bytes, don't think there are any problems with those. Just dump its sizeof.
Of course it would be better if C had some compile time reflection (other than sizeof and friends). Well, there are many reasons to not use C
t4nk is offline   Reply With Quote
Old February 17, 2018, 16:37   #30
t4nk
Swordsman
 
Join Date: May 2016
Posts: 306
t4nk is on a distinguished road
Quote:
Originally Posted by droof View Post
Besides migrating or rewriting, maybe there is another refactoring option. Zangband still offers Lua. That language hasn't declined in popularity and has a reputation for being easier and faster to work with. In theory, can parts of Zangband be continued or rewritten in Lua to make refactoring and a careful modern UI integration job less time consuming? Has anything like this been tried before in previous Angband versions?
I found C, for the most part, sufficient for UI; the biggest problem was bad support for Unicode, especially the lack of Unicode-capable printf(). Some other things are: variable size of wchar_t, mbstowcs() doesn't work on Windows, and I don't know what it actually guarantees w.r.t. normalization, etc. Anyway, UI is a fairly low level work (well, the kind of UI that is in Angband). I actually think Lua would be more useful for the core - monsters, objects, stuff like that.
I don't know Lua much, but I'm sure writing a roguelike in (mostly) Lua is more reasonable than doing it in pure C Come to think of it, the newest TOME is just like that?
t4nk is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Angband 3.5-dev Magnate Vanilla 70 July 2, 2012 17:47
Escape key bug in Angband dev version 21 Dec 2011 revision 700d8c8 Shockbolt Development 2 January 7, 2012 11:12
Looks like a new Angband Dev Blog is up. (17.8.2011) CJNyfalt Vanilla 23 August 20, 2011 17:46
angband-dev@oook.cz down? d_m Development 2 August 4, 2010 17:47
New to Angband Dev shinobibear Development 10 June 10, 2010 19:11


All times are GMT +1. The time now is 18:14.


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