![]() |
#1 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,999
Donated: $40
![]() |
Really impressed with the angband code base
The use of tables, etc, is very well done now. I made some early stabs at 10 years ago in the leadup to v3.5. But where it is now is vastly improved. (Flag values, for example!) The only potential downside is any variant maintainer will have a difficult time applying the improvements because they are so extensive and with so much file reorganization--diff3 doesn't work well.
|
![]() |
![]() |
![]() |
#2 |
Vanilla maintainer
Join Date: Apr 2007
Location: Canberra, Australia
Age: 55
Posts: 8,673
Donated: $60
![]() |
Thanks Pete, there's been a lot of work gone into it over a long time.
The aim is to move more stuff still out to edit files - messages, for example - and only have compiled-in tables where strictly necessary.
__________________
One for the Dark Lord on his dark throne In the Land of Mordor where the Shadows lie. |
![]() |
![]() |
![]() |
#3 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,999
Donated: $40
![]() |
There is roughly 25% less non-comment code vs 3.1, which is a really large cut as such things go, especially since there's added functionality (like working randarts)
|
![]() |
![]() |
![]() |
#4 |
Veteran
Join Date: Apr 2007
Posts: 1,947
Donated: $40
![]() |
Some portion of this might be just from a shift in coding style from having opening braces on separate lines? But that's a good count! I would have figured that the codebase was increasing in size, but seems like that's an illusion caused by having the code spread across more files.
__________________
takkaria whispers something about options. -more- |
![]() |
![]() |
![]() |
#5 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,999
Donated: $40
![]() |
I'm wrong. There is more now, not less. I was comparing with 3.0.5. I'd forgotten when the cleanup started.
It still is shorter than 3.0.5 by 10%, even excluding all lua stuff. |
![]() |
![]() |
![]() |
#6 | |
Prophet
Join Date: Apr 2008
Posts: 2,832
![]() |
Quote:
![]()
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant! |
|
![]() |
![]() |
![]() |
#7 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,999
Donated: $40
![]() |
...and just what part was the hardest?
It occurs to me that a separate changes.txt file in the src directory should have a list of all the historical improvements, since most variants forked from 3.0. I can start: (Note: code cleanup and UI only. No gameplay changes) Removal of lua (3.1.0) Menus (3.1.0) Events (3.1.0) Knowledge (3.1.0) First use of generator .h files and use of loops instead of of ugly switch blocks (3.1.0) commands function pointers ("object oriented" C) 3.1.1 Event-driven display (3.1.3?) I don't know when the other changes were made Readable .txt files/ prettification of txt parser Full use of loops/generator .h files Clean implementation of extended flags Cleanup of options Reorganization to comprehensible file names I don't know what else. (These all belong in any notional angband base) The code now makes an excellent example for well written C. (3.0.x was emphatically not, although it has moments of brilliance, like the illumination computation and terminal model.) |
![]() |
![]() |
![]() |
#8 |
Prophet
Join Date: Apr 2008
Posts: 2,832
![]() |
Nothing was hard... except porting 20+ pages of commits from the master branch and for each checking how it would work with real time + multiplayer. Currently, the only big problem with the Angband source code is that it implies in too many places that there is only one player and uses the "player" global variable:
Code:
void foo(struct player *p) { do_something(player); <-- should be do_something(p) ... if (monster_is_visible) {...} <-- should be if (player_can_see_monster(p)) ... }
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant! |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sil - knowledge base | Oski | Sil | 5 | August 19, 2013 02:15 |
Angband code for dummies? | Timo Pietilä | Development | 21 | July 21, 2010 15:05 |
Trying to understand the Angband 3.X source code | nppangband | Development | 62 | July 11, 2010 19:20 |
Angband Code Interface to GUI | meeshoo | Vanilla | 50 | February 3, 2009 18:18 |
strange C code in Angband (am I reading this right?) | will_asher | Idle chatter | 3 | February 4, 2008 10:07 |