Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old March 30, 2011, 03:43   #1
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 9,022
Derakon is on a distinguished road
Sort brands by damage

Just a random suggestion: when viewing damage for a weapon, sort the listing by how much damage is dealt, and combine entries where the damage output is the same. E.g. this is the current output from an awesome randart pike I just found:

Average damage/round: 448.5 vs. evil, 550.5 vs. demons, 550.5 vs. trolls, 550.5 vs. creatures not resistant to electricity, 550.5 vs. creatures not resistant to poison, 753.5 vs. undead, and 347 vs. others.

It'd be cleaner like this:

Average damage/round: 753.5 vs. undead, 550.5 vs. demons, trolls, creatures not resistant to electricity, and creatures not resistant to poison, 448.5 vs. evil, and 347 vs. others.

This would help emphasize that the best brand is chosen when possible, and would generally be less redundant. Obviously it's pretty minor though.
Derakon is offline   Reply With Quote
Old March 31, 2011, 22:11   #2
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,060
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
It's one of those fixes that's quite a lot of work for a definite but very modest gain. If someone sends a patch that works, it'll go straight into the nightlies - but it might be a while before the dev team get to it, since the current situation isn't terribly broken. Just sayin'.

(I say quite a lot of work because I am really bad at handling text in C, but maybe it's less difficult than I think?)
Magnate is offline   Reply With Quote
Old March 31, 2011, 22:46   #3
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 9,022
Derakon is on a distinguished road
I guess the braindead way to handle it is via multiple passes through the list of valid slays. First you go through and print all the x5 slays, then all the x3, then all the x2. Because we only have a limited number of slay types and even more limited number of slay multipliers, this kind of approach works well without actually having to sort anything.

Maybe I'll take a look at this this evening, see if I can come up with something. No guarantees though.
Derakon is offline   Reply With Quote
Old March 31, 2011, 22:59   #4
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,060
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by Derakon View Post
I guess the braindead way to handle it is via multiple passes through the list of valid slays. First you go through and print all the x5 slays, then all the x3, then all the x2. Because we only have a limited number of slay types and even more limited number of slay multipliers, this kind of approach works well without actually having to sort anything.

Maybe I'll take a look at this this evening, see if I can come up with something. No guarantees though.
I think I'd want to do this without assuming that the mults are x5/3/2 ... probably counting a loop down from best_s_ptr->mult to 2. With a call to list_slays inside the loop, it might not be too much hassle. Damn you, you've got me thinking about it now!
Magnate is offline   Reply With Quote
Old March 31, 2011, 23:11   #5
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 9,022
Derakon is on a distinguished road
Well yes, clearly you'd want to have an enumeration of slay multipliers somewhere if there isn't one already. Magic numbers are (almost always) bad. I wrote it out explicitly not to say that the program would be written that way, but rather that that would be the set of steps it ends up executing...if that makes sense at all.
Derakon is offline   Reply With Quote
Old April 1, 2011, 12:11   #6
Ycombinator
Adept
 
Join Date: Apr 2010
Location: Zürich, Switzerland
Age: 35
Posts: 156
Ycombinator is on a distinguished road
Here, try this patch: http://trac.rephial.org/ticket/1386

Implemented by sorting brands list first, then formatting adjacent items with the same multiplier. Some gruesome conditional expressions inside, but hey, that's C after all.
Ycombinator is offline   Reply With Quote
Old April 1, 2011, 13:18   #7
Timo Pietilä
Prophet
 
Join Date: Apr 2007
Location: Climbing up from hole I just dug.
Posts: 4,096
Timo Pietilä is on a distinguished road
Quote:
Originally Posted by Derakon View Post
It'd be cleaner like this:

Average damage/round: 753.5 vs. undead, 550.5 vs. demons, trolls, creatures not resistant to electricity, and creatures not resistant to poison, 448.5 vs. evil, and 347 vs. others.
Wording suggestion:

Average damage/round: 753.5 vs. undead, 550.5 vs. demons, trolls, creatures not resistant to electricity or poison, 448.5 vs. evil, and 347 vs. others

More brands:
"...to acid, electricity, fire, cold, or poison..." (BTW, game uses word "lightning" in place of "electricity" in resists.)
Timo Pietilä is offline   Reply With Quote
Old April 1, 2011, 14:06   #8
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,060
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by Ycombinator View Post
Here, try this patch: http://trac.rephial.org/ticket/1386

Implemented by sorting brands list first, then formatting adjacent items with the same multiplier. Some gruesome conditional expressions inside, but hey, that's C after all.
Excellent, thank you - I'll take a look tonight.
Magnate is offline   Reply With Quote
Old April 1, 2011, 15:18   #9
Ycombinator
Adept
 
Join Date: Apr 2010
Location: Zürich, Switzerland
Age: 35
Posts: 156
Ycombinator is on a distinguished road
Quote:
Originally Posted by Timo Pietilä View Post
Wording suggestion:

Average damage/round: 753.5 vs. undead, 550.5 vs. demons, trolls, creatures not resistant to electricity or poison, 448.5 vs. evil, and 347 vs. others

More brands:
"...to acid, electricity, fire, cold, or poison..." (BTW, game uses word "lightning" in place of "electricity" in resists.)
Good idea, but element names in resists and brand descriptions are different (electricity and lightning, fire and flames, cold and frost, poison and venom). So we can either unify them, at least in weapons descriptions (I am not so well versed in English to tell if there is any semantic difference), or introduce another column in the slays table. I can provide a patch for either solution, but I doubt it's worth the hassle.
Ycombinator is offline   Reply With Quote
Old April 1, 2011, 16:15   #10
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 9,022
Derakon is on a distinguished road
I purposefully didn't unify the brand descriptions because it would be easier to implement without doing so, and it doesn't make that big a difference. It would be more nicely-formatted though, I have to admit.

Thanks for making the patch, Ycombinator! I'll have to give it a shot this evening.
Derakon 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
Just found this place (sort of) diabloblanco Vanilla 0 February 3, 2011 08:27
Damage and elemental brands question gwarguy Vanilla 3 August 5, 2010 00:14
My own variant (sort of) Therem Harth Variants 33 July 1, 2010 09:51
why sort the pack? PowerDiver Development 8 April 16, 2010 02:21
Should brands be obvious? Magnate Vanilla 8 November 30, 2009 02:54


All times are GMT +1. The time now is 21:26.


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