Maze Demo

Use this forum to share and discuss Uzebox games and demos.
havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Maze Demo

Post by havok1919 »

...and let there be... Third party software! :lol:

Image

Here's the .hex file if you want to give it a try:

https://uzebox.org/wiki/images/b/bc/Maze.hex

...and here's an archive with source code, Tile Studio Files, etc.

https://uzebox.org/wiki/Maze

Don't expect too much. It's all of about 200 lines of source (which is probably more like 100 lines of actual 'do something' code), but it's enough to generate random, solveable mazes and let you run around trying to solve them. Over, and over, and over... Hey, face it, you'd have gladly spent $30 for this on your Atari 2600 thirty years ago. ;)

Anyway, just figured it might help kick-start some people since it's a lot smaller/simpler than Uze's (amazingly good) Megatris.

-Clay
CompMan
Posts: 91
Joined: Mon Aug 25, 2008 3:48 am
Location: Kent, WA

Re: Maze Demo

Post by CompMan »

Wow looks great. I can't wait to see what other people can make.

Compman
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Maze Demo

Post by uze6666 »

Hehe, just played the first third party game, you receive the "Official Uze Seal of Qualityl(tm)" :mrgreen: ! Very well commented too. That's gonna be a terrific learning tool. If you don't mind I will make it part of the official release.

I noticed a few interesting things running your hex file:
1) intro sound is not ok (ringing volume does not decay). Though I suspect why, the code base uses signed chars. So we must use -fsigned-char switch for GCC.
2) joystick was not working. I recompiled your C file as is and it worked fine. Don't know why, may be some compiler switch?
3) screen is offset to the left by ~1 tile, so the "S" of simple if mostly not visible. But I think its just because the field in 37 tiles large. Tile columns 0 and 39 are out of screen on regular CRTs.

I'm wondering if its compilation or I shipped the sources with my release 1.0. Just in case, here's the relevant switches used:
-std=gnu99
-fsigned-char
-Os

Did you use AvrStudio+WinAVR or Codevision to compile this game?

Anyhow, two thumbs up! :D

Cheers,

Uze
havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: Maze Demo

Post by havok1919 »

uze6666 wrote:Hehe, just played the first third party game, you receive the "Official Uze Seal of Qualityl(tm)" :mrgreen: ! Very well commented too. That's gonna be a terrific learning tool. If you don't mind I will make it part of the official release.
Feel free to include it-- it's meant to just be a learning exercise. ;-)
1) intro sound is not ok (ringing volume does not decay). Though I suspect why, the code base uses signed chars. So we must use -fsigned-char switch for GCC.
Ok, I admit that I haven't tested sound (since I didn't add any to 'maze'). My Dell LCD on the desk doesn't have speakers and I'm too lazy to come up with something external! Did you try the -fsigned-char switch on the build? Did that fix it? (I took everything else from your Tutorial/Download page, so in theory it's "OK".)
2) joystick was not working. I recompiled you C file as is and it worked fine. Don't know why, may be some compiler switch?
Duh. No, that's me being a moron. I had to swap PA3 and PA4 to fix my chip footprint "oops" and I forgot to put it back. (but since that's in uzeboxVideoEngineCore.s which I didn't include in the archive it recompiled with the 'right' port mapping for your board) I'll fix it and change my file on the server...
3) screen is offset to the left by ~1 tile, so the "S" of simple if mostly not visible. But I think its just because the field in 37 tiles large. Tile columns 0 and 39 are out of screen on regular CRTs.
Ahhh, good to know. We should probably document that somewhere too-- on my Dell LCD and on the Projector it looks OK (different treatment of overscan no doubt), but it would be handy to have a "safe boundaries" list for CRT's I'm sure. I'll try it on my old C= 1084 and see what it looks like...
-std=gnu99
-fsigned-char
-Os
I just checked and I had -funsigned-char set. OTOH though, I don't think that the Tutorial page said to set that. (I just remember the -Os being mentioned?)
Did you use AvrStudio+WinAVR or Codevision to compile this game?
I used AvrStudio+WinAVR. I figure that'll be the most common for people and it'll force me to add it to my list of "things I know should the need arise". :)
Anyhow, two thumbs up! :D
Thanks, I'm having fun with it. Getting time to turn some PCB's too!

-Clay
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Maze Demo

Post by uze6666 »

Did you try the -fsigned-char switch on the build? Did that fix it? (I took everything else from your Tutorial/Download page, so in theory it's "OK".)
Yes that fixed it.
it would be handy to have a "safe boundaries" list for CRT's I'm sure.
Good point. From my experience so far in the tiles mode, consider (centered) 38x28 as "action safe" and 34x26 as "title safe" (to use the tv language). That leads me to think about perhaps lowering the resolution to 38 tiles horizontally since they are not visible on CRTs. Do you see all of them on a LCD?
I don't think that the Tutorial page said to set that. (I just remember the -Os being mentioned?)
Yep, step 3. Select Project->Configuration Options and uncheck box the named "Unsigned chars". Set the optimization to -Os. Click Ok. ;) I recall adding it after I made a test project from scratch to be sure I did not forget anything! Btw, just for the benefit of others, any -O setting works fine. -Os just gives the smallest compiled code.

Cheers,

Uze
havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: Maze Demo

Post by havok1919 »

uze6666 wrote:Good point. From my experience so far in the tiles mode, consider (centered) 38x28 as "action safe" and 34x26 as "title safe" (to use the tv language). That leads me to think about perhaps lowering the resolution to 38 tiles horizontally since they are not visible on CRTs. Do you see all of them on a LCD?
I updated the binary and shifted the redraw command one more tile to the right-- does it look right on your TV now? Any clipping on the right?

On the Dell 20" LCD (4:3) I have here that makes for a 'large' gap on the left and smaller gap on the right (which is a little perplexing since the 'centering' controls are disabled in that mode). On the 24" LCD (16:9) I get the same sort of deal-- 1" gap on the left ~1/2" on the right. Same for a Panasonic 42" Plasma... (Can't really tell on the projector since the distance to the edge of anything with contrast is so far.)

All the LCD's and plasma look like this:

Image

Now to be fair, moving the tiles one left would seem to just make the gap on the right too big, so maybe in this case of a '37 column' display I should try to shift the raster left by three pixels (9 cycles?) and center the active area. Three devices probably isn't definitive, but it might be a pattern when it comes to flat panel displays... Otherwise it looks like the "normal" display would be 38 columns with one more "on the left"-- but that's where you said your TV was clipping.

Maybe halfway is the compromise-- 36 columns is 'safe', 38 is 'mild overscan' (CRT), 40 is ' heavy overscan' (on CRTs)?
Yep, step 3. Select Project->Configuration Options and uncheck box the named "Unsigned chars".


Oh, yep-- you're right. And now that you mention it, I remember doing that too. I must have started another project and forgot to do it the second time! Sorry 'bout that.

-Clay
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Maze Demo

Post by uze6666 »

A picture is worth a thousand words:
maze.jpg
maze.jpg (70.84 KiB) Viewed 8183 times
So, if you'd make you maze 38 tiles wide (instead of 37) it would be centered ok. Now notice that rounded mask on my t. It cuts some stuff in the corners. Just remove the space before "2008" should make it pretty safe (on my tv at least) ;) .

Btw,look at my pic versus yours, S-Video really makes a difference...wow! :P

Cheers,

Uze
havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: Maze Demo

Post by havok1919 »

uze6666 wrote:A picture is worth a thousand word:
maze.jpg
So, if you'd make you maze 38 tiles wide (instead of 37) it would be centered ok. Now notice that rounded mask on my t. It cuts some stuff in the corners. Just remove the space before "2008" should make it pretty safe (on my tv at least) ;) .
Wow, I guess I've been out of the CRT TV loop for too long-- that's some serious cropping compared to flat panels! That TV's barely showing ~45us of visible raster... I bet it'd be clipping 640 pixel 13.5MHz BT656 (about ~47.4us) in the corners pretty hard too. Hmmm. Man, I should have kept one of the TV's from when we did the Midway home arcade games for Target-- those had the most atrocious underscan ever. Would have made a good "worst case". ;-)

The maze generator relies on the maze being an odd number of elements, so it's a little hard to fix just with another tile's worth of width... Probably not worth (over) complicating it with tweaks to fix it. Just stick to even screen widths in the 36 or 38 column range from now on!
Btw,look at my pic versus yours, S-Video really makes a difference...wow! :P
Yeah, definitely a step up! I need to try out component and/or RGB here one of these days, that should look really sharp.

-Clay
havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: Maze Demo

Post by havok1919 »

Hey Uze,

If you have a sec, give this a try:

http://www.embeddedengineeringllc.com/U ... etest1.hex

(Just as a tweak for the "odd number of columns display" I shifted the raster position on the line to center it up. Looks about right here, curious if your TV is close too.)

I suppose that could be a pretty simple option... Since we're just burning cycles at that point on the scanline anyway-- allow for a 'centering' setting in EEPROM and shadow it into a RAM location. Then use that to adjust the ratio of the two delay loops on either side of render_tile_line instead of using constants. Maybe that's what you were already suggesting...

I just did it manually like so:

Code: Select all

next_text_line:	
	rcall hsync_pulse ;3+144=147

	ldi r19,41-5-7; was just -5 before
text_wait1:
	dec r19			
	brne text_wait1;206

	;***draw line***
	call render_tile_line

	ldi r19,10+5+7; was just 10+5 before
-Clay
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Maze Demo

Post by uze6666 »

Yeah it's perfectly centered now. The fonts bottom are still a bit clipped in the corners, but its ok.
Maybe that's what you were already suggesting...
Yes, I think it may be useful to have a runtime configuration param for fine centering. Game like yours that rely on a odd field size could benefit from it. Although that would only work for the tiles-only mode, sprites-mode have almost no cycles left for that! Anyhow, I'll see if I can put it in the next rev.

I saw your game takes almost all the RAM. Watch out for stack overflow. I'm not even sure you would be able to play music without crashing the game. Would be good to try and plug one of the songs in Megatris. Also I implemented support for the SNES pads. Buttons mappings will defaults to SNES, NES being re-mapped on the fly. Would be good to use the button constants in HARDWARE.H if you want your game to work in the next rev without too much changes. ;)


Uze
Post Reply