Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Create smooth scrolling starfield
2011-11-17 11:49
Cobrakid

Registered: Oct 2011
Posts: 23
Create smooth scrolling starfield

I want to make a classic starfield look where the stars are coming from left towards right... just normal dots. What is a good approach for this you think?

I have considered a table with the starfield and then shifting them in the table but that sounds a little overkill and slow. I have also though of randomly generating some dots but I have no idea how to do that (no random generator in C64)?

Any good ideas are appreciated (and I would love some pseudo-code to see how you would do it).
2011-11-17 12:16
HCL

Registered: Feb 2003
Posts: 728
There is a random generator in the basic interpreter :)

I suggest making the stars in char or bitmap mode, with sprites you have the d010-problem which requires quite exact timing.

If one star per pixel-line is enough then that would make the whole thing much easier. Just generate random start-positions and random speeds (1-8?) and do the code :).
2011-11-17 12:21
TPM

Registered: Jan 2004
Posts: 110
and use d400-d800 colors to make a pixel blink while moving :)
2011-11-17 12:21
Cobrakid

Registered: Oct 2011
Posts: 23
Random generator in Basic? I didn't know that but how to use that in assembler?

And how do I have different speeds on the stars? With $D016 smooth you have the whole raster line with the same speed?

One star per cursor is fine and it will be done i normal char mode.
2011-11-17 13:00
HCL

Registered: Feb 2003
Posts: 728
Hmm.. One star per cursor!? With different speed of the stars, they will sometimes occupy the same char (cursor). Otherwise if you want a bug-free starfield then you will have max 25 stars :(.

Better make it all in bitmap mode and plot the stars without using $d016.

Oh, and:
10 print rnd(0)
20 goto 10

something like that..
2011-11-17 13:23
Achim
Account closed

Registered: Jan 2010
Posts: 28
A starfield can be easily done with sprites, chars or bitmap. It really depends on what else has to happen in your program. If you don't need a full charset, reserve maybay half of it, place the chars wisely, set some bits and ROR them through the char data.
It can also be done with one sprite only if you use an interrupt, but this will need a lot of rastertime.
2011-11-17 13:54
chatGPZ

Registered: Dec 2001
Posts: 11386
Quote:
Hmm.. One star per cursor!? With different speed of the stars, they will sometimes occupy the same char (cursor). Otherwise if you want a bug-free starfield then you will have max 25 stars :(.

it really boils down on what exactly you want to do, i guess. for example for a game, using characters and cursor blocks can work quite okish :) so that would be my first question before suggesting anythng: what do you want to do at the same time, and what do you want to show in front of the starfield?
2011-11-17 14:17
enthusi

Registered: May 2004
Posts: 677
Simple charbased starfields would/could look like this (just to give you an idea)
http://www.youtube.com/watch?v=DJPoFuIks-A

That is quite simple to accomplish.
2011-11-17 15:50
Skate

Registered: Jul 2003
Posts: 494
i don't like single colored starfields (unless they are fullborder ;)). to give the real depth feeling, either you should use multicolor mode or if your routine is irq dependent (mostly using sprites), change colors depending on speed every line/block. slower stars meant to be darker. just keep that in mind whichever method you choose.
2011-11-17 16:11
enthusi

Registered: May 2004
Posts: 677
Well, ALL starfields are unrealistic anyway ;-)
But I agree, shaded ones are nicer.
2011-11-17 16:34
Cobrakid

Registered: Oct 2011
Posts: 23
I have aprox the half screen available (interrupt based) for this starfield and in front I want 8 sprites - so nothing fancy. Below the starfield I have some rasterbars and two scrolls (also interrupt based).

Several things have been suggested - as I am not going for any medals or alike I just want to make this as simple as possible so I guess this is done with the normal charset compared to the bitmap approach? A color-mix would be pure gold but it is not necessary in the first simple version.

My first attempt was reading the memory banks and if I ran into fx a #$01 I would print a dot but that for sure didn't work of abvious reasons.

Can anyone give any more precise hints on this - is this standard $D016 smooth scroll? And how do I place the dots?
 
... 7 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Case/Padua
Epyx/TSA
MCM/ONSLAUGHT
Andy/AEG
Stone/Prosonix/Offence
rikib80
Chesser/Blazon
Guests online: 115
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.055 sec.