Jump to content

Same sprite, different colours

Recommended Posts

I had a few hours today to continue with my experimentation. Today I'm wrestling with a problem regarding 160B sprite colours.


I have a spritesheet with 16 frames (each one for an airplane's direction of travel), a bit like the old 2600 game "Combat". Total size is 16x256. I found this more efficient for setting the colours up (take the pain once!)


I can load the sprite sheet in and set the 6 colours being used (basically palette 0 and 1) no problem, the sprite looks good and as expected. I even added a few 160A cloud sprites to keep the airplane company.


So far so good!


I now want player 2 to use the same identical sprite but I want to change two colours (the camouflage) to differentiate it from player 1.


Now usually when I want to move colours about, I can do it when I load the sprite with incgraphic and switch a colour index. However if I'm only loading the sprite once then this option wont work.


This is what I've come up with by way of options :


Solution 1 Load  a second copy of the sprite and change the colour registers for those two colours to point and two others. This would save palette 4 (second 160B palette) but would use a lot of memory on what is essentially a duplicated sprite. So I guess this would work but it's not very elegant and wastes space.


Solution 2 : Use 160B palette 4 for player 2 so I use up palettes 4 and 5 (out of 4,5,6,7) just to change two colours. Again, it works but it uses basically 2 whole palettes but saves having to load a second copy of the sprite. Currently this seems to be the lesser of two evils and is what I'm using.


Solution 3 : Draw player 1 and then change the palette entries for the two colours for player2 before the drawscreen. I can't get this to work in the same frame.


So right now i'm using solution 2 but I'm open to suggestions if there is a more efficient way to achieve changing two colours.





Edited by Muddyfunster
  • Like 1
Link to comment
Share on other sites

This clip shows what I've got so far. This is the first time I've used spritesheets and the frame parameter on plotsprite.


I also discovered "framecounter" when working through the samples. This is super helpful but not documented that I can see.


I was fully working on converting Dare Devil when I got side tracked by the "spacephysics" sample, that got me thinking of Space War and Combat.


The idea with this tinkering / demo is to work on understanding inputs and screen / sprite management as it's a bit different to Bb. Ultimately if I turn it into a game, I want to add some other aircraft (player choice, maybe choose the camo colours) and also speed up / slow down and firing. Like I said, it's shamelessly aping Combat :)


Excuse the poor quality flying, i'm not very good at flying 2 planes at once, one handed :)








Edited by Muddyfunster
  • Like 10
Link to comment
Share on other sites

3 minutes ago, Trebor said:

Looks like Two Tigers with a Time Pilot behind the controls. ?


The planes themselves look great...the clouds provide the amazement and depth of field...awesome job!

Thanks @Trebor,


I was going for F16 Falcon as the look for the sprites as it's one of my favourite aircraft, but the sprites do also look a bit like the F5 Tiger :)



  • Like 1
Link to comment
Share on other sites

Looks great!


Solution 3 isn't really an option. The color registers aren't used when the display object is built in ram (which is what the plot* functions do) but rather when the object is drawn on screen. For that to work you'd need to race the beam 2600 style, which you could technically do, but it would be extremely wasteful of CPU for a small bit of benefit, and complicated in zones with more DMA happening.


Solution 2 is the usual way to do it. It seems wasteful for 160B, but in the end you only waste the palette entries that are actually common for each plane. The other indexes that aren't common and/or not displayed can still be used for other objects.


As you've discovered, on the 7800 palettes are another resource to manage, just like RAM, ROM, and CPU time.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

10 hours ago, Jinks said:

Is there any way to make the planes turn not jerky at all? Not that it matters too much..

Btw this looks very cool..

@Jinks thanks for the feedback re the plane motion. It's something I was wrestling with a bit as I was going for the feel in "Combat".


Making the plan turn more smoothly could mean adding more frames of animation (if that's what you mean, the transition between directions?).


Right now there is a frame for each direction (16 in total). Adding more steps would be a bit challenging as there isn't a whole lot of vertical resolution in the sprite (16x16). Between facing left and facing up, there are 3 frames, 5 if you count left and up. So the logical progression of that would be +16 more frames to represent more steps in between the directions we have already. The trade off is that would double the size of the spritesheet for the plane (and mean a lot more work drawing 16 more frames!). The plane can't flip between directions too quickly otherwise it would feel like the ship in asteroids.


Right now I'm just experimenting with the language but I do like the idea of a "Combat Remastered". I was originally just thinking of an airplane game for a bit of fun to help me learn more about sprites and collision, but the tank part could be addressed also along with all of the different modes and variations. I'll keep sharing updates and we'll see where it goes but I can't promise that I won't get another idea to try something and run off down that rabbit hole :)

  • Like 6
Link to comment
Share on other sites

1 hour ago, SlidellMan said:

So, what kind of weapons do you have planned for the players?

If I was to develop this into a full game (*if*), for the airplanes I'd probably go with the tried and tested formulas for Combat and the various 2600 remixes.

  • Single shot unguided
  • Single shot player guided 
  • Rapid fire but short range and unguided?
  • configurable bullet speed maybe? (fast or regular).

Not sure a missile system would really work and probably detracts from the essence of "Combat".


Thinking about this some more, there are a whole bunch of things that could be added, just to the air section alone, to make for a varied set of selectable options for players to tailor the experience.

  • Clouds on/ off / number of clouds, size of clouds, moving clouds etc.
  • Weather / time of day differences, night time for example.
  • selectable camo colours for each aircraft.
  • health bar, timed game or first to X kills.
  • unlimited or limited fuel for the speed up (make use of the speed boost more tactical).
  • unlimited ammo or limited ammo or ammo takes time to replenish once exhausted.
  • night time mode where the players are invisible but you can use a radar pulse on the second button to light up the other player for 3 seconds or something

Equally the "Tank" variant could have a lot of options and variety too, some of which @RevEng touched on above.


I even have some ideas for a gunboat section and maybe a submarine section.


I'm going to see how it goes :), the ideas and feedback though are always appreciated!


  • Like 3
Link to comment
Share on other sites

Clearly you're head and shoulders above me in the art department, but in case it's handy as a base, here's a 3 color tank with 40 rotations. I put it together as a sort of test when I was creating sprite sheets, as I was curious how many distinct rotations you could get into a 16x16 tank sprite. It's a bit more tron than realistic, and It's squashed, but in this case the squash makes sense with the tank perspective. Anyway, use it or not, as you see fit.






  • Like 6
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...