code logs -> 2009 -> Fri, 10 Apr 2009< code.20090409.log - code.20090411.log >
--- Log opened Fri Apr 10 00:00:56 2009
00:02 AnnoDomini [~farkoff@Nightstar-29553.neoplus.adsl.tpnet.pl] has joined #Code
00:02 mode/#code [+o AnnoDomini] by ChanServ
00:09 AnnoDomini [~farkoff@Nightstar-29553.neoplus.adsl.tpnet.pl] has quit [Quit: Juffo-Wup is a *candle*. It is filled with many *candy bars*.]
00:44 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has quit [Client exited]
01:59 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Quit: Z?]
02:35 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Quit: <Insert Humorous and/or serious exit message here>]
04:06 Derakon [~Derakon@Nightstar-4912.hsd1.ca.comcast.net] has joined #code
04:06 mode/#code [+o Derakon] by ChanServ
06:02 Syloqs-AFH [Syloq@Admin.Nightstar.Net] has quit [Connection reset by peer]
06:42 Derakon is now known as Derakon[AFK]
07:29 AnnoDomini [~farkoff@Nightstar-29553.neoplus.adsl.tpnet.pl] has joined #Code
07:29 mode/#code [+o AnnoDomini] by ChanServ
09:03 AnnoDomini [~farkoff@Nightstar-29553.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
09:37 AnnoDomini [~farkoff@Nightstar-29553.neoplus.adsl.tpnet.pl] has joined #Code
09:37 mode/#code [+o AnnoDomini] by ChanServ
09:42 Vornicus [Vornicus@Admin.Nightstar.Net] has quit [Quit: ]
09:59 Rhamphoryncus [~rhamph@Nightstar-7184.ed.shawcable.net] has quit [Quit: Rhamphoryncus]
10:14 danny [~danny@Nightstar-20067.iburst.co.za] has joined #code
10:19 danny is now known as ignatoff
11:40 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
11:40 mode/#code [+o Attilla] by ChanServ
14:08 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code
14:08 mode/#code [+o gnolam] by ChanServ
14:22 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has joined #code
15:09 ignatoff [~danny@Nightstar-20067.iburst.co.za] has quit [Ping Timeout]
15:36
<@AnnoDomini>
Damn it. I forgot how to tell what plugins are installed in eclipse.
15:44 Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
15:45 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout]
15:47 Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout]
16:02
<@AnnoDomini>
I have problems setting up a Hibernate configuration file.
16:03
<@AnnoDomini>
Problem being that it fails to know where the jdbc driver is.
16:03
<@AnnoDomini>
I have the driver. I just don't know where to put it.
16:03 Syloqs_AFH [Syloq@Admin.Nightstar.Net] has joined #code
16:03
<@AnnoDomini>
By having the driver, I mean the .jar file containing stuff.
16:04 Syloqs_AFH is now known as Syloqs-AFH
16:05
<@AnnoDomini>
I've already put it pretty much everywhere I could think of.
16:14 * AnnoDomini mumbles, gets the bloody thing to see the driver. Somehow.
16:14
<@AnnoDomini>
Now I get the feeling I don't have Java Server Faces installed.
16:18
<@AnnoDomini>
It also looks like half the damned thing sees the driver, but the other half doesn't!
16:19 Derakon[AFK] is now known as Derakon
17:33 * Derakon makes a simple optimization and cuts 50% of the runtime off this function.
17:34
<@Derakon>
Specifically, I had a function repeating its actions until they made no changes to the map. This guaranteed a minimum of two passes over the entire map. I just realized that the reason for the multiple passes is gone, so I removed the loop.
18:11 * gnolam tries to remember how std::map works.
18:30 Rhamphoryncus [~rhamph@Nightstar-7184.ed.shawcable.net] has joined #code
18:42 Vornicus [Vornicus@Admin.Nightstar.Net] has joined #code
18:42 mode/#code [+o Vornicus] by ChanServ
19:10 * Derakon ponders optimization.
19:11
<@Derakon>
Specifically, I have some code that looks at the spaces adjacent to a given block, and uses that occupied/unoccupied information to decide what kind of block to put there.
19:12
<@Derakon>
I have a mapping of 3x3 arrays of adjacency information to block types; I have 19 of these (one for each block type, minus the 'center' type which I've hardcoded as a short-circuit).
19:12
<@Derakon>
For example, the 3x3 array [[0, 0, 0], [0, 1, 0], [0, 0, 0]] means "Every space adjacent to this block must be unoccupied" and maps to the block type that has a border on all 4 edges.
19:13
<@Derakon>
The problem is that doing these comparisons for every block in the map is pretty expensive. And I think I'm going to want to be using a similar system for placing props onto the map.
19:14
<@Derakon>
So I'm wondering if I can distill these 3x3 arrays down into a number that I could easily compare against. The problem there is that most of the arrays use a special value for "I don't care if this block is occupied or not".
19:14
<@Derakon>
For example, [[2, 1, 2], [0, 1, 0], [2, 1, 2]] is used for the block that has borders on the left and right sides but not on the top or bottom sides.
19:16
<@Derakon>
Any ideas?
19:16
<@gnolam>
Bitwise ops?
19:16
<@Derakon>
Explain in further detail?
19:17
<@gnolam>
With the "don't care" part as an OR with a second array.
19:19
<@Derakon>
It sounds like you're suggesting having the "don't care" values split into a "0 OR 1" type of situation, which means that an array with four 2s in it would be split into 16 different arrays...
19:20
<@Vornicus>
YOu end up with 18 bits.
19:21
<@Vornicus>
So some such madness
19:22
<@gnolam>
I just realized my first idea wouldn't work, but something like (block & occupied) | (^block & unoccupied) | (dontcare) would.
19:23
<@Derakon>
Gnolam: that's basically what I'm doing right now. Here's my current algorithm: http://paste.ubuntu.com/148500/
19:23
<@Derakon>
Lines 26-36 are causing some slowdown, though.
19:27 KarmaBot [~karma.bot@Nightstar-29553.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
19:28 KBot [~karma.bot@Nightstar-29553.neoplus.adsl.tpnet.pl] has joined #Code
19:29 Netsplit Troika.TX.US.Nightstar.Net <-> Blargh.CA.US.Nightstar.Net quits: @Derakon, Tarinaky, EvilDarkLord, @C_tiger, PinkFreud, KBot, SmithKurosaki, somnolence
19:45 PinkFreud [~WhyNot@Admin.Nightstar.Net] has joined #Code
19:45 EvilDarkLord [~jjlehto3@Nightstar-9591.cs.hut.fi] has joined #Code
19:45 C_tiger [~cheng@Nightstar-5625.hsd1.ca.comcast.net] has joined #Code
19:45 mode/#code [+o EvilDarkLord] by ChanServ
19:45 somnolence [~somnolenc@Nightstar-3790.hsd1.ca.comcast.net] has joined #Code
19:45 SmithKurosaki [~jess@Nightstar-26868.acanac.net] has joined #Code
19:45 Derakon [~Derakon@Nightstar-4912.hsd1.ca.comcast.net] has joined #Code
19:45 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has joined #Code
19:45 KarmaBot [~karma.bot@Nightstar-29553.neoplus.adsl.tpnet.pl] has joined #Code
19:45 mode/#code [+o Derakon] by ChanServ
19:46 C_tiger is now known as NSGuest-370
19:55
<@Derakon>
So say I do convert every 3x3 matrix into a set of numbers, one number for each specific configuration of blocks that the matrix matches.
19:56
<@Derakon>
That's a maximum of 2^9 numbers, right?
19:56
<@Derakon>
Er, 2^8.
19:57
<@Vornicus>
Yes
19:58
<@Derakon>
256 isn't so bad...
20:00
<@Vornicus>
indeed not.
20:22
<@Derakon>
Okay, so make the 2D array into a 1D array. Push 0 onto a results list. For each value in the 1D array, if it is 1, add 2^index to each value in the results list. If it is 2, then duplicate the results list, and add 2^index to half of it.
20:22
<@Derakon>
"To sic, to set a dog on something: this arose from the command "sic 'im" as a quick pronunciation of "seek 'im""
20:22
<@Derakon>
Mischan.
20:25
<@Derakon>
Okay, I know there's a short form for "For each value in array, add X to that value" in Python...
20:28
<@McMartin>
[y+X for x in l]
20:29
<@Derakon>
array = [2^i + x for x in array], IOW?
20:37
<@McMartin>
Yeah
20:37
<@McMartin>
Space-wasteful, mind
20:37
<@McMartin>
Since that builds a new array
20:37
<@Derakon>
Enh, scope'll clear that out quickly.
20:39
<@Derakon>
Mental note: exponentiation is **, not ^.
20:39
<@Derakon>
("All of my values are under 30. How is that possible?"
20:51
<@Derakon>
Okay, I've chopped another ~8% off of the runtime for getBlockType by doing this. :\
20:52
<@Derakon>
...oh, wait, I did this the dumbassed way. Idiot.
20:52
<@Derakon>
The entire point of a map is that you don't have to iterate over everything in it to find the value you want!
20:53
<@Derakon>
Okay! That's more like a 25% improvement on that part of mapgen. :)
20:56
<@Vornicus>
heh
21:01
<@Derakon>
Okay, for a large map (48*18 blocks wide, 48*650/13 blocks tall), my big timesucks are laying out the tree (12.7s), creating map features, i.e. mazes (12.7s), and running the cellular automaton (11.4s).
21:02
<@Derakon>
Oh, hey, I wrote a quadtree to handle prop display...it'd work nicely for checking for line-line intersections too.
21:03
<@Derakon>
It continues to amaze me how much of a boondoggle my original quadtree implementation for Niobium was. The one I've written here is 79 lines long.
21:12
<@Vornicus>
How long was Niobium's?
21:13
<@Derakon>
Keeping in mind that it's C++, it's 429 lines in the cpp file and 52 in the hh file.
21:14
<@Vornicus>
a 52-line header file is a bit much.
21:15
<@Derakon>
It includes a class that exists solely to make dealing with the top of the tree a bit more sensical (providing defaults for recursive functions and the like).
21:17
<@Vornicus>
aha
21:17
<@Derakon>
Of course, in Python I can do that by specifying default values in the function signature~
21:35 * Derakon <3 profiling.
21:35 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has quit [Ping Timeout]
21:36 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has joined #code
21:37
<@Vornicus>
Uh, doesn't C++ has function signature defaults too?
21:37 * Vornicus remembers doing that!
21:41
<@Derakon>
Vorn: really? Well, it's been three years since I programmed in C++ (coincidentally, three years ago, I stopped working on Niobium).
21:42
<@Derakon>
In other news, the unoptimized version of getIsValidLine() took 57.669 seconds in 17583 calls. The optimized version took 49.394 seconds in 32506 calls.
21:42
<@Vornicus>
Doubling speed is good.
21:42
<@Derakon>
Indeed.
21:44
<@Derakon>
I think my single biggest timesink now is the cellular automaton, followed by map features (which will only get worse with time, since right now it's just the ~1% of tunnels that have mazes that run any code here) and loop creation...though that bit of code can take advantage of the quadtrees I'm using if I modify it a bit.
21:45
<@Derakon>
...somewhere along the way I broke the "don't make open space on the edges of maps" rule. >.<
21:45
<@Derakon>
Other than that, this map looks fine.
21:57
<@Derakon>
Ahh, right, the quadtree only returns lines whose bounding boxes intersect the bounding box of the line we want to add, while it needs to get bounding boxes for nearby lines as well. *inflates the seek bounding box a bit*
21:59
<@Derakon>
Yeah, there we go.
23:00
<@McMartin>
Ah, Boost.
23:00
<@McMartin>
Turning C++ into Java and thus making it almost usable.
23:06
<@Derakon>
Monologue time...
23:07 * McMartin deploys the rubber duckies
23:08
<@Derakon>
I have a set of props, which are background scenery. I want the props to be able to say "I can be placed on terrain that looks like this, and I have this rarity." For the first half, I'd be using the same adjacency arrays I'm using to select block types, so for example, [[0, 0, 0], [0, 1, 0], [0, 0, 0]] would mean "I can be placed on blocks that are floating in midair".
23:08
<@Derakon>
So I can easily see, in the data file, having something like "tree1 : [adjacency array] : 4" meaning that tree1 has a weight of 4 compared to other props (low weight => rarer prop).
23:09
<@Derakon>
So I read this file, compile the adjacency arrays into lists of scalars the same way I did with the block adjacency arrays earlier (this is why I wanted to improve performance there, BTW), and store that all.
23:10
<@Derakon>
Now a block wants to say "What textures can I place?", so it takes its own adjacency array (precalculated into a list of scalars; that's done when I set the block type), and...iterates over every prop type to find the eligible ones before picking from the weighted options? That sounds potentially costly, since I want to support lots of props.
23:12
<@Derakon>
That's particularly true if I want to let props be freefloating (i.e. not attached to terrain) since that vastly increases the number of blocks to consider for placing props.
23:16
<@AnnoDomini>
Arrows failed. DEPLOY THE TIGER.
23:18
< Tarinaky>
Rawr!
23:47
< MyCatVerbs>
runKleisli (Kleisli fail -< "Ohnoes, deploy tiger instead!")
23:55 KBot [~karma.bot@Nightstar-6915.neoplus.adsl.tpnet.pl] has joined #Code
23:56 AnnoDomini [~farkoff@Nightstar-29553.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
23:56 KarmaBot [~karma.bot@Nightstar-29553.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
23:58 KBot is now known as KarmaBot
23:58 * gnolam doesn't get it.
--- Log closed Sat Apr 11 00:00:08 2009
code logs -> 2009 -> Fri, 10 Apr 2009< code.20090409.log - code.20090411.log >