Ghosty Ghost

Use this forum to share and discuss Uzebox games and demos.
User avatar
kivan117
Posts: 73
Joined: Sat Mar 14, 2015 5:43 am

Re: Ghosty Ghost

Post by kivan117 »

Excellent. I'd previously read just about all available wiki entries and relevant parts I could find so I only had one thing twisted in my head, but it's better to ask everything because who knows where you'll be wrong if you don't. On the bright side I now have a lot more room to work with than I thought so in addition to being able to add parallax the easy way, I'll see about maybe having more than one time of day graphically and maybe jazzing up the night sky a little too while I'm at it.
User avatar
kivan117
Posts: 73
Joined: Sat Mar 14, 2015 5:43 am

Re: Ghosty Ghost

Post by kivan117 »

Worked on parallax a bit. It functions but haven't tested it much yet. Only thing weird I've seen so far on hardware was the audio froze for a few frames one time. I suspect it somehow ran out of time to update it, possibly due to me telling it to do too much maths or something.

Anyway, main post has the new download if you want to check it out.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Ghosty Ghost

Post by D3thAdd3r »

Great work, that background depth add a lot. Love that intro part as well, this is getting polished up into a very nice presentation.

Only bug I discovered so far is:
gg_highscoretrans.jpg
gg_highscoretrans.jpg (58.58 KiB) Viewed 7336 times
You might already know about it, but immediately after the losing sequence finishes this frame gets shown very quickly. It looks like you are setting the tile set to the high scores tiles, then waiting vsync, then drawing the high score stuff. Or else there is no WaitVsync(1) and the code is taking long enough that the level indices still in vram get drawn with high score tiles. Pretty standard to do something like this:
FadeOut(1,true);
SetTileTable(HighScoreTiles);
GetEEPRomStuffReady();
FadeIn(1,false);

Keep it up this is a classic in the making.
User avatar
kivan117
Posts: 73
Joined: Sat Mar 14, 2015 5:43 am

Re: Ghosty Ghost

Post by kivan117 »

D3thAdd3r wrote:Great work, that background depth add a lot. Love that intro part as well, this is getting polished up into a very nice presentation.

Keep it up this is a classic in the making.
Thanks. First project I'll actually finish in a long time, haha. I've got some more graphical niceties planned. Hopefully the online scores don't throw me for any major loops this weekend.
D3thAdd3r wrote:Only bug I discovered so far is...immediately after the losing sequence finishes this frame gets shown very quickly
Yeah.. That's an old bug from when I first implemented eeprom scores. I'd fixed it but I must've commented out something somewhere. I'll look into it. Thanks for mentioning it. Let me know if you notice any others. Like I said, one time the flapping sound hung for some reason. Dunno how/why it happened unless the parallax is just taking too long to process.

On that front, does rand() take a lot of time on the hardware? It gets used frequently for the columns.
Also are there any bit magic alternatives to using modulus for numbers that aren't a power of 2? (e.g. var%3)
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Ghosty Ghost

Post by uze6666 »

Like I said, one time the flapping sound hung for some reason. Dunno how/why it happened unless the parallax is just taking too long to process.
You meant it kept playing until the next sound? It could be the way your patch is done. Not sure. Can't test it yet, still trying to have my new Atmel-ICE to work. It's not supported by AvrStudio4 (yeah still using that!) and AVRDUDE doesn't recognizes it either. :(
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Ghosty Ghost

Post by D3thAdd3r »

I am not sure how rand() is implemented in the libraries, and I never used it for any period so no clue on the speed. If you suspect it's slow, this works well for anything. Good randomness and it's pretty fast it seems:

Code: Select all

uint16_t prng_state;
inline void seedprng(uint16_t seed){
	prng_state = seed;
}

uint16_t prng(){
	/* taps: 16 14 13 11; feedback polynomial: x^16 + x^14 + x^13 + x^11 + 1 */
	uint16_t bit  = ((prng_state >> 0) ^ (prng_state >> 2) ^ (prng_state >> 3) ^ (prng_state >> 5) ) & 1;
	prng_state =  (prng_state >> 1) | (bit << 15);
	return prng_state;
}
Depending on how much space you have left after your extra content, you could always store a pre-computed table of random values(Doom did it, so it must be right). To get some extra cycles you could use:

Code: Select all

void SetRenderingParameters(u8 firstScanlineToRender, u8 verticalLinesToRender)
It would buy you some thousands of cycles for little cost. I always vote for a shorter vram but that's me.
uze6666 wrote:Can't test it yet, still trying to have my new Atmel-ICE to work.
What kind of symptoms were you having with the mkII, total death? At this point mine seems to work great, when it wants to, then long periods of "failed to program" with no discernible reason which is annoying. I gave my spare one away, I'm sure he has it stored nicely in a box somewhere :roll:
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Ghosty Ghost

Post by uze6666 »

uint16_t prng_state;
inline void seedprng(uint16_t seed){
prng_state = seed;
}

uint16_t prng(){
/* taps: 16 14 13 11; feedback polynomial: x^16 + x^14 + x^13 + x^11 + 1 */
uint16_t bit = ((prng_state >> 0) ^ (prng_state >> 2) ^ (prng_state >> 3) ^ (prng_state >> 5) ) & 1;
prng_state = (prng_state >> 1) | (bit << 15);
return prng_state;
}
rand() is very slow if i recall. Lee's LFSR version is much faster so I will put this in the official API.

Also *finally* my atmel-ice works with Atmel Studio so I was able to test your latest version. The parallax effect is perfect and very impressive, a first on the Uzebox if I'm not mistaken. I'll play more, but so far I only saw a quick glitch near the ghost once. Like some random tile appeared for 1 frame. Almost there! :D
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Ghosty Ghost

Post by CunningFellow »

Speaking of API functions.

How about BCD things for keeping highscores?
User avatar
kivan117
Posts: 73
Joined: Sat Mar 14, 2015 5:43 am

Re: Ghosty Ghost

Post by kivan117 »

Put the prng() in, seemed to be faster visually in the emulator, less choppy, but I'll have to get a proper debugger to be sure.

As far as the ghost having a random flicker, this became especially apparent when the score reached double digits. Sometimes the scores would flicker, sometimes the ghost would have a black line where it didn't draw. Had pretty wicked sprite flickering and the occasional sound effect hanging for a few seconds. After trying a lot of things and optimizing some things I caved in, reduced the screen to 27 tiles vertically and increased the offset to recenter. Voila! Flickering and sound issues gone. Wish I could make it work without that but it'll do.
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Ghosty Ghost

Post by uze6666 »

27 rows or 28...so as long as it works! :)
Speaking of API functions.
How about BCD things for keeping highscores?
Probably not obvious for most...but now that you talk about it....Do you some functions done?
Post Reply