Jump to content
IGNORED

Software sprites and 3-d starfield code


Recommended Posts

Is there any place where people leave sources for assorted routines. Anything from PM graphics to the two things I am especially interested in. I want the fastest, best routine to move a software sprite on a screen with four colors or maybe even graphics 9, 10 or 11. Guess the routines are a little different, but maybe not too much.

 

Also, a 3-D starfield, like the one in Star Raiders. Anybody have a good routine for that?

 

Thanks and take Atarian care

Link to comment
Share on other sites

it all depends on what you wanna do. Do more precise your idea is the better you can tweak your routine. Generic routines are always costly when it comes to performance.

 

check this out:

 

http://sources.pigwa.net/

http://atariwiki.strotmann.de

http://mads.atari8.info/

(MADS includes a lot nice code examples)

 

cheers

\twh::taos

Link to comment
Share on other sites

3-D Star Field is pretty easy. It is just an array of x,y coordinates for each star.

 

Each star is assigned a random screen position and random brightness (withing limits of the display device's ability to show brightness), and each moves at a random speed across the screen, all in the same direction. With each cycle of the game loop, each star erased and redrawn in a new position based on its speed, and it's coordinates are updated.

 

When stars get to the edge of the screen, they get wrapped around back to the other side, and the speed and brightness (possibly vertical position) might get assigned new random values.

Link to comment
Share on other sites

Each star is assigned a random screen position and random brightness (withing limits of the display device's ability to show brightness), and each moves at a random speed across the screen, all in the same direction. With each cycle of the game loop, each star erased and redrawn in a new position based on its speed, and it's coordinates are updated.

 

That's a reasonable approach if you just want something that looks kinda sorta like a star field, though stars that reach the edge should reset to the center of the screen rather than the opposite edge, and you need to control the distribution of velocities to ensure it looks reasonable. If nothing else, require that either |dx| is greater than some minimum, |dy| is greater than some minimum, or |dx|+|dy| is greater than some minimum. If a random choice of speeds doesn't meet those requirements, reject the star. Otherwise you may get some stars that just 'sit' in the middle of the screen or move excessively slowly.

 

If you want to allow the user to fly around the starfield interactively, things are harder, particularly since starfields as commonly drawn are completely unrealistic. If it takes one second for a star to move from being 1/10 of the way from the center of the screen to 1/5, that means that in that time the player has traversed half the distance to that star. In BattleZone, the mountains are always at distance infinity, but for a starfield to move nicely the player must be so close to the stars as to be able to reach them in seconds.

Link to comment
Share on other sites

Is there any place where people leave sources for assorted routines. Anything from PM graphics to the two things I am especially interested in. I want the fastest, best routine to move a software sprite on a screen with four colors or maybe even graphics 9, 10 or 11. Guess the routines are a little different, but maybe not too much.

 

Also, a 3-D starfield, like the one in Star Raiders. Anybody have a good routine for that?

 

Thanks and take Atarian care

 

Here is an ANALOG article, with ACTION! source code, that shows how to do a 3D star field.

http://www.cyberroach.com/analog/an20/stars3d_action.htm

 

Sorry, I just tested this code. It is not 3D like Star Raiders but is actually pseudo-3D or parallax scrolling.

Edited by joyfulcoder
Link to comment
Share on other sites

Thanks for the replies. I think some of the replies is what I would call 2-d starfield, like in a horisontal shooter, but I need 3-D maths for the starfield. I guess the links I got, though polish, can help with some of my concerns, if the source code for Fred, Misja and those are complete. Will read through and see if I can use any.

 

Alternate Reality intro also has the 3-D starfield, but it doesn't have to be an Atari 8-bit code I guess. If there's C64 coders that have done it, same math should work.

 

Thanks again and take Atarian care

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...