Go to bottom

Star field effect for Amiga

category: code [glöplog]
I wonder how this basic effect (both 2D and 3D) is best achieved (hardware sprites, bitmap graphics, ...) and why.

The target is OCS, ECS, AGA.

Any help is more than welcome thanks :)
added on the 2015-09-18 11:04:49 by AlienTech AlienTech
There have been so many variants of this effect it depends what you're looking for. Do you have any examples?

simplest methods using just 'dots'

2d - pixels from side to side, colour some different shades to give an illusion of distance and change the delta so they move at different speeds

3d - but it can be nice vary the collours darker->lighter based on depth, and double/quad up the size the closer they get

either can be substituted with a sprite, some kind of image blt etc.
added on the 2015-09-18 11:14:28 by Canopy Canopy
or the 2d one with stars coming from a center point is just a pixel plotter with a circle function!
added on the 2015-09-18 15:16:08 by Maali Maali
Some example source for 3D version hither
added on the 2015-09-19 18:54:34 by Fell Fell

And how the "dots" are implemented on Amiga?

Hardware sprites?
Bitmap graphics?
Blitter objects?
added on the 2015-09-20 13:38:32 by AlienTech AlienTech
And how the "dots" are implemented on Amiga?

Yes and it depends
added on the 2015-09-20 14:47:34 by britelite britelite
A useful thread about that here with some good dot plotting shizzle.
added on the 2015-09-20 15:47:48 by Fell Fell
Teach 3D, Luke
added on the 2015-09-20 15:53:41 by g0blinish g0blinish
darth planer
added on the 2015-09-20 16:04:05 by 1in10 1in10
a sideways star field is often made using sprite recycling..
lol darth planar :D
added on the 2015-09-20 17:09:05 by Fell Fell
simple 2d starfield is usually made by re-use of sprites (as hooverphonique mentioned):
- 1px sprite per line, positioned on different X positions, multiple lines. this can be achieved if you don't put a stop words at the end of the sprite, but instead a create a new sprite structure. (see here how to create "reusable" sprites - hardware reference manual )
PRO: after you create the sprites, actual asm code to move them is only 10 lines long. low cpu usage.

fake 3d starfield (that always comes from the centre)
- generate a random number of lines for center to the border of the screen (use a random offset, so that not all begins at the very centre). have a bresenham line algorithm handy, but instead of drawing the whole line, draw just one dot that is located at XY step. randomize the steps over the lines at the init time, and with each frame increase the step (you need a slower and faster moving dots, so that you get a depth feel). when you arrive to the end of the line, then reset the step to the beginning of the line. repeat for all the lines each frame. (depending on how much do you want to draw, you can simplify that, precalc lines, precalc all the dots with their precalced bits and offsets, ...)

for the other methods, well... try to get these simplest two working and then get back to me if you need more info about read 3d starfield.
added on the 2015-09-20 17:55:43 by bonefish bonefish


Using reused hardware sprites the number of dots is rather limited, does it make sense to use dedicated bitplanes to achieve a bigger number of dots?
added on the 2015-09-21 08:56:00 by AlienTech AlienTech
check out the 2D starfield in Chiperia #3, that's just 3 sprites. (amd you have 5 more left)
added on the 2015-09-21 09:29:21 by bonefish bonefish

Got it thanks.
added on the 2015-09-21 14:29:20 by AlienTech AlienTech


Go to top