Jump to content
rje

New demo uploaded: Pirate Kingdoms

Recommended Posts

Pirate Kingdoms

View File

A demonstration of the use of BASIC, sprites, and banks to create a tiled map.

Everything is quite primitive right now.  The response time is slow.

The map is 256 x 256 and stored in banks 10-17 (it's 64k).  My plan is of course to make it larger.

Use the cursor keys to move about the map. 

 


  • Submitter
    rje
  • Submitted
    02/16/21
  • Category

 

  • Like 1

Share this post


Link to post
Share on other sites

Cool! I didn't pay attention to your warning and went to the edge, and caused a bad subscript error. Whoops! 😜

Share this post


Link to post
Share on other sites

The map drawing routine is my target.  If I put it in assembly then ... well it'll be superfast.

rem dx,dy is the top left corner of the map view
bb=0 :rem this prevents us from POKEing the bank every loop
for r = 0 to \rows-1
   y = dy + r
   y3 = int(y/32) :rem each RAM bank has 32 rows
   ba = 10 + y3   :rem there's our bank number
   if bb <> ba then bb=ba :poke $9f61,ba
   yy = 32 * (y/32-y3) :rem y mod 32

   for c = 0 to \cols-1
      x = dx + c

      la = peek($a000+yy*256+x) :rem tile value
      bk=l1(la) :rem MSB for sprite block
      ls=l2(la)  :rem LSB for sprite block
      s0=s0(r,c) :rem cached sprite address offset
      vpoke $f, s0+0, %00000000 + ls
      vpoke $f, s0+1, %10000000 + bk
   next c
next r
return


 

First, the code is a mess.  It's very busy, and seems to be inefficient for simply updating a map.

The data required to update any one tile is:

1. The correct bank and offset of the data.
2. The MSB value to poke.
3. The LSB value to poke.
4. The sprite's register offset.
 

Share this post


Link to post
Share on other sites
19 minutes ago, kelli217 said:

Cool! I didn't pay attention to your warning and went to the edge, and caused a bad subscript error. Whoops! 😜

Off by one I suspect.  Thanks for finding it! 

Ah, that's a "bug" with my map, not the code.  The first two bytes used to store the map dimensions, causing your error.  I'll upload a new map.

 

Edited by rje
  • Like 1

Share this post


Link to post
Share on other sites

Updated with settlements... sort of.

Buggy settlements.  I'm still working out how I want to do the sprite offsets there.  I figure if I can do half-height offsets, I can get twice the number of unique settlements.

 

Edited by rje
  • Like 1

Share this post


Link to post
Share on other sites

Pretty cool looking for a basic program!

The long initialization phase, is the program creating tiles on the fly or something?  Instead of loading bitmaps?

Share this post


Link to post
Share on other sites
On 2/17/2021 at 7:52 PM, desertfish said:

The long initialization phase, is the program creating tiles on the fly or something?  Instead of loading bitmaps?

Right, it loads the tiles into banked RAM... and then POKEs them into VERA.

I *think* I can load directly into VERA -- right? -- so I should be doing that!

Share this post


Link to post
Share on other sites
Posted (edited)

Here's things I want to do:

Migrate the code to C (because I know C)

Then...

  •  Improve the map (because... ugh)
  •  "Exit" the ship for land travel.
  •  "Board" ships for sea travel.
  •  Interactions with settlements.
  •  Interactions between settlements.
  •  New settlements.

Then I can start thinking about events that bring a little Dwarf Fortress feel to things.

Edited by rje

Share this post


Link to post
Share on other sites
Posted (edited)

Now that Core War is 1.0.0, I've started thinking about Pirate Kingdoms of the Rhylanor Coast.

In C, of course.

 

I. A PRETTY MAP

First, I need a pretty map.  The current map is ugly.  So I need rounded coastlines.  OK.

 

II. AN ECOLOGY

  • Settlements.  Depending on the type of land and size of settlement, they may grow, have Food (smaller settlements), Gear (larger settlements), and Ships (on the coastline).
  • Settlements interact with local flora, fauna, and other Settlements. Their size and gear rating determine the Settlements' radius of influence.  Thus Cities with excess Gear have the largest influence and can be very powerful.
  • Fortresses. A special kind of Settlement geared for defense.
  • Gear is an economic multiplier.  It stretches out your Food supply.  It makes you more effective in battle.  Gear builds and maintains Civilizations.  A prolonged loss of Gear production causes Settlements to fail and Civilizations to fall.
  • An established City may revolt and break off of a Civilization if there are prolonged problems.

III. PLAYER ACTIONS

Your Group can:

  • barter with Settlements for manpower, food, gear, ships -- if the settlements don't have a bad opinion of you.
  • or attempt to plunder them.
  • establish Settlements with an initial investment of manpower, food, gear, and ships.
  • be a "Primitive Wandering Bandit team", subsisting on trade and plunder.
  • be a "Leif Ericsson" band, arriving in ships to settle in an unknown land.

 

Edited by rje
  • Like 2

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
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.

Guest
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.


×
×
  • Create New...

Important Information

Please review our Terms of Use