code logs -> 2009 -> Sun, 29 Mar 2009< code.20090328.log - code.20090330.log >
--- Log opened Sun Mar 29 00:00:26 2009
00:00
<@AnnoDomini>
I think I might need to make an algorithm for checking 'is are all these rooms connected?'
00:02
<@Derakon>
That's pretty straightforward.
00:02
<@AnnoDomini>
-is
00:02
<@Derakon>
You pick a starting cell that is empty space, push it onto a stack, then do a recursive "check neighbors for open space; if they're open and unseen, add them to the stack".
00:03
<@Derakon>
Once your stack empties, you check for open spaces that are not seen.
00:04
<@AnnoDomini>
That's a bit more complex than I can grasp at this hour.
00:04
<@Derakon>
A moment and I'll have a pastie with pseudocode.
00:05
<@AnnoDomini>
I think I might just want to ensure that the algorithm itself guarantees connectivity.
00:05
<@Derakon>
That's also good.
00:07
<@Derakon>
http://paste.ubuntu.com/139878/
00:09
<@AnnoDomini>
Thanks, but that won't help me at 1 AM. ;)
00:09
<@AnnoDomini>
I'll go to sleep.
00:09
<@Derakon>
Well, it'll still be there at 9 AM.
00:09 AnnoDomini [~farkoff@Nightstar-28230.neoplus.adsl.tpnet.pl] has quit [Quit: "... Why are you smiling? I just beat you!" "Did you? Look at yourself. Look at what you've /become/."]
00:12 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer]
00:12 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
00:12 mode/#code [+o Attilla] by ChanServ
00:14 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer]
00:14 Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
00:17 Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout]
00:21 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
00:21 mode/#code [+o Attilla] by ChanServ
00:25 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout]
00:25 Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
00:27 Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer]
00:27 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
00:27 mode/#code [+o Attilla] by ChanServ
00:32 Rhamphoryncus [~rhamph@Nightstar-7184.ed.shawcable.net] has joined #code
02:10 somnolence [~somnolenc@203.160.1.ns-3171] has quit [Ping Timeout]
02:11 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer]
02:11 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
02:11 mode/#code [+o Attilla] by ChanServ
02:12 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Quit: <Insert Humorous and/or serious exit message here>]
02:18 somnolence [~somnolenc@203.160.1.ns-3171] has joined #code
02:25 somnolence [~somnolenc@203.160.1.ns-3171] has quit [Client exited]
02:25 somnolence [~somnolenc@203.160.1.ns-3171] has joined #code
02:49 Vornicus [Vornicus@Admin.Nightstar.Net] has quit [Ping Timeout]
02:54 Vornicus [Vornicus@Admin.Nightstar.Net] has joined #code
02:54 mode/#code [+o Vornicus] by ChanServ
03:13
<@Derakon>
Heh. In exchange for being able to use grep and wc to get information on the Super Metroid map, I have to create a one-million-line-long file.
03:14
<@Vornicus>
Ooops
03:14
<@Derakon>
969344 out of 1483285 pixels are background.
03:15
<@Derakon>
Ahh, it's only 68MB.
03:16
<@Derakon>
So the map is 65% empty.
03:18
<@Derakon>
Oh, hello, mapgen's running on the same thread Pandora is.
03:21 * Derakon runs a similar analysis on a moderately-sized map (626x429 blocks, took 78 seconds to make) and comes up with 32% empty.
03:30
<@Derakon>
Okay, Super Metroid map is 60x50 screens, each screen is 16x16 blocks (or thereabouts), so that's a 960x800 map, more or less.
03:30
<@Derakon>
Except it's two-thirds empty.
03:31
<@Derakon>
So that's functionally 320x267.
03:31
<@Derakon>
My comparison map is functionally 417x286.
03:32
<@Derakon>
Awesome.
03:32
<@Derakon>
And by the way, the reason I'm doing all this analysis is to get some idea of what kind of scale I should be going for on map features, feature density, and overall content.
03:40 Syloqs-AFH [Syloq@Admin.Nightstar.Net] has quit [Ping Timeout]
04:12 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Quit: Ze Germans!]
04:59 Syloq [Syloq@Admin.Nightstar.Net] has joined #code
05:00 Syloq is now known as Syloqs-AFH
06:02 Syloqs-AFH [Syloq@Admin.Nightstar.Net] has quit [Connection reset by peer]
07:14 TarinakyKai [~Tarinaky@Nightstar-16638.plus.com] has quit [Ping Timeout]
07:17 Derakon is now known as Derakon[AFK]
08:22 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has joined #code
09:04 Vornicus [Vornicus@Admin.Nightstar.Net] has quit [Quit: ]
09:40 AnnoDomini [~farkoff@Nightstar-28230.neoplus.adsl.tpnet.pl] has joined #Code
09:40 mode/#code [+o AnnoDomini] by ChanServ
10:10 Rhamphoryncus [~rhamph@Nightstar-7184.ed.shawcable.net] has quit [Quit: Rhamphoryncus]
11:17 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
11:18 mode/#code [+o Attilla] by ChanServ
11:32 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has quit [Ping Timeout]
11:36 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has joined #code
12:00 AnnoDomini [~farkoff@Nightstar-28230.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
12:04 AnnoDomini [~farkoff@Nightstar-28230.neoplus.adsl.tpnet.pl] has joined #Code
12:04 mode/#code [+o AnnoDomini] by ChanServ
14:01 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code
14:01 mode/#code [+o gnolam] by ChanServ
16:05 Syloq [Syloq@Admin.Nightstar.Net] has joined #code
16:06 Syloq is now known as Syloqs-AFH
16:15 KBot [AnnoDomini@Nightstar-28151.neoplus.adsl.tpnet.pl] has joined #Code
16:16 AnnoDomini [~farkoff@Nightstar-28230.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
16:16 KarmaBot [AnnoDomini@Nightstar-28230.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
16:18 KBot is now known as KarmaBot
16:23 AnnoDomini [~farkoff@Nightstar-28151.neoplus.adsl.tpnet.pl] has joined #Code
16:23 mode/#code [+o AnnoDomini] by ChanServ
16:56 Derakon[AFK] is now known as Derakon
17:38 * Derakon ponders how to turn a tunnel into a staircase.
17:44
<@Attilla>
Put spiraling bricks sticking out of the edges that go down the tunnel, then turn it on its end?
17:44 * Derakon facepalms.
17:46 * gnolam ponders surface contamination.
17:47 * Attilla ponders the electric field of a point dipole
18:01
<@gnolam>
Ah, screw it. We can just go with multiple point sources.
18:08
<@Attilla>
But, but what about my realism? :O
18:21 Rhamphoryncus [~rhamph@Nightstar-7184.ed.shawcable.net] has joined #code
18:29
<@gnolam>
What about it... punk?
18:36
<@Attilla>
I want you to apply statistical mechanics to plot regions of the highest probability of being irradiated too!
18:37
<@gnolam>
I... don't think so.
18:39
<@gnolam>
The radiological accuracy that's actually /required/ here is basically "Radiation bad. Me not enter room."
18:56 Vornicus [Vornicus@Admin.Nightstar.Net] has joined #code
18:56 mode/#code [+o Vornicus] by ChanServ
19:24
<@Derakon>
The slope of a line whose angle with the X axis is theta is 1 / tan(theta), right?
19:27
<@Vornicus>
just tan.
19:27
<@Derakon>
Really?
19:27
<@Vornicus>
yep.
19:28
<@Vornicus>
tan(0) = 0
19:28
<@Derakon>
Oh.
19:28
<@Derakon>
tan(theta) = y / x....oh, yeah. That's rise over run right there.
19:28
<@Derakon>
Thanks, that would've been annoying to debug.
20:06 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout]
20:08 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
20:08 mode/#code [+o Attilla] by ChanServ
20:13 * Derakon adds a new tunnel type, staircases. http://derakon.dyndns.org/~chriswei/games/jbrl/mapgen25a.png
20:41
<@Vornicus>
It occurs to me that you might actually be better off making individual rooms with airlocks between them; it would simplify many things.
21:01 TarinakyKai [~Tarinaky@Nightstar-16638.plus.com] has joined #code
21:02 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has quit [Ping Timeout]
21:03
<@Derakon>
It would, yeah...but it mucks with the flow of the game.
21:04 Vornicus is now known as Finerty
21:25 * AnnoDomini scratches head. How was passing a pointer to a two-dimensional array to a function work in C++ again?
21:25
<@jerith>
Badly?
21:26
< EvilDarkLord>
You pass the pointer, then you use it like you'd use an array?
21:26
< EvilDarkLord>
(Although given this is C++ I can't say for sure, I'm just guessing based on what I know of C)
21:26
<@AnnoDomini>
I think there was some silly thing here.
21:27
< EvilDarkLord>
What kind of error are you getting, if any?
21:28
<@AnnoDomini>
None yet.
21:28
<@AnnoDomini>
I'm asking how to do this.
21:30
< EvilDarkLord>
Try the simple way, then cry tears of blood and molten lead when it fails.
21:30
< EvilDarkLord>
Er, if it fails.
21:30
<@jerith>
No, it's C++. You were right the first time.
21:31
< EvilDarkLord>
Is there a method in its madness?
21:31 mode/#code [+o EvilDarkLord] by ChanServ
21:31
<@EvilDarkLord>
(No pun intended)
21:31
<@jerith>
Only if it's a function on an object...
21:32 * AnnoDomini loses track of the conversation.
21:32
<@EvilDarkLord>
AnnoDomini: A method is an object's function.
21:33
<@EvilDarkLord>
Hence, horrid puns appear. Roll initiative.
21:33
<@AnnoDomini>
!roll 1d20-3
21:33
< KarmaBot>
[AnnoDomini] rolled 1d20-3: (19)-3 = 16.
21:33 * jerith rolls nine hundred and seventy twelve.
21:34
<@EvilDarkLord>
!9*256+7*16+12
21:34
< KarmaBot>
[EvilDarkLord] rolled 9*256+7*16+12: 9*256+7*16+12 = 2428.
21:42
<@AnnoDomini>
http://pastie.org/430740 <- Looks horrid, innit?
21:43
<@Derakon>
I don't understand why your iteration bounds for the room marker aren't from i to i+w and j to j+h instead of from 0 to X and 0 to Y.
21:44
<@Derakon>
for (k = i; k < i + w; ++k) { for (l = j; l < j + h; ++l) { if (k < X and l < Y) { array[k][l] = 1}}}
21:44
<@Derakon>
Alternatively, you can work that if check (which ensures you don't go off the edge of the map) into the loop conditions.
21:45
<@Derakon>
for (k = i; k < i + w && k < X; ++k) { etc}
21:45
<@Derakon>
(Or even better, don't start rooms near the edge of the map)
21:46
<@AnnoDomini>
Now how do I pass the pointer to the function?
21:46
<@AnnoDomini>
Derakon: Good points.
21:46
<@jerith>
On a silver tray.
21:46
<@AnnoDomini>
I think I need to define one of the dimensions or something.
21:47
<@Derakon>
int** array = allocateMemoryForMap(); generateMap(array, mapWidth, mapHeight);
21:49 * AnnoDomini fails to parse.
21:50
<@McMartin>
Pretty sure that allocate function will need a size argument too
21:50
<@Derakon>
Good point.
21:51
<@Derakon>
I mainly made it a function because I didn't want to go look up how to allocate memory in C++. ?.?
21:51
<@AnnoDomini>
Mumble. I should probably just put any and all arrays inside structs, JUST FOR THE EASIER ARGUMENT PASSING.
21:51
<@McMartin>
Or you could use std::vector, which does exactly this.
21:51
<@Derakon>
Eh?
21:51
<@Derakon>
Honestly, you should just use Python. ?.?
21:52
<@AnnoDomini>
McMartin: What?
21:52
<@AnnoDomini>
Derakon: :V
21:52
<@McMartin>
C-style arrays in C++ are a nightmare.
21:52
<@Derakon>
std::vector is a data object that makes dealing with arrays in C++ not suck quite so badly.
21:54
<@McMartin>
That said.
21:54
<@McMartin>
The commands are:
21:54
<@McMartin>
char **x;
21:54
<@McMartin>
x = new (char *)[rowcount];
21:54
<@McMartin>
for (int i = 0; i < rowcount; i++) x[i] = new char[columncount];
21:54
<@McMartin>
And now, here is the hilarious part.
21:55
<@McMartin>
Although you have used new here, using delete on any of them will corrupt all of memory and crash your application.
21:55
<@McMartin>
You must use delete[] instead, like so:
21:55
<@McMartin>
for (int i = 0; i < rowcount; i++) delete[] x[i];
21:55
<@McMartin>
delete[] x;
21:56
<@McMartin>
You may wonder how to figure out, given a T *, whether it was an allocated T to be deleted with delete, or an allocated array of T to be deleted with delete[].
21:56
<@McMartin>
The answer is: You can't. You must know.
21:57
<@McMartin>
So, seriously, make a 2D array class, and use the constructor and destructor to handle all this.
21:57 * AnnoDomini made it this game specific, generateMap(&gameState), eh.
21:58
<@McMartin>
Alternately alternately, use boost::shared_array<int> and don't even worry about destructors.
21:58
<@McMartin>
An important rule for C++ is that if you're throwing pointers around, never let a pointer to a stack variable escape.
21:58
<@McMartin>
It's important in C too but not as screamingly critical.
21:59
<@AnnoDomini>
The rooms are kinda funky. I think the probability of them occuring is too large.
21:59
<@Derakon>
I hate memory management. :\
21:59
<@McMartin>
Boost does most of it for you. You just have to worry about recursive cycles.
21:59
<@Derakon>
AnnoDomini: given that it's a 5% chance per block and each room is an average of about 26 blocks? Yeah.
22:00
<@McMartin>
(Which brings it up to Perl's level)
22:01
<@AnnoDomini>
http://i39.tinypic.com/24vpown.jpg <- at 2% chance of a room, it looks pretty cool.
22:02
<@Derakon>
Heh.
22:06
<@AnnoDomini>
Need to sleep now. Class very early.
22:06 AnnoDomini [~farkoff@Nightstar-28151.neoplus.adsl.tpnet.pl] has quit [Quit: I got forehead-vagina raped, Mom. There's no counseling for that shit!]
22:11 Alek [~omegaboot@Nightstar-3659.dsl.emhril.sbcglobal.net] has quit [Quit: ]
22:19 Alek [~omegaboot@Nightstar-3659.dsl.emhril.sbcglobal.net] has joined #code
22:39 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer]
22:40 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
22:40 mode/#code [+o Attilla] by ChanServ
22:44
<@gnolam>
<3 Multicore.
22:57 Derakon [~Derakon@Nightstar-4879.hsd1.ca.comcast.net] has quit [Quit: This computer has gone to sleep]
23:24 Rhamphoryncus [~rhamph@Nightstar-7184.ed.shawcable.net] has quit [Quit: Rhamphoryncus]
23:24 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout]
23:24 Derakon [~Derakon@Nightstar-4879.hsd1.ca.comcast.net] has joined #code
23:24 mode/#code [+o Derakon] by ChanServ
23:27 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
23:27 mode/#code [+o Attilla] by ChanServ
23:44 Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer]
23:45 Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code
23:46 Derakon [~Derakon@Nightstar-4879.hsd1.ca.comcast.net] has quit [Quit: This computer has gone to sleep]
23:50 Orthia [~Orthianz@Nightstar-12547.xdsl.xnet.co.nz] has quit [Ping Timeout]
--- Log closed Mon Mar 30 00:00:37 2009
code logs -> 2009 -> Sun, 29 Mar 2009< code.20090328.log - code.20090330.log >