CardChasm

Programming the 6502 microprocessor and its relatives in assembly and other languages.
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

CardChasm

Post by sburrow »

Hello everyone!

I've been working on a new NES game! I'm calling it "Card Chasm". The concept is that you are in linear dungeon fighting enemies along the way. To move, you use cards from a deck you have made. The same cards are used to attack, heal, and perform other abilities in combat. Defeating enemies gives you more cards to add to your deck. I'm modeling from an Android game I played some years ago, but taking a lot of personal freedom to make it my own.

The main challenge so far has been re-learning how the PPU works. It has been almost a week of engineering to get that 'walking' effect you see in the GIF. I'm using two nametables that have tiles slightly shifted, then switching between them as I scroll the camera slightly. I'm also using Sprite 0 Hit to get a HUD at the bottom, and cycle counting to disable the background rendering to remove left-over ugliness at the bottom of the screen.

For the enemies, I'm actually starting with some AI generated images from Perchance, scaling them to 64x64 and using only 3 colors (4 colors if you include the transparent background), then cleaning it up in GIMP. I'm getting pretty good at it by now, and I have made over a dozen enemies that look similar but have a different 'feel' to them.

There you have it. Lots of work ahead, but I'm having fun in 6502-land some more. By the way, local labels are a *game changer*! I'm writing everything in 6502 assembly and quite enjoying it because I can just label things like @loop1 or something and it's not a big deal anymore. Yay!

EDIT: I'm also posting this on the nesdev.org forum. You can find it here: https://forums.nesdev.org/viewtopic.php?p=306270

Thanks everyone :)

Chad
Attachments
CardChasm-Screenshot-1-4-26.png
CardChasm-Gameplay-1-4-26.gif
CardChasm-Gameplay-1-4-26.gif (1.95 MiB) Viewed 1109 times
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: CardChasm

Post by sburrow »

Hello again!

The game is certainly coming along. See attached!

On the right side, I can now select which card to use. The other ones slide to their new position, and more cards get put into the hand when you only have one card left.

On the left side, it indicates which places have enemies, and which are empty. If you land on an enemy place, they portrait comes up. Walk away and it goes away. In the future you would battle once you see an enemy.

For the tunnel, I tried *really* hard to make it look even better, but I ended up abandoning the complexity to go with what is simple. There are two palettes: ceiling and floor. The wall color comes from either one, and they all need to share the same accent color (here it is light grey). Not the best, but it will do for now. I think I can make some better textures that will really pop later.

Another milestone complete! Thanks everyone :)

Chad
Attachments
CardChasmNES-Screenshot-1-8-26.png
CardChasmNES-Gameplay-1-8-26.gif
CardChasmNES-Gameplay-1-8-26.gif (7.09 MiB) Viewed 1028 times
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: CardChasm

Post by BigDumbDinosaur »

sburrow wrote:
The game is certainly coming along. See attached!
What the heck is that creature I see?  :?
x86?  We ain't got no x86.  We don't NEED no stinking x86!
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: CardChasm

Post by sburrow »

BigDumbDinosaur wrote:
sburrow wrote:
The game is certainly coming along. See attached!
What the heck is that creature I see? :?
Hahaha! The original game I'm basing this off of used 'monster girls'. I'm intending on using more generic 'adventurers' in a way. When I was testing out processes and toolkit using the AI generated images, my specific prompt was "samurai girl with white hair and long sword" and so I have a lot of those right now :)

I tried doing it all by hand, like from scratch, but it just isn't as flavorful as when I do touch ups from the AI generated version. See attached.

I know you were joking BDD, but I felt like responding anyways :) Thanks for reading!

Chad
Attachments
Processed1.png
Processed1.png (2.04 KiB) Viewed 998 times
ByHand1.png
ByHand1.png (1.41 KiB) Viewed 998 times
User avatar
commodorejohn
Posts: 299
Joined: 21 Jan 2016
Location: Placerville, CA
Contact:

Re: CardChasm

Post by commodorejohn »

sburrow wrote:
I tried doing it all by hand, like from scratch, but it just isn't as flavorful as when I do touch ups from the AI generated version.
Hard disagree - even clumsy personal art is much more interesting to look at than generic machine output, and I much prefer your DIY example.
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: CardChasm

Post by sburrow »

commodorejohn wrote:
sburrow wrote:
I tried doing it all by hand, like from scratch, but it just isn't as flavorful as when I do touch ups from the AI generated version.
Hard disagree - even clumsy personal art is much more interesting to look at than generic machine output, and I much prefer your DIY example.
Hm! Well, thank you? I'm going to PM you in a few minutes.

Chad
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: CardChasm

Post by barnacle »

I have all the artistic ability of a bottom-dwelling catfish, but I too prefer your own work. I suspect it's because the generated version has fewer distinct lines in it, but more of an anti-aliased look.

Neil
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: CardChasm

Post by sburrow »

barnacle wrote:
I have all the artistic ability of a bottom-dwelling catfish, but I too prefer your own work. I suspect it's because the generated version has fewer distinct lines in it, but more of an anti-aliased look.
Neil
I suppose mine does have more distinct lines. But because of that, it seems 'boring' or flat. Though, mine is also more deliberate, and not just waving a hand at "impressionism" or something.

Thank you as well Neil, I'll be thinking over what you and John have told me.

Chad
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: CardChasm

Post by sburrow »

Alright, you guys got me curious. So what I did was look at the original image, then I set up a grid in GIMP and drew the black outline pixels wherever I personally wanted. Then I scaled, contrast, etc, to get basically want I wanted on a 64x64 grid. I then started colorizing it and adjusting pixels by hand. See attached!

I really want to be consistent, so I'm trying to find a fairly easy and, uh, consistent way to get similar results going forward. I don't want some of the art to seem "different". Gosh, on the last game I had only a 16x16 grid to work with, and that was infinitely easier to do! Now that I have more space to work with, it is SO much harder! :)

Thanks for the encouragement.

Chad
Attachments
CustomArtwork.png
User avatar
AndrewP
Posts: 368
Joined: 30 Aug 2021
Location: South Africa

Re: CardChasm

Post by AndrewP »

Nice, that's looking good!

I'm enjoying watching this progress, I just don't have anything useful to add but I hope you keep it up

Cheers, Andrew
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: CardChasm

Post by sburrow »

AndrewP wrote:
Nice, that's looking good!
I'm enjoying watching this progress, I just don't have anything useful to add but I hope you keep it up
Cheers, Andrew
Thank you Andrew, I appreciate it. This sort of thing motivates me :)

Updates (besides artwork):

1) I did a lot of wasting time trying to get that enemy portrait drawn without disabling rendering for a full frame. After three non-working solutions, I finally just went with something simple and it works fine. Essentially you can only draw stuff during the V-Blank portion of the screen, so I just drew the portrait information little by little spanning multiple frames. Easy (eventually).

2) I added titles while in battle. They will contain enemy name, health/status, and even some phrases they will say during battle. The original game has a pattern for each enemy, and they often say something to indicate what will is coming next.

3) I added attack and damage animations. There is a 'slash' that moves across the screen when attacking with a card. Then the enemy hits you, shaking the screen. I don't think it's perfect just yet, but you can see the basics of how it will work at this point.

4) I adjusted the font. I softened the edges using some unused palette color values to do this. I'm not entirely sure if I like this better yet, but I'm just experimenting at this point.

Some warning signs I am finding is that I'm quickly losing control of my variables. Many sub-routines use different 'flags' and 'counters' that are not explicitly set by that sub-routine or anything like it. For example, I have "enem_move" which has how many places I have left to move forward. As I walk forward, it decrements to zero. When it's zero, I'm not moving. When I'm in battle, I keep it zero because I shouldn't be moving. When I use a card with zero movement though, I am indeed not moving, but because I'm also keeping it zero while in battle, the slash animation starts up. So I put in other flags or conditions so that doesn't happen, which starts to complicate the logic.

Looking at the future, I have to decide to leave what I got or try to re-write stuff. All in all the main part of the game is quickly finishing up, and after that I'll just have menus and other things which are completely unrelated to these variables. However, if I want to add more stuff later (aka polish), I should probably start thinking of some more 'universal' flag and counter system.

There's the updates, thanks everyone :)

Chad
Attachments
CardChasmNES-Screenshot-1-11-26.png
CardChasmNES-Gameplay-1-11-26.gif
CardChasmNES-Gameplay-1-11-26.gif (3.31 MiB) Viewed 843 times
teamtempest
Posts: 443
Joined: 08 Nov 2009
Location: Minnesota
Contact:

Re: CardChasm

Post by teamtempest »

Have you perhaps considered using a state machine for your main logic? That way you have to worry about only one thing, the current state. That state "knows" what it needs to pay attention to and what it doesn't. Plus of course how to transition to a successor state depending on what happens while in this state. Plus it's fairly easy to add more states without unnecessarily complicating everything that already exists.

Just a thought.
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: CardChasm

Post by sburrow »

teamtempest wrote:
Have you perhaps considered using a state machine for your main logic?
Actually I was thinking of something like that last night! The idea is pretty straight forward, have one single variable for a 'state' and then use it like a switch-case essentially. Quick example:

Code: Select all

LDA game_state
BNE @next1
; game state one functions
@next1
CMP #$01
BNE @next2
; game state two functions
@next2
...
I think mine would be a little different, where I call all of the sub-routines, but at the top I do something like:

Code: Select all

my_sub_routine
LDA game_state
CMP #$67
BEQ @continue
RTS
@continue
...
I know that would waste more CPU cycles, but given the existing code of the game, I think this would be the easiest to work in. Also, I don't have to remove any of the current checks on other sub-routines right now, just do one at a time. If it works, great. If it breaks, fix it now.

Thank you, I should post my code here when I'm done with that :)

Chad
User avatar
gilhad
Posts: 85
Joined: 26 Jan 2024
Location: Prague; Czech Republic; Europe; Earth
Contact:

Re: CardChasm

Post by gilhad »

Also, if you are having one state switch, you can make it to be just jump_table, so instead of lot of cmp #... you just jump to address at table[state] :)
User avatar
commodorejohn
Posts: 299
Joined: 21 Jan 2016
Location: Placerville, CA
Contact:

Re: CardChasm

Post by commodorejohn »

gilhad wrote:
Also, if you are having one state switch, you can make it to be just jump_table, so instead of lot of cmp #... you just jump to address at table[state] :)
^ That. Turns the dispatch into a constant-time operation instead of an O(<= N) one, and allows you to separate the state routines from the dispatch completely.
Post Reply