Starfield demo

Talk about programming CreatiVision (except games programming). Projects of homebrew hardware are also welcome.
User avatar
TBCTBC
Posts: 64
Joined: Wed Mar 13, 2013 1:27 pm
Location: Solna, Sweden
Contact:

Starfield demo

Post by TBCTBC » Fri Apr 05, 2013 7:57 pm

Ok, I didn't think I would be able to finish this fast, but here's that starfield demo with source code I promised.
My first program for Creativision :)
You do not have the required permissions to view the files attached to this post.
User avatar
Mobsie
Posts: 709
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Starfield demo

Post by Mobsie » Fri Apr 05, 2013 9:57 pm

Hi,

very nice, thank you.
User avatar
MADrigal
Site Admin
Posts: 1191
Joined: Sun Sep 15, 2013 1:00 pm
Contact:

Re: Starfield demo

Post by MADrigal » Sat Apr 06, 2013 6:47 am

Thanks a lot. Very nice indeed!!! :-)

I'll try to study the source code asap. :-)
User avatar
TBCTBC
Posts: 64
Joined: Wed Mar 13, 2013 1:27 pm
Location: Solna, Sweden
Contact:

Re: Starfield demo

Post by TBCTBC » Sat Apr 06, 2013 8:04 am

I'm actually not using the same method as I did in Photon. Before I used 128 characters for stars, because I only used sprites for the rest of the game. Here I only use two, because in Photon 2 I'm going to have software sprites, so I needed a different approach. As you see, it also takes a lot of shortcuts to be fast and have a small memory footprint. You can see the pattern of stars repeat. There's still some improvements I could do, like changing colors.
User avatar
MADrigal
Site Admin
Posts: 1191
Joined: Sun Sep 15, 2013 1:00 pm
Contact:

Re: Starfield demo

Post by MADrigal » Sat Apr 06, 2013 8:38 am

I still need to figure out the "logic" of the routines that make characters change to resemble scrolling stars.
User avatar
TBCTBC
Posts: 64
Joined: Wed Mar 13, 2013 1:27 pm
Location: Solna, Sweden
Contact:

Re: Starfield demo

Post by TBCTBC » Sat Apr 06, 2013 9:23 am

I thought I would explain a little and realized I change even the slow star character every frame, even though it only moves every other frame. Maybe I should have implemented it differently.
Anyway, this code:

Code: Select all

  ldx #0		; Edit slow character
ml4:
  lda #0
  cpx slowchar
  bne ml5
  lda #8
ml5:
  sta VDP_Data_Write
  inx
  cpx #8
  bne ml4
fills the character for the slow star with zero except on the row specified by slowchar, where it puts 8 instead (the star).
So, by increasing slowchar the star moves down one pixel.
The routine is exactly the same for the fast star.

Then, this code:

Code: Select all

  ldx fastchar		; Change vertical position of star inside fast character
  inx
  cpx #8
  bne lo3$
  ldy #16
  jsr move_stars	; Move fast character
  ldx #0
lo3$:
  stx fastchar
increases the value of fastchar by one every frame, until it reaches eight, when it resets to zero (so the star will be in the top of the character again).
When it resets to zero, I also call the routine move_stars, which moves the character down on the screen.
I hope that explains it a little.
User avatar
TBCTBC
Posts: 64
Joined: Wed Mar 13, 2013 1:27 pm
Location: Solna, Sweden
Contact:

Re: Starfield demo

Post by TBCTBC » Sat Apr 06, 2013 10:46 am

Here's a new version with some blinking stars.
You do not have the required permissions to view the files attached to this post.
User avatar
MADrigal
Site Admin
Posts: 1191
Joined: Sun Sep 15, 2013 1:00 pm
Contact:

Re: Starfield demo

Post by MADrigal » Sat Apr 06, 2013 5:22 pm

I need to study it a bit. I looked at the source code and it seems quite readable :-)

btw I see no blinking stars there.
User avatar
TBCTBC
Posts: 64
Joined: Wed Mar 13, 2013 1:27 pm
Location: Solna, Sweden
Contact:

Re: Starfield demo

Post by TBCTBC » Sat Apr 06, 2013 6:06 pm

Well, they are changing color in this order: grey, dark yellow, light yellow, white and back again.
User avatar
MADrigal
Site Admin
Posts: 1191
Joined: Sun Sep 15, 2013 1:00 pm
Contact:

Re: Starfield demo

Post by MADrigal » Sat Apr 06, 2013 9:56 pm

There must be some issue with my emulator... I see always the same colour. :?
Post Reply