Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old June 22, 2016, 19:44   #1
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,385
Donated: $40
Pete Mack is on a distinguished road
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.
Pete Mack is offline   Reply With Quote
Old June 22, 2016, 23:57   #2
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,841
Donated: $60
Nick will become famous soon enough
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.
Nick is offline   Reply With Quote
Old June 23, 2016, 01:44   #3
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,385
Donated: $40
Pete Mack is on a distinguished road
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)
Pete Mack is offline   Reply With Quote
Old June 23, 2016, 02:08   #4
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,936
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
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)
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-
takkaria is offline   Reply With Quote
Old June 23, 2016, 02:31   #5
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,385
Donated: $40
Pete Mack is on a distinguished road
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.
Pete Mack is offline   Reply With Quote
Old June 23, 2016, 13:10   #6
PowerWyrm
Prophet
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,666
PowerWyrm is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
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.
<- variant maintainer who did exactly that
__________________
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!
PowerWyrm is offline   Reply With Quote
Old June 24, 2016, 02:46   #7
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,385
Donated: $40
Pete Mack is on a distinguished road
...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.)

Quote:
Originally Posted by PowerWyrm View Post
<- variant maintainer who did exactly that
Pete Mack is offline   Reply With Quote
Old June 24, 2016, 13:18   #8
PowerWyrm
Prophet
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,666
PowerWyrm is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
...and just what part was the hardest?
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!
PowerWyrm 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
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


All times are GMT +1. The time now is 10:58.


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