New demo uploaded: Pirate Kingdoms

All aspects of programming on the Commander X16.
rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

New demo uploaded: Pirate Kingdoms

Post by rje »


My first steps will be careful ones.... I've never done sprite programming using CC65.

 

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

New demo uploaded: Pirate Kingdoms

Post by rje »


Updated with some more vision statementy things.

 


I. A PRETTY MAP



  • Rounded coastlines, no overlapping sprites.




II. AN ECOLOGY



  • (1602) Terrain squares have their own characteristics, which define what can be grown on them.


  • (1602, 7 Cities of Gold) Settlements produce people, supplies, ships, trade goods.  Some are better at self-defense.  They can be owned, and can rebel.





  • (7 Cities of Gold) A "soft empire" model, based on relationships between settlements.


  • (1602, 7 Cities of Gold) Establish and dismantle settlements.


  • (Pirates, 7 Cities of Gold) Barter with or plunder settlements.


  • (7 Cities of Gold) Explore.


 

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

New demo uploaded: Pirate Kingdoms

Post by rje »


OK, replaced the BASIC version with the C version.  It's more responsive, but the scrolling is terrible.  Also I don't like the way I did the map.  I have to rethink things and use fewer sprites if possible.

 

For example, I use sprites to tile the ocean.  I shouldn't have to do that -- surely I can just use characters to represent the ocean.  Like a reverse period, or something. 

Then, the land sprites themselves are memory hungry.  Each one is 64 x 64 and 8 bit pixels -- 4K!  Oink!  

I think I need to go back to using "coastline" sprites for the edges.  8 x 64 and 64 x 8 sprites.  We'll see.

 

And even after all that, there does appear to be an obvious redraw going on when the ship moves: the sprites appear to stagger.  In other words, C is not fast enough.

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

New demo uploaded: Pirate Kingdoms

Post by SlithyMatt »


Mainly, you need to make sure you are doing the scrolling during VBLANK by putting it at the beginning of your VSYNC interrupt routine. That should clean it up a lot.

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

New demo uploaded: Pirate Kingdoms

Post by rje »



On 1/26/2022 at 9:36 AM, SlithyMatt said:




Mainly, you need to make sure you are doing the scrolling during VBLANK by putting it at the beginning of your VSYNC interrupt routine. That should clean it up a lot.



You can do that in C?

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

New demo uploaded: Pirate Kingdoms

Post by SlithyMatt »



On 1/26/2022 at 2:08 PM, rje said:




You can do that in C?



I should hope so! You may just need some inline assembly to overwrite the IRQ vector with a function address, but you may be able to do that in pure C. 

pzembrod
Posts: 94
Joined: Sat Aug 29, 2020 9:21 pm

New demo uploaded: Pirate Kingdoms

Post by pzembrod »


You could also develop this in the direction of the Flying Spaghetti Monster game - fsmgame.com

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

New demo uploaded: Pirate Kingdoms

Post by ZeroByte »


I forget exactly every step I did in Flappy Bird, but it does IRQ handling in C.

Basically, I made a #define that makes the IRQ vector in RAM ($030-something)  so it looks like a variable, and then I did an inline assembly to SEI, then IRQ_VECTOR = &irq_handler;

Something akin to that.

User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

New demo uploaded: Pirate Kingdoms

Post by svenvandevelde »


Very nice demo. Curious how you created the dynamic tile algorithm.

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

New demo uploaded: Pirate Kingdoms

Post by rje »



On 1/29/2022 at 4:09 AM, svenvandevelde said:




Very nice demo. Curious how you created the dynamic tile algorithm.



I overlapped the sprites significantly -- 8 pixels on every edge I think.  

The result was absolutely horrible refresh.

 

Today I got rid of the overlap and reverted to plain square sprites instead of ones with contoured shorelines.  It looks uglier but moves MUCH MUCH smoother.

The current view is only a bit more than 5 x 6 "squares".  I also added a regional map view -- typing 'm' draws a 50 x 50 PETSCII map.  That helps get my bearings, so to speak.  I might instead just have a 20 x 20 mini-map on a corner of the normal view.

Post Reply