New Game Idea: Tower Defense

Use this forum to share and discuss Uzebox games and demos.
Post Reply
rocifier
Posts: 71
Joined: Thu Jan 22, 2015 6:35 am

New Game Idea: Tower Defense

Post by rocifier » Thu Mar 15, 2018 3:00 am

I'd like to make a fun and colourful tower defense for the Uzebox. But I'm a little unsure if I will be too limited. Initial thoughts, I'm open to graphics mode suggestions or techniques to pull off the game:

- Towers will work fine as tiles
- Creeps could be made using animated tiles, to simulate many animated sprites. However I might have issues with overlapping units?
- Ideally I would be able to support more than 20 transparent bullet sprites, but I may be able to optimize the gameplay so that you can't build enough towers to fire more than 20 bullets at once. Is rendering lines between two points an option, eg. for laser beams?

I hope to update this thread with ideas for gameplay and artwork, assuming there is a way this kind of game could be made with the hardware limitations.
Last edited by rocifier on Fri Mar 16, 2018 5:41 am, edited 1 time in total.

User avatar
Jubatian
Posts: 1355
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New Game: Tower Defense

Post by Jubatian » Thu Mar 15, 2018 10:37 am

This is sure a sprite-intensive game, which is difficult to pull off.

I could have three suggestions for modes, as follows:
  • Mode 74: For an example, check Flight of a Dragon. This mode can do significantly more sprites than Mode 3, although it has lower resolution, and it is 16 colors instead of 256. The mode is a little complex to use.
  • Mode 72: This is an experimental mode, check this post to see a sample of its capabilities. The drawbacks are that the background takes lot of ROM (so you may need to live with a simpler bg), and that it works somewhat like old 8 bit systems where sprite count per scanline was limited.
  • Tornado 2000: For a game example, look at this. The most important limitation is that you will have to live with 5 colors for a screen, but it has the highest resolution, and can output a lot of 3 color sprites. CunningFellow can help with it as he designed the mode.
So I guess check these, and see whether they work for your goal. Mode 74 and Tornado 2000 has methods for creating vector graphics, although it is very slow in Mode 74 (Tornado 2000 was however created especially with that in mind). Mode 72 can compose lines from bullet sprites, as visible on the example in the post.

CunningFellow
Posts: 1174
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: New Game: Tower Defense

Post by CunningFellow » Thu Mar 15, 2018 11:10 am

I don't know what a tower defense game is but I can certainly lend a hand if you want to use the T2K video mode.

I'd have to give you a few warnings though.

1, The mode is VERY heavy on flash. It uses up 16K - one quarter of all your flash just for writing out the pixels.
2, The blue colour can only be considered a 2nd background. You can't alter/change it on the fly. It gets pre-rendered on the PC.
3. Although you can change the pixel mapped colours you are stuck with dark blue for the "2nd background"
3, You can only fill about 1/6th of the screen with non background colours (128 RAM tiles only)

I do have another video mode down on paper that was 2Bpp that had 128 RAM tiles and 128 ROM tiles. If four colours is enough for tower defense and 128 RAM tiles would be nice - then I can try take that mode from paper to the screen.

rocifier
Posts: 71
Joined: Thu Jan 22, 2015 6:35 am

Re: New Game: Tower Defense

Post by rocifier » Thu Mar 15, 2018 9:39 pm

When you guys talk about very low colour counts - ie. 4 or 5, are these colours paletted? Or would it be something basically like EGA?

CunningFellow
Posts: 1174
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: New Game: Tower Defense

Post by CunningFellow » Thu Mar 15, 2018 10:28 pm

in T2K 4 of the 5 are changeable each scanline.

Here in the video is the title screen

https://youtu.be/UnpNuFsHPSs?t=15

You can see the word TORNADO has a colour gradient on it. That was achieved by changing one colour each scanline.

If you move forward in the video to the gameplay you can see there are 5 colours on screen that are

Yellow
Red
Green
Blue
Black

The Blue can not be changed. It is semi-bright blue and can not be changed (at least not with the bootloader intact). The blue is not alterable by the UZEBox. All the blue in the game is a giant long movie and all the Uzebox can do is select which frame of the movie to show.

The other 4 colours can be set to what ever you like.

A 4 colour mode with 128RAM 128ROM tiles be the same MINUS blue.

rocifier
Posts: 71
Joined: Thu Jan 22, 2015 6:35 am

Re: New Game: Tower Defense

Post by rocifier » Fri Mar 16, 2018 12:47 am

I think mode 74 is looking like the best choice so far (I really like the 16 colour limit), but I do have a few questions about it:

- why are cpu cycles limited by the number of sprites, not fill-rate limited?
- related to that question, can I squeeze more sprites out of the mode by making my sprites very small (eg. 3x3 pixels). I noticed the example includes one very large sprite (it looks something like 128x128 pixels).
- is there a better mode for doing the above in, assuming I don't want to use any vector rendering features?

Can anyone help me estimate the number of sprites I could target? I imagine the game would use about half its sprites for say 2x2 bullet images, and the other half for larger monster images eg. 8x8 pixels. The cpu code would need to be medium to high computation since there is basic realtime physics involved.

EDIT: Alright I've been looking into much more of the details with mode 72 and it looks pretty ideal for what I want to do. I might try and pursue that idea and do a mockup designed for it, and bring the programming talk into the mode 72 thread :) will keep you guys posted!

User avatar
Jubatian
Posts: 1355
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New Game Idea: Tower Defense

Post by Jubatian » Fri Mar 16, 2018 8:38 pm

rocifier wrote:
Fri Mar 16, 2018 12:47 am
- why are cpu cycles limited by the number of sprites, not fill-rate limited?
They are fill-rate limited. In Mode 74 you don't even have a "traditional" sprite system like in Mode 3 (the most used video mode), you are actually doing blits, one blit can put a 8x8 transparent tile at an arbitrary location to create the impression of sprites. However on the Uzebox there is no framebuffer, 4K of RAM is not enough for that. When blitting, the video engine copies the tiles underneath the content you are blitting into RAM (those are RAM tiles, of which Mode 74 can have at most 64, taking 2K of RAM), and draws over that. Mode 3 has a sprite number limit since it has a sprite abstraction over its blitter. Mode 72 is a very different mode with "more real" sprites.
rocifier wrote:
Fri Mar 16, 2018 12:47 am
- related to that question, can I squeeze more sprites out of the mode by making my sprites very small (eg. 3x3 pixels). I noticed the example includes one very large sprite (it looks something like 128x128 pixels).
You can't, a sprite is a 8x8 tile. However if you have large sprites, you can use tricks to reduce the count of RAM tiles taken for displaying them, one of these is laying out the sprite in a non-rectangular manner (Flight of a Dragon does that with the dragon sprite). However if you have very small object, in Mode 74, you may draw them pixel by pixel, which may require less RAM tiles than if you used a largely transparent 8x8 sprite tile. Mode 74 also has an automatic priority system for cases when you go over the RAM tile limit, dropping parts which most likely have the least visual impact (the Mode 74 demo shows it, when the full scrolltext and the balls are visible, if you take screenshots in the emulator, you may see missing parts, which are not noticeable in motion). If you refer to the dragon disc shape of the Mode 74 example, then that's not a sprite: it is background, which can display over sprites (you can also see that in Flight of a Dragon as you walk around in the cave).
rocifier wrote:
Fri Mar 16, 2018 12:47 am
- is there a better mode for doing the above in, assuming I don't want to use any vector rendering features?
If you want more sprites, Mode 72, but it has its own drawbacks. If you want higher resolution at mostly 16 colors, I have an experimental concept. If Mode 74's technique seems fine for you, then this is about the max which can be done at 16 colors (and the lower resolution is also better for larger coverage): the limit is RAM (the maximal 64 RAM tiles take 2K, half of the RAM of the ATMega644). Also there is a CPU limit for the blits, to have something like Flight of a Dragon's most intense situations, you need to plan with about 200 lines (such as 192x200) or less (as the more lines you give for VBlank, the more CPU power is given for blitting and anything else. Flight of a Dragon runs at 30FPS since in one frame it renders, in the other, it does all the game logic).

Mode 72 is great on that term too that it uses zero CPU time for generating the sprites & bullets, so if you want very intense action, then likely that's the best mode for you.

rocifier
Posts: 71
Joined: Thu Jan 22, 2015 6:35 am

Re: New Game Idea: Tower Defense

Post by rocifier » Sat Mar 17, 2018 9:35 am

Congrats Jubation on your 1024th post! To celebrate I bring you an ambitious concept of saving Japan:

Image

This relies heavily on being able to X mirror tiles. In terms of gameplay, you place a number of towers on the side platforms and upgrade them. The towers automatically fire at waves of spirits who try to pass.

CunningFellow
Posts: 1174
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: New Game Idea: Tower Defense

Post by CunningFellow » Sat Mar 17, 2018 11:04 am

320x576 is the aspect ratio of that picture.

If you scale that too 224 pixels Y then X ends up as <128.

Keeping 5clk per pixel for "square-ness" you could probably do a pretty intense video mode that had super wide black borders that gave you many extra clocks for sprite rendering.

User avatar
Jubatian
Posts: 1355
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New Game Idea: Tower Defense

Post by Jubatian » Sat Mar 17, 2018 2:27 pm

Thanks!

The image, however, if you intend to maintain resolution is too large (assuming using one screen). Mode 72 at most is 160x224, the pixel aspect ratio is 1.5:1 (or 3:2, so pixels are "fat", a 2x3 pixel block makes a square). A five cycles per pixel Mode 72 like mode would be possible, but it would have to be thin (still only 160 pixels wide, it would make an upright "window" with wide borders).

Maybe it would be better if you aligned the path of the attackers horizontally.

For creating the artwork, the Wiki contains some help (link), covering the subject of using non-square pixel aspect ratio proper (I wrote that article while experimenting for Flight of a Dragon).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest