--- Log opened Mon Oct 29 00:00:20 2012 20121029 00:20:11-!- lobby [~wesnoth@wesnoth/bot/lobby] has joined #wesnoth-umc-dev 20121029 00:20:11-!- Topic for #wesnoth-umc-dev: Wesnoth-UMC-Dev Project discussion and support channel | http://wesnoth-umc-dev.ai0867.net | Staff: AI0867, Espreon | Blog: http://wesnoth-umc-dev.ai0867.net/blog/ | IRC logs: http://irclogs.wesnoth.org, http://irclogs.ai0867.net 20121029 00:20:11-!- Topic set by shadowm [] [Mon Aug 27 11:27:23 2012] 20121029 00:20:11[Users #wesnoth-umc-dev] 20121029 00:20:11[@ChanServ ] [ Cookie ] [ janebot ] [ shadowm ] 20121029 00:20:11[+loonybot ] [ Espreon ] [ lobby ] [ shadowm_laptop] 20121029 00:20:11[+shikadibot ] [ esr ] [ loonycyborg] [ skyfaller ] 20121029 00:20:11[ AI0867 ] [ fendrin_] [ mattsc ] [ vultraz ] 20121029 00:20:11[ Alarantalara] [ irker834] [ melinath ] [ wesbot ] 20121029 00:20:11[ Blueblaze ] [ iwaim_ ] [ noy ] 20121029 00:20:11-!- Irssi: #wesnoth-umc-dev: Total of 23 nicks [1 ops, 0 halfops, 2 voices, 20 normal] 20121029 00:20:11-!- Home page for #wesnoth-umc-dev: http://wesnoth-umc-dev.ai0867.net 20121029 00:20:38-!- Channel #wesnoth-umc-dev created Mon Mar 31 16:51:24 2008 20121029 00:21:53-!- Irssi: Join to #wesnoth-umc-dev was synced in 110 secs 20121029 00:43:28-!- Blueblaze [~Blueblaze@2602:306:394f:6a89:6233:4bff:fe0a:827b] has quit [Remote host closed the connection] 20121029 00:43:49-!- Blueblaze [~Blueblaze@2602:306:394f:6a89:6233:4bff:fe0a:827b] has joined #wesnoth-umc-dev 20121029 00:57:19-!- Blueblaze [~Blueblaze@2602:306:394f:6a89:6233:4bff:fe0a:827b] has left #wesnoth-umc-dev [] 20121029 00:57:29-!- irker834 [~irker@ai0867.net] has quit [Quit: transmission timeout] 20121029 01:21:34-!- SeattleDad [~SeattleDa@c-67-171-51-0.hsd1.wa.comcast.net] has joined #wesnoth-umc-dev 20121029 01:26:19-!- Blueblaze [~Blueblaze@ip-64-134-146-246.public.wayport.net] has joined #wesnoth-umc-dev 20121029 01:34:32-!- fendrin_ [~fabi@88-134-62-78-dynip.superkabel.de] has quit [Ping timeout: 244 seconds] 20121029 01:34:36-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20121029 01:46:55-!- shadowm_laptop [ignacio@wesnoth/developer/shadowmaster] has quit [Read error: Connection reset by peer] 20121029 01:47:33-!- shadowm_laptop [ignacio@wesnoth/developer/shadowmaster] has joined #wesnoth-umc-dev 20121029 01:56:36-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20121029 02:03:01-!- faabumc [~vcr@wesnoth/developer/faabumc] has joined #wesnoth-umc-dev 20121029 02:06:29-!- Cookie [~quassel@unaffiliated/cookiee] has quit [Quit: No Ping reply in 180 seconds.] 20121029 02:06:59-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has joined #wesnoth-umc-dev 20121029 02:06:59-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has quit [Changing host] 20121029 02:06:59-!- Cookie [~quassel@unaffiliated/cookiee] has joined #wesnoth-umc-dev 20121029 02:20:53-!- Cookie [~quassel@unaffiliated/cookiee] has quit [Quit: No Ping reply in 180 seconds.] 20121029 02:22:48-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has joined #wesnoth-umc-dev 20121029 02:22:48-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has quit [Changing host] 20121029 02:22:48-!- Cookie [~quassel@unaffiliated/cookiee] has joined #wesnoth-umc-dev 20121029 02:29:17-!- Cookie [~quassel@unaffiliated/cookiee] has quit [Quit: No Ping reply in 180 seconds.] 20121029 02:29:44-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has joined #wesnoth-umc-dev 20121029 02:29:45-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has quit [Changing host] 20121029 02:29:45-!- Cookie [~quassel@unaffiliated/cookiee] has joined #wesnoth-umc-dev 20121029 02:36:35-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20121029 02:46:36-!- faabumc [~vcr@wesnoth/developer/faabumc] has quit [Read error: Connection reset by peer] 20121029 02:47:43-!- faabumc [~vcr@wesnoth/developer/faabumc] has joined #wesnoth-umc-dev 20121029 02:48:02-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20121029 02:50:45-!- Cookiee [~quassel@60-240-54-150.tpgi.com.au] has joined #wesnoth-umc-dev 20121029 02:50:45-!- Cookiee [~quassel@60-240-54-150.tpgi.com.au] has quit [Changing host] 20121029 02:50:45-!- Cookiee [~quassel@unaffiliated/cookiee] has joined #wesnoth-umc-dev 20121029 02:52:06-!- Cookie [~quassel@unaffiliated/cookiee] has quit [Ping timeout: 245 seconds] 20121029 02:56:37-!- Blueblaze [~Blueblaze@ip-64-134-146-246.public.wayport.net] has left #wesnoth-umc-dev [] 20121029 02:56:41-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has joined #wesnoth-umc-dev 20121029 02:56:42-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has quit [Changing host] 20121029 02:56:42-!- Cookie [~quassel@unaffiliated/cookiee] has joined #wesnoth-umc-dev 20121029 02:57:51-!- Cookiee [~quassel@unaffiliated/cookiee] has quit [Ping timeout: 276 seconds] 20121029 03:07:05-!- Cookie [~quassel@unaffiliated/cookiee] has quit [Ping timeout: 255 seconds] 20121029 03:07:56-!- fendrin [~fabi@88-134-61-254-dynip.superkabel.de] has joined #wesnoth-umc-dev 20121029 03:07:56-!- fendrin [~fabi@88-134-61-254-dynip.superkabel.de] has quit [Changing host] 20121029 03:07:56-!- fendrin [~fabi@wesnoth/developer/fendrin] has joined #wesnoth-umc-dev 20121029 03:09:22-!- noy_ [~Noy@d50-98-14-63.bchsia.telus.net] has joined #wesnoth-umc-dev 20121029 03:09:22-!- noy_ [~Noy@d50-98-14-63.bchsia.telus.net] has quit [Changing host] 20121029 03:09:22-!- noy_ [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20121029 03:12:11-!- fendrin [~fabi@wesnoth/developer/fendrin] has quit [Ping timeout: 244 seconds] 20121029 03:12:49-!- noy [~Noy@wesnoth/developer/noy] has quit [Ping timeout: 256 seconds] 20121029 03:12:49-!- noy_ is now known as noy 20121029 03:13:08-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has joined #wesnoth-umc-dev 20121029 03:13:09-!- Cookie [~quassel@60-240-54-150.tpgi.com.au] has quit [Changing host] 20121029 03:13:09-!- Cookie [~quassel@unaffiliated/cookiee] has joined #wesnoth-umc-dev 20121029 03:15:19-!- fendrin [~fabi@88-134-61-254-dynip.superkabel.de] has joined #wesnoth-umc-dev 20121029 03:15:20-!- fendrin [~fabi@88-134-61-254-dynip.superkabel.de] has quit [Changing host] 20121029 03:15:20-!- fendrin [~fabi@wesnoth/developer/fendrin] has joined #wesnoth-umc-dev 20121029 03:17:08-!- Cookie [~quassel@unaffiliated/cookiee] has quit [Client Quit] 20121029 03:46:06-!- SeattleDad [~SeattleDa@c-67-171-51-0.hsd1.wa.comcast.net] has quit [] 20121029 03:46:28-!- irker404 [~irker@ai0867.net] has joined #wesnoth-umc-dev 20121029 03:46:28< irker404> AI-Demos: mattsc master * re7dad71 / lua/ai_helper.lua : ai_helper: more efficient way of calculating large attack combos - http://git.io/JztVOQ 20121029 03:51:05< irker404> AI-Demos: mattsc master * r95627de / (lua/ai_helper.lua lua/grunt-rush-Freelands-S1_engine.lua): ai_helper.get_attack_combos(): remove unused code - http://git.io/YIo35Q 20121029 03:53:40< irker404> wesnoth-umc-dev: doofus-01 * r16123 /trunk/Tales_of_the_Setting_Sun/ (6 files in 4 dirs): 20121029 03:53:40< irker404> Some work on Ch7. Not done, but I just had a computer crash, so I want to get the files uploaded. 20121029 04:05:43-!- shadowm_laptop [ignacio@wesnoth/developer/shadowmaster] has quit [Ping timeout: 260 seconds] 20121029 04:05:46-!- mattsc [~mattsc@d154-20-32-241.bchsia.telus.net] has quit [Quit: bye] 20121029 04:14:12-!- loonybot [~loonybot@wesnoth/bot/loonybot] has quit [Remote host closed the connection] 20121029 04:35:18-!- SeattleDad [~SeattleDa@c-67-171-51-0.hsd1.wa.comcast.net] has joined #wesnoth-umc-dev 20121029 04:44:07-!- ancestral [~ancestral@75-161-178-116.mpls.qwest.net] has joined #wesnoth-umc-dev 20121029 04:52:29< irker404> AI-Demos: Alarantalara master * rd0c0480 / lua/generic-recruit_engine.lua : Get rid of now pointless multiplier - http://git.io/Ynuwxg 20121029 04:52:30< irker404> AI-Demos: Alarantalara master * r49bcb8d / lua/generic-recruit_engine.lua : Include unit cost in movement evaluation to prefer cheaper scouts - http://git.io/UrNs8g 20121029 04:52:31< irker404> AI-Demos: Alarantalara master * r78c546d / lua/generic-recruit_engine.lua : Move parentheses to the right location - http://git.io/loyhwg 20121029 05:26:35-!- faabumc [~vcr@wesnoth/developer/faabumc] has quit [Quit: Ex-Chat] 20121029 06:19:32-!- faabumc [~vcr@wesnoth/developer/faabumc] has joined #wesnoth-umc-dev 20121029 06:52:38< irker404> wesnoth-umc-dev: doofus-01 * r16124 /trunk/Tales_of_the_Setting_Sun/ (maps/703b.map dist/VERSION): 20121029 06:52:39< irker404> releasing 0.0.24 20121029 07:10:13-!- Jarkko_P [3e94649e@gateway/web/freenode/ip.62.148.100.158] has joined #wesnoth-umc-dev 20121029 07:16:36< irker404> wesnoth-umc-dev: sigurdfdragon * r16125 /trunk/Random_Campaign/ (3 files in 2 dirs): 20121029 07:16:37< irker404> RC: Expand a few macros and set default setting of village_gold=1 for 1p version, and village_gold=2 for 3p in mp. 20121029 07:43:49-!- SeattleDad [~SeattleDa@c-67-171-51-0.hsd1.wa.comcast.net] has quit [Quit: The computer fell asleep] 20121029 07:44:06-!- SeattleDad [~SeattleDa@c-67-171-51-0.hsd1.wa.comcast.net] has joined #wesnoth-umc-dev 20121029 07:49:18-!- SeattleDad [~SeattleDa@c-67-171-51-0.hsd1.wa.comcast.net] has quit [Ping timeout: 252 seconds] 20121029 07:55:11< irker404> wesnoth-umc-dev: shikadilord * r16126 /trunk/After_the_Storm/ (4 files in 2 dirs): 20121029 07:55:12< irker404> AtS: new baseframes for the Dusk Faerie line 20121029 08:19:44-!- zookeeper [~lmsnie@wesnoth/developer/zookeeper] has joined #wesnoth-umc-dev 20121029 08:52:24-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20121029 09:06:11-!- Lukc [~Lukc@natsu.upyum.com] has joined #wesnoth-umc-dev 20121029 09:43:48-!- ancestral [~ancestral@75-161-178-116.mpls.qwest.net] has quit [Quit: i go nstuf kthxbai] 20121029 10:16:10-!- faabumc [~vcr@wesnoth/developer/faabumc] has quit [Quit: Ex-Chat] 20121029 10:55:14-!- irker404 [~irker@ai0867.net] has quit [Quit: transmission timeout] 20121029 12:00:37-!- Jarkko_P [3e94649e@gateway/web/freenode/ip.62.148.100.158] has quit [] 20121029 12:39:18-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20121029 12:39:47-!- noy [~Noy@wesnoth/developer/noy] has quit [Client Quit] 20121029 13:49:42-!- loonybot [~loonybot@ppp94-29-12-11.pppoe.spdop.ru] has joined #wesnoth-umc-dev 20121029 13:49:43-!- loonybot [~loonybot@ppp94-29-12-11.pppoe.spdop.ru] has quit [Changing host] 20121029 13:49:43-!- loonybot [~loonybot@wesnoth/bot/loonybot] has joined #wesnoth-umc-dev 20121029 13:49:45-!- mode/#wesnoth-umc-dev [+v loonybot] by ChanServ 20121029 14:46:01-!- irker573 [~irker@ai0867.net] has joined #wesnoth-umc-dev 20121029 14:46:01< irker573> AI-Demos: mattsc master * r5d0c5ba / lua/ai_helper.lua : ai_helper.attack_combo_stats: cleaned up comments - http://git.io/gCeZxQ 20121029 15:06:13< irker573> AI-Demos: mattsc master * r9a370e8 / lua/ai_helper.lua : ai_helper.attack_rating: clean up comments - http://git.io/NpOIsg 20121029 15:07:30< irker573> AI-Demos: mattsc master * r2b803d7 / lua/ai_helper.lua : ai_helper.attack_rating: use side of attackers, not wesnoth.current.side - http://git.io/VNFrbQ 20121029 15:09:56< irker573> AI-Demos: mattsc master * r561883e / lua/ai_helper.lua : ai_helper_attack_rating: weights are applied at the end - http://git.io/Fks3ZA 20121029 15:17:11-!- SeattleDad [~SeattleDa@c-67-171-51-0.hsd1.wa.comcast.net] has joined #wesnoth-umc-dev 20121029 15:17:29< AI0867> commits from mattsc, but no mattsc in the channel =/ 20121029 15:32:41-!- mattsc [~mattsc@fw.hia.nrc.ca] has joined #wesnoth-umc-dev 20121029 15:33:27< mattsc> AI0867: nope, he's hiding 20121029 15:45:08< AI0867> =P 20121029 15:45:30< AI0867> I was wondering if you might be interested in a "selfish unit-based" AI 20121029 15:45:52< AI0867> it's not going to be optimal, but I'd have a use for it in a campaign 20121029 15:46:34< AI0867> the idea is still somewhat vague in my head, but it should crystallize out if I actually start writing it 20121029 15:48:36< mattsc> Do you have enough to elaborate a little? 20121029 15:49:54< mattsc> And just to clarify: do you mean interested in writing it, or interested in adding it to AI-Demos (although the answer is likely yes to both) 20121029 16:08:03-!- skyfaller [~skyfaller@wikipedia/Skyfaller] has quit [Ping timeout: 245 seconds] 20121029 16:09:41-!- ancestral [~ancestral@75-161-178-116.mpls.qwest.net] has joined #wesnoth-umc-dev 20121029 16:12:56-!- skyfaller [~skyfaller@ool-43551e75.dyn.optonline.net] has joined #wesnoth-umc-dev 20121029 16:12:56-!- skyfaller [~skyfaller@ool-43551e75.dyn.optonline.net] has quit [Changing host] 20121029 16:12:56-!- skyfaller [~skyfaller@wikipedia/Skyfaller] has joined #wesnoth-umc-dev 20121029 16:22:01-!- ancestral [~ancestral@75-161-178-116.mpls.qwest.net] has quit [Quit: i go nstuf kthxbai] 20121029 16:31:18-!- SeattleDad [~SeattleDa@c-67-171-51-0.hsd1.wa.comcast.net] has quit [Quit: The computer fell asleep] 20121029 16:44:41< irker573> AI-Demos: Alarantalara master * r6cf47df / lua/generic-recruit_engine.lua : Make offense slightly less about cost - http://git.io/wXR8GQ 20121029 16:44:42< irker573> AI-Demos: Alarantalara master * rb0486ec / lua/generic-recruit_engine.lua : Simplify equation by removing constant - http://git.io/FDtrsg 20121029 16:51:18< mattsc> Hi, Alarantalara: do you have 5min to discuss attack ratings? 20121029 16:52:04< Alarantalara> possibly 20121029 16:57:45< mattsc> I think I've been using some faulty logic to rate attack combinations. 20121029 16:59:02< mattsc> I am using that, in an attack combination of several attackers on an enemy, the rating for the attackers is additive. Meaning, I can evaluate each attacker individually and then add them together. 20121029 16:59:30< mattsc> That works for some things, such as total damage taken and resources (gold) used. 20121029 17:00:00< mattsc> But there are other things (such as terrain the attackers are on) for which that is no good. 20121029 17:01:04< mattsc> For example, currently the terrain rating is -wesnoth.unit_defense() * terrain_weight 20121029 17:01:33< mattsc> That's always negative, so it will always prefer attacks with single units (all else being equal). 20121029 17:02:28< mattsc> If I make it 100 - wesnoth.unit_defense(), it's always positive and will always prefer attacks with as many units as possible. And using (50 - ...) isn't a whole lot better. 20121029 17:03:00< mattsc> So I'm a bit at a loss at the moment how to rate attack combinations with a varying amount of units relative to each other. 20121029 17:03:11-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20121029 17:03:54< Alarantalara> Can you find an average defense and add it in at the end? 20121029 17:03:55< mattsc> Maybe I need to split this up into a term that is additive, and one that is additive once divided by the number of units. 20121029 17:04:45< mattsc> Yeah, I think that's what I meant with my last line. 20121029 17:05:01< mattsc> I'm just not sure if that's the right thing to do. 20121029 17:05:40< mattsc> In fact, I'm not sure whether I should add a terrain defense rating at all, since that should also be reflected in the attack outcome. 20121029 17:06:20< Alarantalara> You'd still want it, otherwise attack with archers from the water against melee units is "good" 20121029 17:06:44< Alarantalara> Unless you already include counter attacks in all cases 20121029 17:06:51< mattsc> Oh, right. That's the reason why I added it. D'oh... 20121029 17:07:13< mattsc> No, doing counter attacks in all cases is prohibitively expensive. 20121029 17:07:45< mattsc> Anyway, just wondering whether you had any immediate smart ideas. If not, I'll keep fiddling with things. 20121029 17:08:28< mattsc> It's these kinds of things why Fred currently loses to Ron. 20121029 17:08:31< Alarantalara> The other thing that comes to mind is that you somehow need to represent the fact that 60%->70% is better than 40%->50% 20121029 17:09:21< mattsc> That could be done by adding an exponential power > 1 to the term 20121029 17:09:21< skyfaller> Alarantalara: why is it better? I know instinctively that is true, but can you explain? 20121029 17:09:54< Alarantalara> A simple example: 90->100 means you no longer get hit 20121029 17:10:08< Alarantalara> 80->90 halves the chance you get hit 20121029 17:10:32< Alarantalara> 50->60 only reduces the number of hits by 20% 20121029 17:10:38< skyfaller> ah, interesting 20121029 17:11:25< mattsc> skyfaller: I think that's why wesnoth.unit_defense actually returns 100 - defense. (and why the engine uses it that way) 20121029 17:11:49< mattsc> Of course that means that this term should be a multiplicative factor, not an additive term... 20121029 17:11:55< mattsc> Ugh! 20121029 17:13:00< mattsc> Alarantalara: thanks, this was useful already. I'll pick this back up tonight. 20121029 17:13:37< mattsc> AI0867: did you see my questions up there? 20121029 17:19:17< AI0867> mattsc: haven't started coding yet 20121029 17:20:09< AI0867> adding, and maybe collaborating 20121029 17:20:55< AI0867> mainly, I want an excuse to start working on it already ;) 20121029 17:21:03-!- noy [~Noy@wesnoth/developer/noy] has quit [Ping timeout: 276 seconds] 20121029 17:21:50< mattsc> AI0867: sounds good to me. Any addition would be good and this might be a candidate for a Micro AI 20121029 17:22:15< mattsc> Let me know what I can do to provide additional motivation. 20121029 17:22:17-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20121029 17:28:32< Alarantalara> mattsc: Try using the geometric mean of the chance to get hit 20121029 17:29:04< Alarantalara> It's the nth root of the product of all the values 20121029 17:32:55< mattsc> Alarantalara: yeah, that makes sense. 20121029 17:33:53< Alarantalara> The number gets bigger the less skewed the results, so it would be a negative weight 20121029 17:46:14< skyfaller> man, I think I forgot all of the math I learned in school, I don't remember learning about geometric means 20121029 17:47:35< Alarantalara> There's also a harmonic mean which may be even more appropriate (I haven't had to think about which one should be used in a long time) 20121029 17:48:13< skyfaller> if only my teachers had told me, "someday you'll need to write an AI for a videogame and this math will be important!" 20121029 17:49:47< Alarantalara> How would your teachers possibly know that? 20121029 17:50:21< Alarantalara> And if you were doing 3D graphics instead, that math is useless and you need matrix algebra in stead 20121029 17:50:39< skyfaller> hahahaha 20121029 17:51:02< skyfaller> I blame my teachers for not having precognition 20121029 17:51:08-!- mattsc [~mattsc@fw.hia.nrc.ca] has quit [Quit: bye] 20121029 17:54:49< skyfaller> Alarantalara: this page explains some differences between the two kinds of means, but I'm not sure it helped me understand which to use in this situation: http://economistatlarge.com/finance/applied-finance/differences-arithmetic-geometric-harmonic-means 20121029 17:55:27< Alarantalara> That's the economist's perspective 20121029 17:55:56< skyfaller> ok, how about this? http://mathforum.org/library/drmath/view/69480.html 20121029 17:58:04< Alarantalara> That's closer to why I'm wondering if the harmonic mean may be the best. We're concerned about the rate of getting hit, but I'm not sure # of attacks is a good analogue to distance in the example given. 20121029 17:58:19< skyfaller> I can't wrap my head around what he means when he says "harmonic mean when the reciprocals of the numbers add up" 20121029 18:00:23< Alarantalara> There are physical occurrences where the importance of something is related to 1/it's value 20121029 18:00:52< skyfaller> I mean, does that apply here? 20121029 18:01:51< Alarantalara> If we had a baseline defense we were comparing to, yes 20121029 18:02:27< Alarantalara> It's almost exactly how I got the values for how much better each of the changed defences were 20121029 18:03:02< skyfaller> ah, good point 20121029 18:03:04< Alarantalara> The only thing is that we're comparing the absolute numbers here to come up with a result, so I'm not sure it applies 20121029 18:03:40< skyfaller> If only I still had a statistics teacher to ask! 20121029 18:04:21< skyfaller> well, would you say that the number "multiply together" so we should use the geometric mean? 20121029 18:04:24< skyfaller> *numbers 20121029 18:07:49< Alarantalara> I'm not sure 20121029 18:09:42< Alarantalara> I am sure they're both more correct than the arithmetic mean, but that doesn't say which one IS correct 20121029 18:11:50< Alarantalara> so let's do some math and find out 20121029 18:12:06< Alarantalara> Or at least ask questions 20121029 18:12:10< skyfaller> Alarantalara: can you explain to me again, very slowly, exactly what we are measuring? 20121029 18:12:55< Alarantalara> We are measuring which combination of defence values is best in a way that doesn't depend on the number of units involved 20121029 18:13:16< skyfaller> combination of defense values? 20121029 18:13:26< Alarantalara> Say there are three possible attacks on an enemy unit 20121029 18:13:44< Alarantalara> The first is with one of our units from hex A 20121029 18:13:55< Alarantalara> The second uses two units from hexes A and B 20121029 18:14:23< Alarantalara> The third uses the same two units but swaps which hex the unit is on 20121029 18:14:58< Alarantalara> Which one leaves us with the best defensive position in terms of not taking damage 20121029 18:15:31< Alarantalara> Assume there is only one enemy unit so we don't have to worry about being surrounded in the first case 20121029 18:15:37< skyfaller> wait... so we're measuring the defense of our own units, not the enemy units? 20121029 18:15:42< Alarantalara> yes 20121029 18:17:09< Alarantalara> As to why, if you had an assassin and an archer attacking a grunt, you can't figure out the correct result based on retaliation damage from the attacks because there sin't any 20121029 18:17:41< Alarantalara> and it's too expensive to do all possible enemy counter attack on the opponent's turn, so we have to use defense as an approximation 20121029 18:20:49< skyfaller> Alarantalara: can you point out the current code that we are using? 20121029 18:23:55< Alarantalara> I'm not sure exactly where the attack one is, but holding does the same thing at line 508 20121029 18:24:07< skyfaller> in which file? 20121029 18:24:29< Alarantalara> grunt-rush-Freelands-S!_engine.lua 20121029 18:28:24< Alarantalara> The line in question here is 1574 of ai_helper.lua 20121029 18:28:39< Alarantalara> since I've finally found it 20121029 18:33:01< skyfaller> ok, so can you tell me in plain English what that code is doing? 20121029 18:34:37< skyfaller> Alarantalara: I'm trying to explain this situation to my friend who is in grad school for statistics :P 20121029 18:35:22< Alarantalara> That code is currently just adding all the numbers together, causing a bias toward using multiple units 20121029 18:36:24< skyfaller> why does it cause a bias towards multiple units? 20121029 18:36:26< Alarantalara> Which means that if an attack with 1 unit has a 50%CTK and an attack with 2 units also does, it will prefer the two unit one 20121029 18:36:41< Alarantalara> because it adds the ratings together at the moment 20121029 18:36:57< skyfaller> why does that make it prefer multiple units? 20121029 18:38:32< Alarantalara> sorry, it subtracts, so it prefers the one units case (calculation of attacker defenses is on 1514 of same file) 20121029 18:39:29< Alarantalara> Anyway for each unit involved, the value is calculated for the terrain and added to the result, so as more units are added to the attack, the magnitude become larger 20121029 18:39:49< Alarantalara> 40%+50%+40% = 170% 20121029 18:39:55< skyfaller> (I thought you said it subtracts?) 20121029 18:39:55< Alarantalara> 130% 20121029 18:40:10< Alarantalara> -40%-50%-40% = -130% 20121029 18:40:22< Alarantalara> the magnitude remains bigger 20121029 18:40:38< Alarantalara> 130% is larger than a single unit at 50% 20121029 18:41:51< Alarantalara> So we need a number that doesn't change in magnitude as the number of results increases (if the number of units matters, we can add that in later) 20121029 18:42:12< Alarantalara> Such a value resembles a mean (type unspecified) 20121029 18:43:15< Alarantalara> We know that arithmetic is wrong, because given flat and hills to attack from, an assassin should be on the hills and the archer should be on the flat 20121029 18:44:10< Alarantalara> but (60+50)/2 = (70+40)/2 so arithmetic mean says they're the same, which is incorrect 20121029 18:45:49< Alarantalara> the other two both say the desired case is different, but they don't agree on how much different 20121029 18:46:11< Alarantalara> and it would be useful to correctly measure the difference in quality 20121029 18:48:16< Alarantalara> Also, both other means produce smaller results when the numbers are different, so we need to take the chance of being hit, not the defense values so that good is always smaller 20121029 18:50:14< Alarantalara> geometric mean then becomes (40*50)^(1/2) compared to (30*60)^(1/2) 20121029 18:51:23< Alarantalara> 44.7 vs 42.4 (and a single archer on the hill would be 50) 20121029 18:53:33< Alarantalara> Note that the presence of the assassin with better defense still gives a better result than a single archer, but it's worse than the assassin by itself (30) 20121029 18:55:22< skyfaller> Alarantalara: which is better, 60+50 or 70+40? 20121029 18:55:34< skyfaller> like, in your opinion, not in the opinion of our current code 20121029 18:56:03< skyfaller> 70+40 is better? why? 20121029 18:56:57< Alarantalara> I would give two reasons: 20121029 18:57:26< Alarantalara> 1) The units with lower defense tend to have more hp, so they can better survive taking extra hits 20121029 18:59:06< Alarantalara> 2) There are a limited number of places to attack from, so extremely high defense values are preferable when possible as they represent harder points to break and have lines destroyed 20121029 18:59:48< skyfaller> interesting 20121029 18:59:57< Alarantalara> In a solid line, the two spaces are each attacked once and a third unit has a choice 20121029 19:00:15< skyfaller> my statistics friend was assuming we wanted 60+50 and was telling me ways to reduce variance :P 20121029 19:01:24< Alarantalara> The potential reduction in damage to the unit with high defense from that one attack is greater than the amount extra taken by the unit with lowered defense, so the total amount of expected damage is lower 20121029 19:01:31< Alarantalara> though it is concentrated on a single unit 20121029 19:02:37< skyfaller> ohhhhh 20121029 19:02:39< Alarantalara> I am assuming that is better 20121029 19:03:07< skyfaller> because the difference between 60 and 70 is more important than the difference between 40 and 50, right? 20121029 19:03:14< Alarantalara> yes 20121029 19:03:16< skyfaller> as you were explaining earlier 20121029 19:04:07< Alarantalara> I am assuming that we would prefer one badly damaged unit to two moderately damaged ones 20121029 19:04:41< skyfaller> but we know that putting units in water and getting like 20% defense is terrible, right? 20121029 19:04:42< Alarantalara> Since I find my defenses usually crumble when I have no healthy units to put in the way 20121029 19:04:48< Alarantalara> yes 20121029 19:05:22< Alarantalara> But if you had to put a unit in the water to kill something, I'd rather put the dwarf than the footpad 20121029 19:05:25< skyfaller> so we dislike extremely low values, and like extremely high values, and we don't care about stuff in the middle? 20121029 19:06:03< skyfaller> .... but that's because of other things about the dwarf and the footpad, not just their defense values 20121029 19:06:25< skyfaller> you need to do pure math here, not including assumptions about the units implicitly 20121029 19:06:26< Alarantalara> even defense 30->20 is far better drop than 60->40 20121029 19:06:37< Alarantalara> still pure math 20121029 19:06:49< skyfaller> Oh, I guess I see 20121029 19:07:02< skyfaller> can you tell me in math why defense 30->20 is far better drop than 60->40? 20121029 19:08:09< Alarantalara> In the first, you go from being hit 70% to 80% of the time, so 14% more often. In the second, you get hit 50% more often 20121029 19:08:48< skyfaller> wait really? 20121029 19:08:52< Alarantalara> yes 20121029 19:08:54< skyfaller> how do you calculate that? 20121029 19:09:03< Alarantalara> 80/70 and 60/40 20121029 19:10:34< Alarantalara> And this is why footpads in water is terrible 20121029 19:10:46< skyfaller> I see 20121029 19:10:54< skyfaller> I think I've been playing wrong :( 20121029 19:11:52< Alarantalara> The colour of the defense in game biases people to do the opposite 20121029 19:12:08< Alarantalara> You see red and thinkooh, terrible 20121029 19:12:38< Alarantalara> But the consequences to the high defense units are way worse 20121029 19:12:57< Alarantalara> Of course, marksmen and magical units mess this up 20121029 19:13:13< Alarantalara> Since with a marksman around, the 60, 50 is preferable 20121029 19:13:51< Alarantalara> as the other becomes 60,40 20121029 19:15:34< Alarantalara> sorry, my mind is getting chance to hit confused with defense 20121029 19:15:38< Alarantalara> they're both exactly the same 20121029 19:15:42< Alarantalara> with marksmen 20121029 19:15:57< skyfaller> wait, come again? 20121029 19:16:08< skyfaller> oh right 20121029 19:16:32< skyfaller> ... but not every unit that can attack you is a marksman/magic 20121029 19:16:54< skyfaller> let's say they only have one marksman and the other enemies are normal 20121029 19:16:59< Alarantalara> which is why we will ignore it for now 20121029 19:16:59< skyfaller> how do you deal with that? 20121029 19:17:03< skyfaller> ok :) 20121029 19:19:03< Alarantalara> Marksman makes it desirable to avoid 30% or lower defense, while magical can make is desirable 20121029 19:19:17< Alarantalara> Attack a mage from shallow water? It's on! 20121029 19:20:36< skyfaller> :) 20121029 19:24:12< Alarantalara> The end result is that magical can be ignored entirely since it doesn't matter where the units are anyway 20121029 19:24:36< Alarantalara> While marksman can sometimes lead to switching to avoid 30% or lower defense 20121029 19:24:59< Alarantalara> You need a situation where the only unit that could attack both units was the marksman though 20121029 19:25:19< Alarantalara> *only enemy unit that could attack both allied units 20121029 19:27:53< Alarantalara> I suspect in game, that would mostly occur when village stealing against elves 20121029 19:28:13< skyfaller> ok, let's back up 20121029 19:28:24< skyfaller> forget magic and marksman for now 20121029 19:28:30< Alarantalara> sure 20121029 19:29:28< skyfaller> let's run the numbers with all of the types of means, including the ones we are not currently considering, arithmetic mean and quadratic mean, just because I'm a dick 20121029 19:29:55< skyfaller> let's create some situations where we "know" the right answer 20121029 19:30:17< skyfaller> so we know that we prefer 70+40 over 60+50 20121029 19:30:28< skyfaller> and we know that we prefer 20+60 over 30+40 20121029 19:30:38< Alarantalara> I'm going to use chance to hit rather than defense, so 40,50 and 30,60 20121029 19:30:52< Alarantalara> instead of 60,50 and 70,40 20121029 19:31:00< skyfaller> blahhhh math noooooo 20121029 19:31:07< skyfaller> ok, carry on 20121029 19:31:16< Alarantalara> arithmetic: 45 vs 45 20121029 19:32:19< Alarantalara> geometric: 44.7 vs 42.4 20121029 19:34:13< skyfaller> and lower numbers are better here because we are calculating chance to be hit 20121029 19:34:17< Alarantalara> es 20121029 19:34:19< Alarantalara> yes 20121029 19:34:52< Alarantalara> harmonic: 44.4 vs 40 20121029 19:36:25< Alarantalara> quadratic: 45.27 vs 67.1 20121029 19:36:34< Alarantalara> sorry 20121029 19:36:49< skyfaller> sorry? 20121029 19:36:53< Alarantalara> 45.27 vs 47.43 20121029 19:37:06< Alarantalara> I forgot a step for the second quadratic result 20121029 19:37:13< skyfaller> ok, so quadratic mean is also definitely giving us the wrong result still 20121029 19:37:21< skyfaller> it is preferring the wrong one 20121029 19:37:25< Alarantalara> yes 20121029 19:37:44< skyfaller> ok, now do it again for the dwarf and footpad on flat and water 20121029 19:37:57< skyfaller> which was 20+60 vs. 30+40 defense 20121029 19:38:25< Alarantalara> translate to chance to hit = 80,40 and 70,60 20121029 19:38:33< skyfaller> ok 20121029 19:38:37< Alarantalara> arithmetic: 60, 65 20121029 19:39:27< Alarantalara> geometric: 56.6 vs 64.8 20121029 19:40:16< Alarantalara> harmonic: 53.3 vs 64.6 20121029 19:40:24< Alarantalara> I'll skip quadratic 20121029 19:40:47< Alarantalara> Here they all say putting the dwarf in water is better 20121029 19:41:04< Alarantalara> But harmonic is most certain 20121029 19:42:16< Alarantalara> The question is really if the greater difference more accurately represents the difference in quality of the results 20121029 19:45:11< skyfaller> how would we know? 20121029 19:45:25< Alarantalara> We need to make a model for the enemy attacks 20121029 19:46:15< Alarantalara> If you had a choice of two units to attack with 1000 hp each I assume you would always go for the one with lower defense? 20121029 19:47:02< skyfaller> I mean, I'd also have to consider my own defense and retaliation :P 20121029 19:47:08< skyfaller> and whether one is the leader! 20121029 19:47:09< skyfaller> but sure 20121029 19:47:46< Alarantalara> So we could start with a model that assumes that the unit with lower defense will be attacked twice as often (since only one unit get a choices and other units have to attack in the other spaces) and count the expected number of hits in both cases 20121029 19:48:15< skyfaller> but wait, what if I have more hexes on the guy with better defense? 20121029 19:49:07< Alarantalara> on the hex with better defense you mean? 20121029 19:49:38< Alarantalara> then having the best possible defense would be even better 20121029 19:50:03< skyfaller> really? 20121029 19:50:11< skyfaller> oh, yeah 20121029 19:50:34< Alarantalara> The fewer units that have a choice, the better the lopsided version becomes 20121029 19:51:49< skyfaller> so here's a function for telling the AI to prefer the dwarf in the water: f(old, new) = (1 - new)/(1 - old) 20121029 19:51:57< skyfaller> f = change to chance to be hit 20121029 19:53:01< skyfaller> using that f 20121029 19:53:19< skyfaller> f(30, 20) = 1.142 20121029 19:53:27< skyfaller> f(60,40) = 1.5 20121029 19:53:38< skyfaller> so the AI would choose the dwarf in the water 20121029 19:53:52< skyfaller> right? 20121029 19:54:33< Alarantalara> the problem is that that's the benefit for individual units 20121029 19:55:04< Alarantalara> now do it for 3 units with water, flat, hills as the attack spots 20121029 19:56:02< skyfaller> can you just do the arithmetic mean for each individual value of f? 20121029 19:56:08< skyfaller> oh 20121029 19:56:13< skyfaller> 3 possible hexes 20121029 19:56:14< Alarantalara> also, we're evaluating each attack in isolation 20121029 19:56:57< Alarantalara> since what if the footpad can reach the water but the dwarf can't? 20121029 19:58:07< Alarantalara> or you have only two hexes to attack from, but there are 5 different units that can reach those hexes 20121029 19:58:38< Alarantalara> and you want the ones with both the best CTK and the best chance of surviving after 20121029 20:00:05< Alarantalara> The function can't incorporate the other possibilities directly, since the number grows explosively (picking the biggest/smallest from a list is much, much faster than comparing all of them against each other) 20121029 20:02:45< skyfaller> isn't this a little like figuring out who has the competitive advantage in producing a good in microeconomics? 20121029 20:03:37< Alarantalara> quite likely 20121029 20:04:02< Alarantalara> I'm not familiar enough with that area to say though 20121029 20:05:08< Alarantalara> though I would hope that microeconomics doesn't have a "sabotage the competition" term 20121029 20:07:15< Alarantalara> since our goal is to minimize the ability of our opponent to do damage, and that includes removing units from the field entirely. (The who cares what the defense values of our units are if there are no enemies left term) 20121029 20:08:50< skyfaller> I mean, how many units can we be talking about at most? 10? and you can't have more than 6 hexes on an opponent 20121029 20:09:00< skyfaller> so that's 10^6 possible moves, that's not that many, is it? 20121029 20:10:03< skyfaller> is a million possible moves a lot for Fred to handle? :) 20121029 20:10:30< Alarantalara> It's not 10^6, it's a bit less, but a million get pretty crazy when you have to do it for each unit you want to attack 20121029 20:12:06< Alarantalara> It's worth noting that I managed to come up with a situation where Fred took more than 10 minutes to calculate all the possibilities in normal play 20121029 20:12:12< skyfaller> hahaha 20121029 20:12:53< Alarantalara> mattsc managed to exploit redundancy to get that down to about 5 seconds, but yes, it's a lot of moves 20121029 20:14:04< Alarantalara> Fred had 8 possible leader attacks, each of which had something like 300,000 possible counter attacks, so 2.4 million attack evaluations later... 20121029 20:14:49< Alarantalara> this part is actually a fast part of the problem, calculating damage inflicted is the harder part 20121029 20:15:05< Alarantalara> and that was why it took so long 20121029 20:15:45< Alarantalara> but if you want to compare everything against everything else in pairs like above, that 1,000,000 becomes 1,000,000,000,000 things to do and then you die 20121029 20:18:47< Alarantalara> Alternately, if you can do the million moves in 1 millisecond, it would take about 1.5 hours to compare them all against each other 20121029 20:19:52< Alarantalara> The math associated with this is described here: http://en.wikipedia.org/wiki/Big_O_notation 20121029 20:20:25< Alarantalara> Finding the max is O(n), calculating a result for all pairs is O(n^2) 20121029 20:21:13< skyfaller> so what are we doing instead? 20121029 20:21:21< Alarantalara> So we can find the highest value from a set fast, but that value has to be independent of the other possibilities 20121029 20:21:37< Alarantalara> We calculate all the means and then pick the smallest one 20121029 20:22:03< Alarantalara> Since the means only care about the 1-6 units involved in the attack, they're fast 20121029 20:22:50< Alarantalara> We just can't find a value relative to all the others by including them in the formula 20121029 20:23:35< Alarantalara> We need an absolute, not relative, measure of goodness 20121029 20:27:07< skyfaller> my stats friend is suggesting a distance measure, maybe mahalanobis... from either 0 or 100 (for perfect defense) 20121029 20:27:24< skyfaller> I do not know what he is talking about :) So I will listen to him explain 20121029 20:30:07< skyfaller> basically he's suggesting we test how good each move is compared to a perfect move? 20121029 20:31:36< Alarantalara> How do we calculate the perfect move? 20121029 20:33:25< skyfaller> ok, here's what he said: 20121029 20:33:30< skyfaller> let's assume we have that f() function from before 20121029 20:33:35< skyfaller> so we have a series of possible moves 20121029 20:33:41< skyfaller> like (.5, .5, 2) and (.75, 1, 1.5) 20121029 20:33:49< skyfaller> the former means the first two characters double their defense, the last character halves it 20121029 20:33:57< skyfaller> and the 2nd means the first character is 75% as good, 2nd doesn't change, 3rd gets worse 20121029 20:34:13< skyfaller> then you want to know which of those points is closest to... (0, 0, 0)... I think 20121029 20:34:13< Alarantalara> Compared to where they are now? 20121029 20:34:18< skyfaller> (0, 0, 0) means the characters move to all perfect 100 defense spots 20121029 20:34:57< skyfaller> ... I guess compared to where they are now? I'm not sure 20121029 20:35:51< Alarantalara> It can't be the other places they could go. Even a dwarf could have 40-50 possible locations 20121029 20:36:50< Alarantalara> And once we have 6 units we're back in the billions range 20121029 20:36:56< skyfaller> I guess the problem is that we don't care where they are now 20121029 20:37:07< skyfaller> because they are probably not currently in position to attack 20121029 20:38:34< Alarantalara> Even if they are, it's not helpful unless they can attack the unit we want to kill 20121029 20:40:05< Alarantalara> We are scoring attacks against each other, and it might be preferable to only attack units we can reach from high defense 20121029 20:40:17< Alarantalara> but it's not as though that's always an option 20121029 20:42:37< skyfaller> I'm getting pretty lost here 20121029 20:42:49-!- mattsc [~mattsc@d154-20-32-241.bchsia.telus.net] has joined #wesnoth-umc-dev 20121029 20:43:03-!- vultraz [~chatzilla@wesnoth/developer/vultraz] has quit [Ping timeout: 272 seconds] 20121029 20:43:10< Alarantalara> I'm reasonably sure that killing the DA and ending up on bad terrain is better than killing the Ghoul and staying on good terrain 20121029 20:43:36< skyfaller> well, that depends on the situation 20121029 20:43:48< skyfaller> if you're drakes, obviously you HAVE to kill the DA 20121029 20:45:35< Alarantalara> I'd say that's equally true if you're undead 20121029 20:46:07< skyfaller> my point is just there must be some situation where the ghoul is a bigger threat 20121029 20:46:20< skyfaller> maybe dwarves during the day? 20121029 20:46:48< Alarantalara> Alright, I'll add a "usually" to that last sentence 20121029 20:47:34< mattsc> skyfaller, Alarantalara: sorry I had to run off there just before the discussion got really interesting. 20121029 20:47:35< Alarantalara> The real problem is that the best move cannot be made in isolation 20121029 20:48:08< mattsc> I still don't have time to read up on everything you wrote, but I'll try to follow along the current conversation with one eye. 20121029 20:48:13< Alarantalara> If your first attack with your mage misses all three times, finishing up with something else is no longer possible 20121029 20:49:06< Alarantalara> So what we end up with is trying to identify moves that are likely to be better with an assumed background 20121029 20:49:41< Alarantalara> mattsc: correct me if I'm wrong, but we currently decide if we want to attack at all on a front before actually attacking 20121029 20:49:58< mattsc> That's correct 20121029 20:50:19< Alarantalara> and then we pick the attack most likely to achieve the goal of killing lots of stuff 20121029 20:50:44< Alarantalara> but there may be several attacks that have similar chances of doing that, so we want to also pick the safest one within that limit 20121029 20:50:57< mattsc> Then we pick up the attack that gets the highest rating, where killing stuff and not dying is one of the most important factors. 20121029 20:51:14< mattsc> Right. 20121029 20:51:32< mattsc> If you look at ai_helper.attack_rating, it has both a CTK and CTD (chance to die) term 20121029 20:51:47< Alarantalara> but that changes as we move and enemy units die (because we can now put units in the way) 20121029 20:52:10< Alarantalara> so we need to guess the best move if nothing else changes 20121029 20:52:11< mattsc> Correct. 20121029 20:52:29< Alarantalara> make that move and then start again from the beginning 20121029 20:52:44< mattsc> Counter attacks are too expensive to be calculated for every single attack. 20121029 20:53:15< mattsc> Yes. 20121029 20:53:35< Alarantalara> so we have an initially unknown collection of possible attacks, and we want to score them 20121029 20:54:17< Alarantalara> to account for the ability of the enemy to counter attack, we include the defense values of the terrain we attack from 20121029 20:54:34< mattsc> yes 20121029 20:55:13< Alarantalara> for a given combination of units attacking a single target, we therefore want to arrange the best possible arrangement of these defense values for those units 20121029 20:56:11< Alarantalara> it looks like your friend is suggesting we calculate a value 20121029 20:56:16< Alarantalara> for each attack 20121029 20:56:21< Alarantalara> find the best one 20121029 20:56:33< Alarantalara> then score all the others from how good the best one is 20121029 20:56:39< skyfaller> yeah, but he is still struggling to understand the situation, so maybe we should not actually listen to him :) 20121029 20:57:06< skyfaller> he had to go to class so I can't educate him any further right now 20121029 20:58:03< skyfaller> actually he was suggesting we have a "perfect" value and find the distance of each attack from that perfect value... 20121029 20:58:14< skyfaller> if we knew what the best value was, we would be done, right? 20121029 20:58:35< skyfaller> the perfect value was a platonic ideal that none of the actual attacks are expected to match 20121029 20:58:51< mattsc> Just a general comment: one thing to keep in mind as that "approximately right" is generally good enough for our purposes. 20121029 20:59:31< Alarantalara> I'd think that staying with the harmonic or geometric mean is probably more than adequate then 20121029 20:59:40< mattsc> A lot of the things that we calculate are approximations anyway (because somehow people complain if they have to wait 10 minutes for a move) that do not apply in all situations. 20121029 20:59:45< Alarantalara> I just wish I knew which was more accurate 20121029 20:59:55< Alarantalara> though maybe I should be asking which is faster 20121029 21:00:33< mattsc> Yes (they will probably both do). No (I don't think the calculation time for this is a problem) 20121029 21:00:47< skyfaller> I guess we just don't understand the two means well enough to know logically which is appropriate 20121029 21:01:05< mattsc> The big time requirement is for simulating combat, that pretty much trumps everything else. 20121029 21:01:11< skyfaller> and my friend got distracted trying to understand the situation and never got around to explaining it to me :) 20121029 21:01:43< mattsc> I'll have a look tonight at what you wrote and see if I can come up with an answer to that question. 20121029 21:02:06< mattsc> I agree that I'd like to know it on principle grounds, whether it makes a difference to our AI or not. 20121029 21:02:33< Alarantalara> That and it may make a difference in more complicated cases 20121029 21:03:01< skyfaller> mattsc: I think http://mathforum.org/library/drmath/view/69480.html has the best explanation I've found so far, but it didn't help me enough 20121029 21:03:08< mattsc> Yeah, but the complicated cases are probably using incorrect input numbers anyway. 20121029 21:03:27< mattsc> skyfaller: ok, I'll have a look. I just don't have the time for that right now. 20121029 21:03:38< Alarantalara> I was thinking complicated in terms of 4 units and 4 different terrain types 20121029 21:03:50< mattsc> I see. 20121029 21:03:57< Alarantalara> There is presumably a best arrangement 20121029 21:04:56< mattsc> Let me just give you a few examples of the kind of approximations we are making (either for computation time reasons or because the capability does not exist in Wesnoth, at least not in an easy/quick way) 20121029 21:05:11< mattsc> skyfaller will tell me that those are really bad. :) 20121029 21:06:04< mattsc> Attack combination outcomes are evaluated under the assumption that the order of the attacks does not matter. (this is, combinations of several attackers on one enemy) 20121029 21:06:29< mattsc> Counter attack calculations assume that TOD is the same when the counter attack happens. 20121029 21:07:01< Alarantalara> wesnoth has a function to tell you what the time of day will be for the enemy when he attacks 20121029 21:07:21< skyfaller> really? that sounds exciting 20121029 21:07:26< Alarantalara> I don't know if it's exposed to Lua yet 20121029 21:07:26< mattsc> Yes, but no function to simulate combat for a certain (different) TOD 20121029 21:08:15< mattsc> I tried to get that out of the last GSOC project, but it was deemed to difficult and lesser priority compared to other things. 20121029 21:08:33< mattsc> Well, not exactly that, but something that would have given me the enemy attacks. 20121029 21:10:08< mattsc> Another example: the order in which the attacks are executed (and assumed to be executed) is based on some pretty simple criteria (the rating plus the outcome variance plus whether any of the attacks has 'slow'; pretty much what we discussed, Alarantalara) 20121029 21:11:26< mattsc> Anyways, those are just some of the more blatant examples. I'd love to do all of this correctly, but I haven't been able to find ways that can be done realistically with today's computing power. 20121029 21:12:37< mattsc> Even the C++ code makes some of these approximations, if you look into it. 20121029 21:17:23-!- irker573 [~irker@ai0867.net] has quit [Quit: transmission timeout] 20121029 21:22:30< Alarantalara> It looks trivial to change Wesnoth to let you simulate combat on an arbitrary turn. The time of day manager already has the code to do it and I'd just have to propagate a default parameter up to Lua 20121029 21:23:58< mattsc> Alarantalara: that would be cool! And another reason not to use BfW 1.10 any more... 20121029 21:24:01< Alarantalara> All that would be left is doing the work to find out what turn retaliation would take place on 20121029 21:25:03< mattsc> That's trivial though, if I see that correctly. 20121029 21:25:23< mattsc> If attack_side > current_side, use same turn, otherwise next turn 20121029 21:26:25< Alarantalara> I can't get to it today, but remind me about it next weekend 20121029 21:26:39< skyfaller> make a bug on our Github :) 20121029 21:26:42< skyfaller> well 20121029 21:26:45< skyfaller> I guess it's a Wesnoth bug 20121029 21:26:48< skyfaller> so nevermind 20121029 21:26:48< mattsc> Will do 20121029 21:27:00< mattsc> Also, it's a FR, not a bug :) 20121029 21:27:08< skyfaller> right. 20121029 21:28:20< mattsc> Alarantalara: there's another FR I have, but probably for Nephro/Crab, not you 20121029 21:28:40< skyfaller> Alarantalara: are you actively involved in Wesnoth development? 20121029 21:28:56< mattsc> Current ai.get_attacks returns all the attack combinations. For several purposes, it would be good to have another function that just returns the single attacks. 20121029 21:29:37< mattsc> Formula AI has both, so I think that should be easy enough. 20121029 21:29:59< Alarantalara> Yes and no. I do packaging for OS X, terrain graphics WML, Under the Burning Suns maintenance, and the occasional foray into C++ when I find something that bothers me 20121029 21:30:30< Alarantalara> The last time was to optimize store_locations so that the find_in key was actually useful 20121029 21:32:14< Alarantalara> So the answer is yes, but usually not in the C++ code 20121029 21:33:10< Alarantalara> Which reminds me that I need to get around to integrating and committing lurker's latest bridge update 20121029 21:36:11< Alarantalara> skyfaller: http://www.ohloh.net/p/wesnoth/contributors/13636521385855 is a history of what I've done and when 20121029 21:36:28< skyfaller> ha, nice 20121029 21:36:44< skyfaller> once upon at time I was part of a startup that was considering competing with Ohloh :P 20121029 21:38:43< skyfaller> how do you write 10,434 lines of XML in only 6m? 20121029 21:39:44< Alarantalara> That's 6 months, and it's entirely generated by Xcode in the project file 20121029 21:40:01< skyfaller> ah, I see 20121029 21:40:22< Alarantalara> Sadly, most of what I've done is WML, which ohloh doesn't count 20121029 21:40:30< skyfaller> lol :) 20121029 21:40:57< Alarantalara> Which is why there are 440 missing commits in that language section 20121029 21:41:42-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20121029 21:55:27-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20121029 22:04:30-!- vultraz [~chatzilla@124.109.10.167] has joined #wesnoth-umc-dev 20121029 22:06:47-!- vultraz [~chatzilla@124.109.10.167] has quit [Changing host] 20121029 22:06:47-!- vultraz [~chatzilla@wesnoth/developer/vultraz] has joined #wesnoth-umc-dev 20121029 22:46:38< AI0867> mattsc: distance map is in hexes? Is there anything equivalent to ctrl-v/ctrl-b? (that is, distance in turns, with and without taking enemy units into account) 20121029 22:48:21< mattsc> AI0867: for individual hexes: http://wiki.wesnoth.org/LuaWML:Pathfinder#wesnoth.find_path 20121029 22:48:43< AI0867> I'd like a complete map for a set of (or all enemy) units 20121029 22:48:50< AI0867> a "danger map" of some sort 20121029 22:49:10< AI0867> do you have anything like that already coded? 20121029 22:49:44< mattsc> I have all kinds of versions of that, yes, but I am not sure if exactly that. Let me check. 20121029 22:51:25< mattsc> AI0867: https://github.com/mattsc/Wesnoth-AI-Demos/blob/master/lua/ai_helper.lua 20121029 22:51:38< mattsc> Look at lines 265 ff 20121029 22:52:45< mattsc> You could change that to work with find_path rather than with distance_between 20121029 22:53:37< AI0867> xyoff? 20121029 22:53:58< AI0867> or do I have an outdated version again? 20121029 22:54:00 * AI0867 pulls 20121029 22:54:12< mattsc> ai_helper.distance_map 20121029 22:54:15< AI0867> ah, distance_map 20121029 22:54:24< AI0867> that's where I started =) 20121029 22:54:36< AI0867> but it seems to be in hexes 20121029 22:54:46< AI0867> ah 20121029 22:54:53 * AI0867 tries to read before responding 20121029 22:55:18< mattsc> Oh, maybe I misunderstood you. 20121029 22:55:57< AI0867> no, you understood me 20121029 22:56:05< mattsc> You want the number of units that can get to a certain hex in this turn? 20121029 22:56:09< AI0867> I missed the line after "look at 265" 20121029 22:56:24< AI0867> well, that'd be nice too, but I can compose that 20121029 22:56:28< mattsc> *during this turn 20121029 22:57:06< mattsc> The latter I essentially have in ai_helper.attack_map 20121029 22:57:15< mattsc> sorry, get_attack_map() 20121029 22:57:28< AI0867> the very informal algorithm this far is: "how many enemies do I see? Do I see more friendlies/enough friendlies and a decent chance of not getting killed?" 20121029 22:57:29< mattsc> Just that those are the hexes the units can attack, rather than reach. 20121029 22:57:53< AI0867> if so, attack, if not: 20121029 22:57:59< mattsc> "I" being a hex? 20121029 22:58:02< AI0867> a unit 20121029 22:58:46< AI0867> are there places to run where I can't be reached? Then pick one that is most unreachable by enemies I can see 20121029 22:59:03< AI0867> if not, include friendlies as barriers 20121029 22:59:21< AI0867> and try to find a location where as few enemies as possible can reach me 20121029 22:59:27< mattsc> ai_helper.get_attack_map gives you the latter (places that cannot be reached; this turn, at least) 20121029 23:01:05< mattsc> And you can pass { additional_turns = ... } to find_path to extend that to several turns 20121029 23:12:56-!- zookeeper [~lmsnie@wesnoth/developer/zookeeper] has quit [Ping timeout: 252 seconds] 20121029 23:15:20< mattsc> AI0867: I have to leave pretty soon and will be gone for ~2 hours. Any immediate follow-up questions? 20121029 23:18:08< AI0867> not really, thanks 20121029 23:27:32-!- shadowm_laptop [ignacio@wesnoth/developer/shadowmaster] has joined #wesnoth-umc-dev 20121029 23:31:14-!- mattsc [~mattsc@d154-20-32-241.bchsia.telus.net] has quit [Quit: bye] 20121029 23:50:34-!- skyfaller [~skyfaller@wikipedia/Skyfaller] has quit [Ping timeout: 260 seconds] 20121029 23:53:22-!- skyfaller [~skyfaller@ool-43551e75.dyn.optonline.net] has joined #wesnoth-umc-dev 20121029 23:53:22-!- skyfaller [~skyfaller@ool-43551e75.dyn.optonline.net] has quit [Changing host] 20121029 23:53:22-!- skyfaller [~skyfaller@wikipedia/Skyfaller] has joined #wesnoth-umc-dev --- Log closed Tue Oct 30 00:00:01 2012