Speedhack: SpikedFruits
Bob

My speedhack entry.

I'm too tired to write about it now.

Pictures can be seen here

Source Code
Windows Binary

EDIT: Fix for ATI (and hopefully Intel) users now included.

EDIT2: Linux Fix #1:

Edit gamestate.cpp, function set_map() and change:

  this->switch_to_map = ~0;

To:

  this->switch_to_map = ~0u;

Billybob

The effects were too much for my laptop's video card, it seems. When I grabbed a fruit it would lockup until the effect stopped.
ATI Mobility Radeon X600, 64MB.

I'll try it on my desktop tomorrow.

Looks slick, though, from what I could see.

Bob

I make liberal use of glCopyTexImage(). I suppose it's not all that fast on non-Nvidia cards.

One thing you can try is to force NV_texture_rectangle to be used by replacing render.cpp, lines 538 from:

  GLenum target = allegro_gl_extensions_GL.NV_texture_rectangle
                | allegro_gl_extensions_GL.ARB_texture_rectangle
                ? GL_TEXTURE_RECTANGLE_NV
                : GL_TEXTURE_2D;

to:

  GLenum target = GL_TEXTURE_RECTANGLE_NV;

Same for lines 415 and 481.

I think ATI exposes a similar extension (EXT_texture_rectangle) that is undocumented.

EDIT:

I've done some fixes in the code. Looks like I've been liberally using non-power-of-two textures, which aren't well supported on non-NV cards. The latest executable+source should have some quick fixes that ought to help.

Neil Walker

Looks good. I see you pinched the font from hamsterball ;)

miran

The opening screen, the music and the menu work, but when I want to play, the game crashes:

Shutting down Allegro due to signal #11
Segmentation fault

Judging by the screenshots we had some pretty similar ideas, although my implementation was a lot less sophisticated... :)

Bob
Quote:

when I want to play, the game crashes:

Any chance you can get me a stack trace?

miran

How would I get that?

Felipe Maia

Really neat for a SH entry, well done.

LennyLen
Quote:

How would I get that?

Er, the usual way? Running GDB (I assume you compiled with GCC, hopefully with debugging info on) and then typing bt at it's prompt.

miran

Thank you.

(gdb) run
Starting program: /home/miran/games/SH06/bob - Spiked Fruits/game
[Thread debugging using libthread_db enabled]
[New Thread 46912510335968 (LWP 12599)]
[New Thread 1084238144 (LWP 12616)]
[New Thread 1095223616 (LWP 12617)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912510335968 (LWP 12599)]
0x000000000040aae5 in gamestate_t::set_map ()
(gdb) bt
#0  0x000000000040aae5 in gamestate_t::set_map ()
#1  0x000000000040a676 in gamestate_t::update_logic ()
#2  0x000000000040d7fb in main_menu_t::update_logic ()
#3  0x000000000040d4f9 in main ()

Bob

Can you compile with -g3 and without -O3? That should also give you line numbers. (set_map() has way too many lines of code).

miran
(gdb) run
Starting program: /home/miran/games/SH06/bob - Spiked Fruits/game
[Thread debugging using libthread_db enabled]
[New Thread 46912510335968 (LWP 30651)]
[New Thread 1084238144 (LWP 30654)]
[New Thread 1095223616 (LWP 30655)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912510335968 (LWP 30651)]
0x000000000041f00e in gamestate_t::set_map (this=0x87ded0,
    map_id=18446744073709551615) at src/gamestate.cpp:673
673             this->player[0].pos.x = map->player[0].start.x;
(gdb) bt
#0  0x000000000041f00e in gamestate_t::set_map (this=0x87ded0,
    map_id=18446744073709551615) at src/gamestate.cpp:673
#1  0x000000000041f5f5 in gamestate_t::update_logic (this=0x87ded0)
    at src/gamestate.cpp:599
#2  0x000000000042400c in main_loop (game=0x87ded0) at src/main.cpp:39
#3  0x0000000000425245 in main_menu_t::update_logic (this=0x7596c0)
    at src/main.cpp:237
#4  0x000000000042400c in main_loop (game=0x7596c0) at src/main.cpp:39
#5  0x0000000000425584 in main () at src/main.cpp:121

Bob
Quote:

0x000000000041f00e in gamestate_t::set_map (this=0x87ded0,
map_id=18446744073709551615) at src/gamestate.cpp:673

Something is definitely here.

Edit:

Try editing gamestate.cpp, function set_map() and change:

  this->switch_to_map = ~0;

To:

  this->switch_to_map = ~0u;

Does this help?

miran
Quote:

Does this help?

Yes. :o:o:o

And the game looks amazing! :o:o:o Real eyecandy!

EDIT: But now it exits randomly after 20 or so seconds. EDIT: Or maybe a few seconds after picking up the coconut.


(gdb) run
Starting program: /home/miran/games/SH06/bob - Spiked Fruits/game
[Thread debugging using libthread_db enabled]
[New Thread 46912510335968 (LWP 13248)]
[New Thread 1084238144 (LWP 13251)]
[New Thread 1095223616 (LWP 13256)]
[Thread 1095223616 (LWP 13256) exited]
w[Thread 1084238144 (LWP 13251) exited]
wwAssert failed at line 355 of ./src/color.c

Program received signal SIGABRT, Aborted.
[Switching to Thread 46912510335968 (LWP 13248)]
0x00002aaaab3fe4f5 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00002aaaab3fe4f5 in raise () from /lib64/libc.so.6
#1  0x00002aaaab3ffe40 in abort () from /lib64/libc.so.6
#2  0x00002aaaaad3bc23 in al_assert (file=0x2aaaaadf2944 "./src/color.c",
    line=355) at ./src/allegro.c:569
#3  0x00002aaaaad4b74c in hsv_to_rgb (h=-1.59837306, s=1, v=1,
    r=0x7fffffe59f94, g=0x7fffffe59f90, b=0x7fffffe59f8c) at ./src/color.c:355
#4  0x0000000000425d37 in renderer_t::apply_blend_effect (this=0x87dfc0, p=3,
    tick=301.00058555603027) at src/render.cpp:648
#5  0x000000000041d0c3 in coconut_effect_t::draw (this=0x737a80,
    render=0x87dfc0, in_player_view=0) at src/effect.cpp:309
#6  0x00000000004256b0 in renderer_t::draw_big_effects (this=0x87dfc0,
    in_player_view=0) at src/render.cpp:326
#7  0x00000000004288f3 in renderer_t::draw (this=0x87dfc0)
    at src/render.cpp:681
#8  0x000000000041f58e in gamestate_t::update_display (this=0x87ded0)
    at src/gamestate.cpp:637
#9  0x0000000000424046 in main_loop (game=0x87ded0) at src/main.cpp:42
#10 0x000000000042524d in main_menu_t::update_logic (this=0x7596c0)
    at src/main.cpp:237
#11 0x0000000000424014 in main_loop (game=0x7596c0) at src/main.cpp:39
#12 0x000000000042558c in main () at src/main.cpp:121

Bob

Odd. Somehow, Allegro thinks v > 1, but here's the call to hsv_to_rgb in render.cpp:

    hsv_to_rgb(rotate, 1, 1, &r, &g, &b);

Why is 1 getting rounded to anything but 1.0? Maybe try replacing it by 0.9999 and see if that helps?

miran

Nope, but adding this before that function call does help:

while (rotate < 0) {
  rotate += 360.0;
}
while (rotate > 360.0) {
  rotate -= 360.0;
}

Bob

Ahh I remember now. You need a more recent version of Allegro :) There was an assert in hsv_to_rgb() that didn't make any sense (the one you're apparently hitting) and thus was removed.

Jonny Cook

Hey cool effects! Kind of makes me dizzy. Oh wait, maybe that's because I'm sleep deprived...

miran
Quote:

Kind of makes me dizzy.

You shouldn't even attempt to look at my game then. I've been seasick all day. A couple of times I thought I was going to throw up and I'm not even exaggerating!

MiquelFire

The insanity effect in my game could cause you to become insane!

Matthew Leverton
Quote:

map id of 18446744073709551615

Leave it to Bob to find a way to create that many maps. :o

Billybob

Stupid game, I was one pixel away from getting that fruit and time ran out >:(

Onewing

Wow. I go hide now...

Neil Walker

I get music, but it crashes immediately after that,

#0 0x00000000 in ?? ()
#1 0x10041490 in _libuser32_a_iname ()
#2 0x00405d3f in main_loop(game_engine_t*) (game=0x3007148) at src/main.cpp:42
#3 0x004060bf in _mangled_main() () at src/main.cpp:121
#4 0x1006af15 in _libuser32_a_iname ()
(gdb)

Bob

Did you compile with AGL 0.4.0+ and Allegro 4.2+?

Neil Walker

Ah, right. I thought 0.2.5CVS was the latest. I'd better upgrade then. Though OpenLayer works fine. Will upgrading to .4 make OL break do you know?

Richard Phipps

Neil: 0.4.0 with Openlayer works fine for me under Windows.

Neil Walker

Maybe it'll fix some of the OL things that don't work under MSVC ;)

Well, with 0.4, Spike Fruits works :)

Fladimir da Gorf

Damn, I die every time in the map where you have to pick a lot of Time x 2:s... I simply can't move down in the end to pick the last fruit... and I can't really see what's going on anyways so it's hard to say what goes wrong :P

Great game, nevertheless!

Onewing

My wife and I played it together. Was a lot of fun. She said your game should win. :)

spunit262

The program immediately crash for me.

(gdb) run
Starting program: c:\Program Files\allegro\SpikedFruits/game.exe

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) backtrace
#0  0x00000000 in ?? ()
#1  0x00420ad4 in allegro_gl_win_init ()
#2  0x616e5500 in ?? ()
Cannot access memory a address 0x6173654d

It be trying to run NULL().

Bob

Make sure you have Allegro 4.2.0 and AllegroGL 0.4.0 installed.

spunit262

I have both installed.

Bob

Do you happen to have an Intel 915G or 915GM graphics card?

spunit262

Yes, Is that the problem?

Bob

Yes, see this thread for details, and a patch.

spunit262

It be working now.

Richard Phipps

Once it's decided about the patch, is it going into the CVS version?

Thread #586891. Printed from Allegro.cc