Making NES Kung-Fu

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
Post Reply
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Making NES Kung-Fu

Post by uze6666 »

Note (3/30/14): This thread was moved from the UCC2014 forum because it has somehow become off-topic. The original topic was of making a tutorial for newbies. I have re-started a new tutorial that can be found here: http://uzebox.org/forums/viewtopic.php?p=12749#p12749
User avatar
schepers_cp
Posts: 125
Joined: Tue Feb 04, 2014 9:48 pm
Location: netherlands
Contact:

Re: Tutorial: How to make a game!

Post by schepers_cp »

wow, this is what i have wanted for so long, a good tutorial explaining almost all aspects (since i didn't know where/how to start at all)
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Tutorial: How to make a game!

Post by uze6666 »

I never actually played Flappy Bird and quite frankly after a couple views on youtube I can't find why there's so much hype about this "game". Too simplistic, no music, too hard one endless level...is that it? I guess the net was due for another meme. Not so sure I want to spend time on this game unless there's interest in the community.

And this is the point when starting a project like a game, and specially for the first time: pick one that is simple and...that you really like! As a first game, the easiest is usually a port of an existing NES game since you'll have a lot of resources already "done" (gfx and music). Again not all games can be done on the Uzebox due to the hardware and limited resources. In this tutorial, I'll drive you though my though process on how you can pick a game that is feasible and develop it.

So let's go for a port. You will first need to search the net if graphical and music resources are available for the game you have in mind. Sites like http://www.spriters-resource.com/, http://www.nesmaps.com/ and http://tsgk.captainn.net/ are good sources for sprites, graphics and maps. Zophar is the source for NES music. NSF files are NES music files that can be converted with a special tool to MIDI files which can be edited and tweaked before finally being converted to the Uzebox music format.

For me, music is usually very important and is often one of the first thing I implement. In my Castlevania demo, after a couple hours of coding, I would put back the game music for a while to keep energized! So I need a game with music, that I enjoyed when younger, fun, technically interesting and not too hard to develop. After a couple minutes on Zophar, I may (I say may!) have found something interesting that foots the bill: Gauntlet! :mrgreen:
Image

Let's study the game. I don't plan to implement a perfect clone with all the levels and enemies, but the map structure and AI are very simple and I always loved the music. A couple things I noted:
  • The game is based on 32x28 metatiles maps (one metatile being made of 2x2 regular tiles, themselves made of 8x8 pixels).
  • Screen uses smooth scrolling, so we will use video mode 3. Mode supports sprites and scrolling with a resolution similar to that of the NES.
  • There's a hell of a lots enemies moving at once. But the trick is they are made of background tiles just like the treasures and other artifacts. The only sprites are the player(s) themselves and their weapon. Players are made of 2x2 sprites and the weapons a 1x1 sprite. So a player consume up to 13 ramtiles (13x64 bytes=832). A first, we could have two players with RAM left for the rest. We'll see later.
  • The NES has 100 maps, so that would require 89K for maps alone without any compression. Way too much for the Uzebox. Either reduce the map count or use the SD card interface. If using the SD interface I would want to load the whole map at once so I need 32x28=896bytes...so there goes player 2!
  • Hard to say how many objects can be on one level at once (including enemies). But so far we consumed 832+896=1728. If we add the VRAM (1K) and the kernel overhead(~300) and stack (~100), that's ~3150. So we have about 940 bytes of RAM of the game logic. Say an object will have X,Y and attributes, so 3 bytes. 940/3=313. Naturally we still need RAM for variables and other stuff, but it appears we could easily have between 128-256 objects and enemies at once on a game map.
  • Background tile budget will be hefty considering the enemies and the different color scheme in levels. One limitation will be that all floor will be gray since we don't have palettes in mode 3.
  • Not sure there will enough flash for more than one character. I'd probably pick the elf.
  • Music and sound effects can all be done on the Uzebox but the game also use samples. Not sure there will be enough flash for those.
  • Since we don't have a map editor for such games, I'll have to write a tool.

Perhaps I didn't pick such a easy game after all! :lol: I'll sleep on it. If you guys sees other game candidates for such a tutorial, feel free to let me know.
User avatar
schepers_cp
Posts: 125
Joined: Tue Feb 04, 2014 9:48 pm
Location: netherlands
Contact:

Re: Tutorial: How to make a game!

Post by schepers_cp »

why don't you go with a game like 2048? way easier for starters to understand by coding, how to implement game logic, and how collisions work (you can add sounds too ofcourse :P ) ( http://gabrielecirulli.github.io/2048/ )
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Tutorial: How to make a game!

Post by uze6666 »

schepers_cp wrote:why don't you go with a game like 2048? way easier for starters to understand by coding, how to implement game logic, and how collisions work (you can add sounds too ofcourse :P ) ( http://gabrielecirulli.github.io/2048/ )
It's a nice little puzzle game. :) But I really wan't something showing the Uzebox possibilities with scrolling, sprites and music.
User avatar
schepers_cp
Posts: 125
Joined: Tue Feb 04, 2014 9:48 pm
Location: netherlands
Contact:

Re: Tutorial: How to make a game!

Post by schepers_cp »

that might be the case, but i think there are currently quite a few starters (including me :oops: ) in the uzebox environment who has no clue where/how to start game dev, so a small project might get them on the right tracks~ :)
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Tutorial: How to make a game!

Post by nicksen782 »

So, I actually found a copy of Flappy Bird and played it for a bit. Very simple game with very simple mechanics. Tap and the bird goes up. Don't tap and gravity takes over. There is no "floating" at the peak of a flap, you just go right down.

So, Mode 3 with scrolling? Is a map actually needed? I mean, why not have the maps auto-generate based on some math. It would control the length of each pipe and each pipe would be capped with the end of pipe tiles. Simple VRAM collision checking would probably be enough.

If maps not auto-generated then static maps could be stored. The Uze Mario demo by Uze shows that a rather large map can still be stored in flash. No SD card needed.

Is anybody currently making a Flappy Bird port?
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Tutorial: How to make a game!

Post by uze6666 »

Flappy Bird is pretty straight forward and technically you don't need maps. But that's a thing I would change (like many clones) to keep interest and provide a sense of accomplishment. I'd have multiple levels with say 20-40 pipes each, growing harder on each level (with continues). Levels "maps" could be stored as very simple structs like [distance to next pipe][top pipe height][bottom pipe height]. So indeed, no need for SD or anything. A full scrolling screen would be the easiest thing to do, but it's also possible to use ramtile effects to have a static background just like the real game. Then more twists could be added like moving pipes and perhaps piranhas flowers (like in SMB) getting out of pipes! :P

Obviously I got carried over with Gauntlet ( somewhat easy after a few beers :lol:)! So a simpler game like this is probably a much better choice.
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Tutorial: How to make a game!

Post by nicksen782 »

I'm at a temporary impasse with my contest game. I have to create some tools and study for the rest of the game's planning. Don't worry, I intend on finishing it by the contest end.

So...
Meanwhile, it would be pretty cool to finish up a simple little game like this. I've actually already started to make graphics assets. I put the game on Bluestacks (Android emulator) and took some screen captures of parts of the game. I am shrinking the graphics a bit to fit as the bird is over 56 pixels wide (changing it to 32x24). The tool 'Wink' on PC helped me to get all the bird frames. Of course, the bird rotates too so that will probably be additional graphics asset cost. Probably not a big deal.
Last edited by nicksen782 on Fri Mar 28, 2014 6:43 pm, edited 1 time in total.
User avatar
D3thAdd3r
Posts: 3222
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Tutorial: How to make a game!

Post by D3thAdd3r »

I had to check out a video of this game everyone is talking about...never played it but...meh :lol: I would probably like it a bit if it was on Uzebox though.

<sidetrack>Gauntlet stores the entire level in NES vram and I think thats the only practical way to do it. That way you dont have to keep track of individual enemies which we dont have ram for. Unfortunately they store it in vram as 64x60 tiles, and I think we need the whole 8 bits per tile, which comes to 3840 so we don't have ram for that either :( I spent a day theorizing and attempting to find a way to make it work but I couldn't see any that retains original behavior. If there is a way to do it, it's definitely not for rookies!</sidetrack>

I think this one would be both "easy" and show off Uzebox capabilities. And it's a mildly fun game worth a playthrough. Not sure if people would get into the project or notImage
Post Reply