Allegro.cc - Online Community

Allegro.cc Forums » The Depot » Speedhack: SpikedFruits

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Speedhack: SpikedFruits
Bob
Free Market Evangelist
September 2000
avatar

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;

--
- Bob
[ -- All my signature links are 404 -- ]

Billybob
Member #3,136
January 2003

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
Free Market Evangelist
September 2000
avatar

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.

--
- Bob
[ -- All my signature links are 404 -- ]

Neil Walker
Member #210
April 2000
avatar

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

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

miran
Member #2,407
June 2002

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... :)

--
sig used to be here

Bob
Free Market Evangelist
September 2000
avatar

Quote:

when I want to play, the game crashes:

Any chance you can get me a stack trace?

--
- Bob
[ -- All my signature links are 404 -- ]

miran
Member #2,407
June 2002

How would I get that?

--
sig used to be here

Felipe Maia
Member #6,190
September 2005
avatar

Really neat for a SH entry, well done.

LennyLen
Member #5,313
December 2004
avatar

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
Member #2,407
June 2002

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 ()

--
sig used to be here

Bob
Free Market Evangelist
September 2000
avatar

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

--
- Bob
[ -- All my signature links are 404 -- ]

miran
Member #2,407
June 2002

(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

--
sig used to be here

Bob
Free Market Evangelist
September 2000
avatar

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?

--
- Bob
[ -- All my signature links are 404 -- ]

miran
Member #2,407
June 2002

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

--
sig used to be here

Bob
Free Market Evangelist
September 2000
avatar

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?

--
- Bob
[ -- All my signature links are 404 -- ]

miran
Member #2,407
June 2002

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

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

--
sig used to be here

Bob
Free Market Evangelist
September 2000
avatar

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.

--
- Bob
[ -- All my signature links are 404 -- ]

Jonny Cook
Member #4,055
November 2003

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

The face of a child can say it all, especially the mouth part of the face.

miran
Member #2,407
June 2002

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!

--
sig used to be here

MiquelFire
Member #3,110
January 2003
avatar

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

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

Matthew Leverton
Supreme Loser
January 1999
avatar

Quote:

map id of 18446744073709551615

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

Billybob
Member #3,136
January 2003

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

Onewing
Member #6,152
August 2005
avatar

Wow. I go hide now...

------------
Solo-Games.org | My Tech Blog: The Digital Helm

Neil Walker
Member #210
April 2000
avatar

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)

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Bob
Free Market Evangelist
September 2000
avatar

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

--
- Bob
[ -- All my signature links are 404 -- ]

 1   2 


Go to: