--- Log opened Sat Nov 30 00:00:23 2013 20131130 00:49:12-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20131130 00:59:39-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20131130 01:36:52-!- irker642 [~irker@ai0867.net] has quit [Quit: transmission timeout] 20131130 01:38:09-!- irker888 [~irker@ai0867.net] has joined #wesnoth-umc-dev 20131130 01:38:09< irker888> shikadilord: Ignacio R. Morelle After_the_Storm:master d1c3b6f11d25 / themes/ats-cutscene.cfg: Fix AtS_Cutscene image paths for 1.11.7+dev (not 1.11.8) http://git.io/LM5c5A 20131130 01:38:10< irker888> shikadilord: Ignacio R. Morelle After_the_Storm:master 04f040bb342e / / (3 files in 3 dirs): E1S6.2: new, larger map http://git.io/BNIEsQ 20131130 01:47:25-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20131130 01:50:38-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20131130 01:51:49< irker888> shikadilord: Ignacio R. Morelle After_the_Storm:master fbb99bdbab62 / .gitignore: Add .preprocessor.out (from test Makefile target) to .gitignore http://git.io/wWn6RA 20131130 01:51:52< irker888> shikadilord: Ignacio R. Morelle After_the_Storm:master b4b65362b107 / / (7 files in 3 dirs): E1: do not include Kyara and Horo's death events in E1S1 through E1S5 http://git.io/oDy8Nw 20131130 02:09:18-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20131130 02:10:45-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20131130 02:39:05-!- vultraz [~chatzilla@124.109.10.167] has quit [Read error: Connection reset by peer] 20131130 02:40:13-!- vultraz [~chatzilla@wesnoth/developer/vultraz] has joined #wesnoth-umc-dev 20131130 03:44:41-!- shadowm_desktop [ignacio@wesnoth/developer/shadowmaster] has quit [Ping timeout: 246 seconds] 20131130 03:46:22-!- shadowm_desktop [ignacio@wesnoth/developer/shadowmaster] has joined #wesnoth-umc-dev 20131130 03:52:41-!- happygrue [~happygrue@wesnoth/developer/wintermute] has quit [Ping timeout: 245 seconds] 20131130 03:56:27< vultraz> mattsc: nice direction code BTW 20131130 03:58:08< mattsc> vultraz: thanks :) 20131130 03:58:43< vultraz> very elegant 20131130 04:05:45< shadowm> What direction code, out of curiosity? 20131130 04:06:01< vultraz> shadowm: http://pastebin.com/FdNkxM6D 20131130 04:06:39< shadowm> That's all japanese to me. 20131130 04:06:47< vultraz> Exactly 20131130 04:07:01< shadowm> Is this about determining the direction of a given hex B from an origin A? 20131130 04:07:25< vultraz> Yes 20131130 04:07:31< shadowm> Because there is code for that in C++ that I would like to see exposed in Lua. 20131130 04:07:43< vultraz> IIRC you did something like that in AtS 20131130 04:08:20< shadowm> I attempted to. I ultimately settled for a dumbed-down version that only does two directions. 20131130 04:08:35< vultraz> Well this might serve your need, then 20131130 04:08:38< shadowm> My first attempt was a translation of the C++ code that I apparently botched somehow. 20131130 04:08:55< shadowm> The C++ uses maths, so that'd be why it didn't work. 20131130 04:11:41< vultraz> This also uses maths 20131130 04:12:16< shadowm> Black magic. 20131130 04:12:20< mattsc> shadowm: I'd be happy to explain. 20131130 04:14:45< mattsc> There are really only two parts to it. Lines 12/13 change the coordinates to that of a rectangular grid. It only needs to be done for y, which is offset by half a hex with respect to the neighboring hex (the x coordinate is regular) 20131130 04:15:54< shadowm> It sounds easy when you put it like that. :p 20131130 04:16:20< mattsc> The other bit is l.15/16. atan2() is the inverse tangent function. It gives you the angle to a point if you know the x and y offset. 20131130 04:17:11< mattsc> The angle goes from -pi to pi, but I want the entire range to be covering 0 to 8 (because I want to divide it into 8 parts) 20131130 04:17:36< mattsc> So divide by pi and multiply by 4. 20131130 04:19:00< mattsc> You add +4 so that it starts at 0, but you actually want to add another 0.5, because you want the division to be not on the cardinal direction, but in between them 20131130 04:19:30< mattsc> The %8 and +1 is the simply to get the value to go from 1 to 8 for accessing the Lua table. 20131130 04:19:42< mattsc> :) 20131130 04:20:06< vultraz> Still greek to me :P 20131130 04:20:14< shadowm> Sounds cool and all but when do I get to eat the pie? 20131130 04:20:26< mattsc> now 20131130 04:20:39< mattsc> which pie would you like to eat? 20131130 04:20:40< vultraz> I like the way you can just have dirs[angle] and you have the direction 20131130 04:21:34< mattsc> That's why you want the final numbers to go from 1 to 8. 20131130 04:22:47< vultraz> If I understand you right, you're splitting the coords into a 3x3 grid with the unit at the center (8 squares), the using maths to pick one 20131130 04:23:40< mattsc> not quite 20131130 04:24:09< mattsc> I am calculating the angle from the unit to the hex of interest. 20131130 04:24:42< mattsc> 0 is east, 90 degrees is south, 180/-180 is west, 270/-90 is north. 20131130 04:24:49< shadowm> Yeah, no, converting the angle into a convenient array subscript doesn't really qualify as black magic to me. 20131130 04:25:19< mattsc> shadowm: good 20131130 04:25:33< vultraz> shadowm: so are you going to use it then 20131130 04:26:59< mattsc> shadowm: if you want, I can write a helper function that does this for an arbitrary number of sub-divisions and returns a number corresponding to which slice the direction falls into. 20131130 04:27:05< shadowm> Now that I know the magician's trick, it certainly doesn't feel like black magic anymore. 20131130 04:27:17< mattsc> Cool :) 20131130 04:27:43< shadowm> mattsc: What's a sub-division, slice, whaa? 20131130 04:28:07< shadowm> I thought Wesnoth only implemented hex grids. You can't have more than 6 directions with those. 20131130 04:28:24< mattsc> Well, I subdivided into 8 slices. I could easily make the '8' a parameter to a function. 20131130 04:28:50< shadowm> Oh right, I hadn't noticed you have more directions. 20131130 04:29:16< mattsc> bumbadadabum had it set up using eight directions on the sky 20131130 04:29:17< shadowm> East and west aren't intrinsic on a hex grid. 20131130 04:29:33< mattsc> You could make it 6 to follow the hex geometry. 20131130 04:29:53< shadowm> e.g. let A = 1,1, B = 2,1, B is visually SE from A. 20131130 04:30:01< mattsc> Or 4, or even just 2. Or 6.357, if you wanted. :) 20131130 04:30:13< vultraz> mattsc most clever 20131130 04:30:32< mattsc> shadowm: yes, that's how I interpreted how it was supposed to work. 20131130 04:31:20< vultraz> I thought this would require multiple elseif statements 20131130 04:31:46< shadowm> vultraz: Mathematics can serve as an abstraction of complicated logic. 20131130 04:32:19< vultraz> Five minutes ago you said this was black magic, now it's simple math? 20131130 04:33:48< shadowm> Well, it wouldn't have occurred to me on my own to do the coordinates conversion between a hex grid and an euclidean plane. 20131130 04:35:06< shadowm> mattsc: Anyway, yeah, a more general version would help me greatly. :p 20131130 04:35:15< shadowm> In the future. 20131130 04:36:25< mattsc> shadowm: okay, no problem. I'll put something together sometime on the weekend. Right now, my non-Wesnoth life is sucking me out of my fantasy world ... 20131130 04:36:37< shadowm> Right now AtS uses a very dumb algorithm for the [store_direction] tag that can only really tell whether two points are east or west from each other; I gave up on the more complicated version because of time constraints, and the fact that at the time there weren't many units in mainline including non-south facing standing animations. 20131130 04:38:06< shadowm> There still aren't many such, and I certainly don't have any original units that can face northwards, hence it's such a low-priority issue at the moment, I entirely forgot I had talked with anonymissimus once about exposing the underlying game logic in Lua. 20131130 04:39:49< mattsc> shadowm: Okay, I'll put something together then and run it by you.. The hard part is not the code itself, but figuring out what kind of parameters would be most useful to pass to the function. 20131130 04:40:03< mattsc> ... and I'll need some more help with these "virtual function" warnings tomorrow, because that's black magic to me :P 20131130 04:40:15< shadowm> The underlying game logic is actually a series of if and elses and mono-axial distance calculations, but I assume that's primarily because floating point operations tend to be more expensive and imprecise. 20131130 04:41:17< shadowm> It's "hot" code running for pretty much every single hex all the time, after all. 20131130 04:41:50< mattsc> I see. Right. I never even thought of looking into the game code. I just thought that this was a fun little problem to solve for my own amusement. 20131130 04:43:20< mattsc> Anyways, I'll be afk for a while and likely not be back for more than a few minutes at a time tonight any more. I'll check out the logs though if there's anything else. 20131130 05:37:19-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20131130 06:02:20< mattsc> shadowm: currently that direction code does this: http://imagebin.org/279555 20131130 06:02:47< mattsc> but switching it over to do this http://imagebin.org/279554 was trivial 20131130 06:04:29< mattsc> shadowm: one more question before I head out: what would you like it to return? Numbers? Strings that can go into facing= directly? 20131130 06:12:23< shadowm> The latter is what I need, but it's not like the former can't be easily translated as necessary. 20131130 06:16:52< mattsc> Right - so do you want to do that translation yourself or should I still put together a function. Sorry, confused, 20131130 06:29:11< shadowm> Either way works for me. 20131130 06:30:02< mattsc> okay - I'l probably add a function to ai_helper then sometime in the next few days 20131130 06:34:47-!- vultraz [~chatzilla@wesnoth/developer/vultraz] has quit [Ping timeout: 246 seconds] 20131130 06:44:12-!- mattsc [~mattsc@154.20.32.246] has quit [Quit: Ciao] 20131130 06:55:49-!- vultraz [~chatzilla@wesnoth/developer/vultraz] has joined #wesnoth-umc-dev 20131130 07:22:55-!- irker888 [~irker@ai0867.net] has quit [Quit: transmission timeout] 20131130 07:36:27-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-umc-dev 20131130 07:51:38-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20131130 07:54:25-!- zookeeper [~lmsnie@wesnoth/developer/zookeeper] has joined #wesnoth-umc-dev 20131130 08:17:04-!- shadowm_desktop [ignacio@wesnoth/developer/shadowmaster] has quit [Remote host closed the connection] 20131130 08:20:30-!- shadowm_desktop [ignacio@wesnoth/developer/shadowmaster] has joined #wesnoth-umc-dev 20131130 08:31:35-!- vultraz [~chatzilla@wesnoth/developer/vultraz] has quit [Ping timeout: 272 seconds] 20131130 08:51:09-!- vultraz [~chatzilla@wesnoth/developer/vultraz] has joined #wesnoth-umc-dev 20131130 08:51:59-!- shadowm_desktop [ignacio@wesnoth/developer/shadowmaster] has quit [Ping timeout: 246 seconds] 20131130 10:39:46-!- vultraz [~chatzilla@wesnoth/developer/vultraz] has quit [Ping timeout: 245 seconds] 20131130 12:11:42-!- vultraz [~chatzilla@wesnoth/developer/vultraz] has joined #wesnoth-umc-dev 20131130 12:15:40-!- shadowm_desktop [ignacio@wesnoth/developer/shadowmaster] has joined #wesnoth-umc-dev 20131130 13:52:05-!- happygrue [~happygrue@wesnoth/developer/wintermute] has joined #wesnoth-umc-dev 20131130 14:38:25-!- mattsc [~mattsc@154.20.32.246] has joined #wesnoth-umc-dev 20131130 15:52:03-!- trewe [~trewe@87.196.31.163] has joined #wesnoth-umc-dev 20131130 19:29:33-!- irker390 [~irker@109.237.218.218] has joined #wesnoth-umc-dev 20131130 19:29:34< irker390> mattsc: mattsc AI-demos:master 9ad637823d7c / lua/ai_helper.lua: ai_helper.put_labels: display content of strings rather than 'nan' http://git.io/tsuzNg 20131130 19:29:36< irker390> mattsc: mattsc AI-demos:master 0c1c90d0067f / lua/ai_helper.lua: ai_helper: add functions to get direction indices and strings http://git.io/zLhGvw 20131130 19:29:58< irker390> shikadilord: Ignacio R. Morelle After_the_Storm:master 192b7e0dc1b9 / episode1/scenarios/03_Civil_War.cfg: E1S3: fix unquoted Lua table value http://git.io/nK1Izg 20131130 23:47:13-!- trewe [~trewe@87.196.31.163] has quit [Quit: quit] --- Log closed Sun Dec 01 00:00:26 2013