[aquaria] Scenario colision detection issues in achurch.org hg/aquaria tip

Andrew Church achurch+aquaria at achurch.org
Fri Dec 31 15:21:41 EST 2010


>Right now, I have Naija sitting in a "invisible wall".  Energy form blasts
>hit these invisible walls.  They are nearby two pillars.  It is difficult to
>tell with precision, but there are two pillars in the screen, and it DOES
>look like there are TWO invisible walls that the blasts can hit (and Naija
>can grab).  But they are not in an exact offset from the pillars.

Hmm, my first guess would be that your video driver is broken.  Object
collisions are calculated by reading the texture data with glGetTexImage(),
so if your driver doesn't return the texture data properly (maybe it
internally optimizes the data and doesn't properly restore it on read?),
collisions will end up bugged.  Those broken pillar textures in particular
have a lot of empty space in them, and the invisible walls you found look
like they're right at the corner of the texture box, which suggests to me
that glGetTexImage() isn't returning the right data.

One thing you could do to check this is add something like the following
to Game::fillGridFromQuad(), right after the glGetTexImage() calls (line
1941 in the current Icculus code):

	char buf[32];
	snprintf(buf, sizeof(buf), "/tmp/%u.pgm", id);
	FILE *f = fopen(buf, "w");
	fprintf(f, "P5\n%d %d 255\n", (int)w, (int)h);
	for (int i = 0; i < (int)w*(int)h; i++)
		fputc(data[i*4+3], f);
	fclose(f);

That'll write out the alpha data for each texture as a PGM image.  For the
first Energy Temple area (the one you took a screenshot in), you should
get 6 textures, and the alpha images should look like broken pillars and
rocks (there's also a 64x512 solid opaque one, which is the door texture).
If you see anything else, your video driver is broken.

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/


More information about the aquaria mailing list