Diary of the Exploding Fist

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Davie

I'll try and put updates here.

Today I moved the Squarebergs prototype code to a new project for a fighting game. I called it 'wotef' for obvious reasons. I'm not actually writing a fighting game at this point, but I have enough code/demo going that I wanted to keep the current state for future dabbling.

Here's a video of the current draw systems. They're clunky and horrible graphics, but I think with some hand-tweaking rather than auto-scaling from much higher resolution, it might look OK.


Andrew Davie


I've been "struggling" with how best to include player movement (for example, when doing a somersault). Normally I'd put centerpoints under the center of mass of the object (i.e, between the feet in standing/walking frames). This works OK, but when a jump comes, what then?  Should I "hardwire" the centerpoint so the object is somewhat in the air?  No.  But only from testing.

Essentially I need to put the frame centerpoints on the center of mass of the objects, and then use code to change the object position (x,y) so that things look good.  So, I'll do that.

Many years ago - BITD - I developed a system I called the "reel system" which allowed combined player logic with player animation and movement. I thought it was pretty cool. Only many years later I found out that my fellow programmers - well at least some of them - ridiculed it behind my back. Hi Trevor.  Not to worry, we were young and making things up as we went.

I also recall having quite the big disagreement with Gregg Barnett about how the controls should work. In my version, you triggered a move and it went to completion - that's how the reel system worked, pretty much. But Gregg's original implementation of WotEF allowed you to "back out" of moves by holding/releasing the button.  He was right, of course - it's a much better way to do things. But at the time I had my "beautiful" hardwired system that made progammming easier.  So we all learn, and here I am 40 years later (!!) doing it Gregg's way.

I'll be developing the player logic/animation as independent C routines rather than "tokenised" arrays of commands/frames (per the reel system). It will be an interesting diversion from the way I've pretty much always done it before.

So here in this vide we just see cycling of the somersault animations -forward and backward - around the center of mass, as discussed. Seeing frames working together with correct relative positioning does somewhat improve the look/feel of things.

I have a few things to do. First, I've been really enjoying working with the JetBrains AI code assistant. It's really quite sobering/enlightening to see some of the things it finds. But it also seems to "understand" what's going on in the code... although I do know it's "just" a LLM next-word-completion statistical know-nothing bit of code. But still.

I do have one thing I need to do - drawing mirrored frames. That involves flipping the graphics for each sprite strip, and inverting the sprite strip offsets. Hopefully not much more. Intuitively I think the systems written so far will make the addition easy enough.

Also one other thing in this video - I brightened the 3 pCC colours, and it does look nicer to my eye.




Andrew Davie

#2
Some animation sequences in. Working on having an animation control sequence and joystick/"AI" control going. Once that's in, rudimentary fighting will be there.



I'm pretty sure I have a bug in my sprite sheet isolation tool, and it's not grabbing whole frames properly. I may spend some time diagnosing/fixing that.

Andrew Davie

#3

OK, so really primitive but semi-functional joystick control.
Left/Right to walk.  Up to flip forward. Down to backflip.

I implemented the software sprite *mirroring*, so that side of things appears to be all complete and functioning properly. I think a necessary/interesting thing to do next would be to implement "high res" heads. I looked at the frames, and no frame needs a head wider than 8 double-size pixels, so that would fit into a single double-size sprite. That would allow me to have two fighters with hi-res heads (P0/P1). I did some mockups of the hires-heads, and they were not-too-bad... especially compared to the blocky ones in use now.

I'm quite keen to open-source the code - but unsure who if anyone would actually bother looking at the github repository. For now, if you're interested, send me a PM with your github id and I'll give you access. I'd be delighted for people to go through it and comment/fix/suggest.


Andrew Davie

One thing I have noticed - and will use - is that putting the player sprite over non-black background goes a long way to masking the very low resolution. Your brain (or mine, at least) does an effective job of interpolating smoother graphics. Combined with high-res heads which I'm planning, things may not look too bad (when the placeholder graphics are replaced, at least). And, for what it's worth, even the horizontal motion doesn't look super-klunky.

Andrew Davie

I've added a delta (speed) to X/Y movement, independent of the animations. So the jump part of the flip is effectively using "physics" which means it's much smoother, moving every TV frame instead of every animation frame.


Andrew Davie


Plodding along. A bit of a rewrite of the animation system. Now I have 4 bytes per frame;

frame, dX, dY, duration

The dX and dY are applied on the first frame and are persistant until changed at some later point. It's rudimentary but does allow me to get a semblance of joystick control happening. In the video I'm just moving around with the joystick.

Very unsure if I should proceed with this. I'll just keep adding stuff until I get bored, I guess. It's a pretty old-school type of game, probably considered not much fun these days.

Andrew Davie

#7

In this installment, I added rudimentary "AI" to the second player. So now you can kinda see how the game would look with fighters doing stuff. Very interesting that the constant movement of the computer player (and the human player when commanded to do so) is actually a good thing - it improves the visuals and makes it less blocky.  Yes, it's still terrible... but I'm experimenting here!

Bomberman94

Is it possible to halve the height of the characters - with this size some games might be feasible?!

Andrew Davie

Quote from: Bomberman94 on 22 Jan 2026, 03:17 AMIs it possible to halve the height of the characters - with this size some games might be feasible?!

Tradeoffs. Yes, you can 1/3 the character height, but you can't use 'pCC' - you have to use iCC.
iCC has the 'shimmer' which is 20Hz frequency.  pCC is 30Hz, although indetectible in Stella and Gopher.
Some of the 3D demos I did were in single-line iCC, for example...


I could of course go the full 3D- route and render a fighting game in 3D. But I just find CDFJ so much easier. It's a matter of scale; 3D-for-everything would be possible. But I'm way too lazy to do that.

Andrew Davie

Gonna rename it from WotEF (way of the exploding fist) to just Way of the Fist, and the acronym will be "WTF". Seems appropriate.

In this installment I've added the particle system. This is the ability to draw a 'dot' anywhere on the screen. Well, about 50 of them actually. It's a well-used system from prior games/demos and can be quite handy as it's simple to use and gives some nice effects.  In this game, think of sweat blasting off a player's head when he's kicked in the face.


I've had some thoughts on a few topics related to what to do next. There's collisions, of course, and the hires-heads. I plan to solve both of these by using 'layers' in the source graphics images. I have a sprite sheet with all the frames, and a manifest file that gives names to those frames. The tool that sepaarates and processes those frames also automates the center point of each by reading a pixel on a layer called, of all things, 'centerpoints'.  One issue I did come across was that because the sprite sheet tool separates out all frames which are black-surrounded, it produces a minimal-size image for each of the separated frames. This is good. However, if I want the 'centerpoint' outside the normal extent of the frame - well, it can't do that.  It's actually not a dealbreaker, but it does make some things (like the crouch, which is broken in this version) a bit more difficult because I have to manually adjust the height of the player when animating.

So, one of the aforementioned things I thought about was adding hi-res heads; how am I to do that?  And I figured i"d do it through another layer "head" which will have a non-zero pixel at the attachment point of each frame. The draw system will plonk the appropriate hires head with *its* centerpoint located at the head attachment point of the frame. That will work. I'll need to figure a way to associate *which* head with *which* frame, but I'm thinking just naming the head frames with the same name as the body frames in the manifest will work OK.

Next up is collisions; I've been thinking how to handle those, too. And it seems that yet more layer(s) is the answer. I'll have more than one, so each layer can have a specific meaning. E.g., I could draw a box around the head area on "head-hit" layer and the tool would produce a collision box from that data. The game would cycle through all attacking collision boxes in a frame against all "i got hit" collision boxes in the opponent. The type of the box (based on the layer name) would tell us what to do.

That's all for today.

Andrew Davie

I have previously mentioned "the reel system", a tokenised control system for player/AI logic in a game. I've used it all my life, practically. I've decided to do it differently for this game; the shorcomings of the reel system are painfully obvious and have been discussed.

This time I'm using a dedicated routine for each move. Each move also has a state system, so there's an init state, a mid-move state, an exit state, etc.  This allows me to easily, for example, allow an abort-out of a move.  In the attached binary there's an example of this.  FIRE+RIGHT = kick. Basically hold the fire button, press RIGHT. If you let go, the move aborts (actually it reverses the animation so your foot goes down nicely).  If you HOLD the button your foot stays extended. I must admit it's a more natural feel.

So in the attached binary I'm just working on getting the player controls/moves installed. I have walk left/right (LEFT/RIGHT), crouch (DOWN), and jump (UP) at the moment. In my completely unbiased opinion, it does feel much better. Actually it's already quite "fun" just to move around and jump/crouch/kick.

Andrew Davie

Rudimentary "fighting".


Use button+forward direction to kick.
UP to jump
DOWN to crouch
LEFT/RIGHT to move

Computer opponent will react to your kicks by backflip, crouch, or jump.

It's not an actual fight, but it's starting to feel like it. If/when the graphics are improved, it might not actually be so bad. Who knows.


Bomberman94

Wow plays very fluently - has a good feeling while steering and jumping!

Andrew Davie

I worked on some colour differentiation between the players. These sprites use the same source graphics, so I have limited options - but here I have managed to get very distinct colours. I don't mind it so much - it's better than just black and white.


I've started hand-retouching some of the frames (in particular, the last frame of the kick, and some attention to the shirt on the walk).