Allegro.cc - Online Community

Allegro.cc Forums » The Depot » Transdimensional Hellspider

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Transdimensional Hellspider
kazzmir
Member #1,786
December 2001
avatar

True, but after the first few levels it takes quite a while to build the hellspider, mostly because it precalculates all possible flexed/relaxed states (because the calculations are too slow to do each frame when the hellspider is flexing). Sadly there's not much I can do about that.

Compute the next hellspider in a separate thread and let the player fly around while the computation is going on.

Jonatan Hedborg
Member #4,886
July 2004
avatar

True, but after the first few levels it takes quite a while to build the hellspider, mostly because it precalculates all possible flexed/relaxed states (because the calculations are too slow to do each frame when the hellspider is flexing). Sadly there's not much I can do about that.

Not that I've noticed a long loading time, but maybe you could do it real-time and cache the results? (Eg check to see if we've already calculated "this", and if so use it. Otherwise, calculate it and store for future use).

Tiamat
Member #11,289
August 2009

Really interesting concepts for a shmup. I was expecting something like White Butterfly, which was an awesome game btw!, but instead get my ass repeatedly handed to me by a very unforgiving enemy. I need to practice I guess. :P

That's true, but the problem I have is that the palette array seems to get corrupted under certain rare circumstances. This has happened with several of my games so while it could be a problem in the few pieces of my code that they've had in common, I don't think it is. The only fix I can find is to put giant padding arrays around the palette array, like so:

Apparently this is windows explorers fault I've come to find out. Since windows XP SP2 through Vista and windows 7, explorer will forcibly change the system palette thus corrupting any game using 8-bit colors with little more than a message to your program informing you of this. ..I believe in windows.h it's defined as "WM_YOUVE_JUST_BEEN_RAPED_BY_MICROSOFT" :D

I've got a fix for this bug, but I'll have to get back to you as I don't have the code in front of me right now since I did not write the fix. You will have to recompile the allegro source with the added code though. ..(It should probably be added to the 4.4 branch also.)

Linley Henzell
Member #3,963
October 2003

kazzmir said:

Compute the next hellspider in a separate thread and let the player fly around while the computation is going on.

This would be a good idea, but sadly threads are among the many things I don't know how to use.

Not that I've noticed a long loading time, but maybe you could do it real-time and cache the results?

Yeah, I considered that approach but rejected it for some reason. Probably laziness :)

Tiamat said:

I've got a fix for this bug, but I'll have to get back to you as I don't have the code in front of me right now since I did not write the fix.

Please do! I'd really appreciate that.

Tiamat
Member #11,289
August 2009

      case WM_QUERYNEWPALETTE:
      case WM_PALETTECHANGED:
         if ((HWND)wparam != wnd && gfx_directx_primary_surface) {
            IDirectDrawSurface2_SetPalette(gfx_directx_primary_surface->id, ddpalette);
            InvalidateRect(wnd, NULL, 1);
         }
         return 0;

Should go into the allegro/src/win32/wwnd.c file as part of the windows callback code.

Anyone feel free to apply this to the allegro 4 branch so other users don't have this problem anymore as well.

Cheers!

Linley Henzell
Member #3,963
October 2003

Thanks! I'll definitely use that code. The palette bug has been annoying me for years :)

ophelius
Member #6,949
February 2006
avatar

I'm having this problem as well. I'm using another language so I don't know how to compile C code. I'm also using Allegro 4.0. If anyone has this version compiled into a dll with the palette fix, please post the link here. That would be much appreciated. Thanks

Edit: Ok, I tried compiling this code into wwnd.c but I'm getting this error message:

"error C2065: 'gfx_directx_primary_surface' :undeclared identifier"
"error C2223: left of '->id' must point to struct/union"
"error C2065: 'ddpalette' : undeclared identifier"

I'm pretty sure I put the code in the right place inside directx_wnd_proc and sandwiched between the other cases in 'switch(message)'. I don't code in C so excuse me if I don't make sense. Thanks

Matthew Leverton
Supreme Loser
January 1999
avatar

It's highly possible that the fix only works with 4.2 and 4.4 (those two versions are very similar). Version 4.0 is much older.

Tiamat
Member #11,289
August 2009

Are all the required headers included? ..You may have to add: #include "wddraw.h" to that file if it's not there already. ..Sorry, I don't have a before and after snapshot for the differences, only the after.

Hope that helps.

ophelius
Member #6,949
February 2006
avatar

I got it to work thanks to Matthew Leverton, but now I'm having other issues. Check this thread for more info:
http://www.allegro.cc/forums/thread/603939/863411#target

type568
Member #8,381
March 2007
avatar

Very very nice ideas, something literally all single player games are lacking.
Although the reality, is very much like it. Even though games tend to copy reality, they don't get in to matter of cause-effect sequences deep enough :P

Append:
So, changing strategy from spider to spider, is the "best strategy" to which these guys can't adapt?

 1   2 


Go to: