Board index » delphi » Warp speed star field.

Warp speed star field.

Does anyone know how to make it look like you're going through space at
light speed?  I don't know how to make the stars streak by, but I did do
a star field at normal speed, where the stars accelerate as they move
toward the edge of the screen.  If anyone wants a copy of that, just
email me and I will send it.  The stars go off in a parabolic arc,
instead of straight out, it looks cool, and more real.
It also has 3 planes of stars, with the last plane moving slower and with
less stars which are dimmer.

But can someone tell me how to create the warp speed streaks?

Thanks.

*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*
{    /^\    ****    /^\                                      }
{   |   |**/____\**|   |                                     }
{  /                    \   In a world of constant change    }
{ |   (-)         (-)    |  Only one thing remains the same; }
{  \__                __/   Fortunately, it's not the fox.   }
{  ----\-*        *-/----                                    }
{    ----\-*    *-/----      Tsw...@lonestar.jpl.utsa.edu    }
{          \____/                                            }
{            **                      F O X M A N             }
*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*

 

Re:Warp speed star field.


In article <Pine.SGI.3.91.951213145735.3347C-100...@lonestar.jpl.utsa.edu>,
tsw...@lonestar.jpl.utsa.edu says...

Quote

>Does anyone know how to make it look like you're going through space at
>light speed?  I don't know how to make the stars streak by, but I did do
>a star field at normal speed, where the stars accelerate as they move
>toward the edge of the screen.  If anyone wants a copy of that, just
>email me and I will send it.  The stars go off in a parabolic arc,
>instead of straight out, it looks cool, and more real.
>It also has 3 planes of stars, with the last plane moving slower and with
>less stars which are dimmer.

>But can someone tell me how to create the warp speed streaks?

>Thanks.

I would love to see the starfield code! for making them streak by, just dont
erase the pixels for a few times through the loop, so they make a line.
--
The Crow - thec...@iconn.net
"It can't rain all the time"

Re:Warp speed star field.


Re:Warp speed star field.


Quote
> >Does anyone know how to make it look like you're going through space at
> >light speed? ...................

I would appreciate a copy of this code. To make it streaky leave the
pixels on the screen for say, 10 iterations before blanking them out.
thanks
Dale
PALM...@KBPNSF03.ESKOM.CO.ZA

Re:Warp speed star field.


Quote
Foxman wrote:

> Does anyone know how to make it look like you're going through space at
> light speed?  I don't know how to make the stars streak by, but I did do
> a star field at normal speed, where the stars accelerate as they move
> toward the edge of the screen.  If anyone wants a copy of that, just
> email me and I will send it.  The stars go off in a parabolic arc,
> instead of straight out, it looks cool, and more real.
> It also has 3 planes of stars, with the last plane moving slower and with
> less stars which are dimmer.

> But can someone tell me how to create the warp speed streaks?

> Thanks.

I wouldn't mind seeing a copy of this code..

Thanx'
Khile Klock
hoitl...@proaxis.com

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Khile T. Klock                   |  klo...@wsadmin2.cv.hp.com
Software (CIM) Technician        |  klo...@hpcvif10.cv.hp.com
WorkStream Support               |  klo...@hpcvsgen.cv.hp.com
Hewlett Packard                  |  klo...@hotlin.fidonet.org
InkJet Business Unit             |  hotl...@proaxis.com
Corvallis, Oregon                |  (http://www.proaxis.com/~hotline)
---------------------------------+-----------------------------------
       Phone: (503) 715-1466            Pager: (503) 924-5575
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re:Warp speed star field.


Quote
On Fri, 15 Dec 1995, The Crow wrote:
> In article <Pine.SGI.3.91.951213145735.3347C-100...@lonestar.jpl.utsa.edu>,
> tsw...@lonestar.jpl.utsa.edu says...

> >Does anyone know how to make it look like you're going through space at
> >light speed?  I don't know how to make the stars streak by, but I did do
> >a star field at normal speed, where the stars accelerate as they move
> >toward the edge of the screen.  If anyone wants a copy of that, just
> >email me and I will send it.  The stars go off in a parabolic arc,
> >instead of straight out, it looks cool, and more real.
> >It also has 3 planes of stars, with the last plane moving slower and with
> >less stars which are dimmer.

> >But can someone tell me how to create the warp speed streaks?

> >Thanks.

> I would love to see the starfield code! for making them streak by, just dont
> erase the pixels for a few times through the loop, so they make a line.
> --
> The Crow - thec...@iconn.net
> "It can't rain all the time"

Well, I guess this will post to the newsgroup.  15 people asked for it.
I have attached my source code.

*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*
{    /^\    ****    /^\                                      }
{   |   |**/____\**|   |                                     }
{  /                    \   In a world of constant change    }
{ |   (-)         (-)    |  Only one thing remains the same; }
{  \__                __/   Fortunately, it's not the fox.   }
{  ----\-*        *-/----                                    }
{    ----\-*    *-/----      Tsw...@lonestar.jpl.utsa.edu    }
{          \____/                                            }
{            **                      F O X M A N             }
*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*

[ stars.pas 5K ]
uses
  CRT, Graph;

TYPE
  XA1 = ARRAY[0..200] OF INTEGER;
  XA2 = ARRAY[0..120] OF INTEGER;
  XA3 = ARRAY[0..40] OF INTEGER;
  YA1 = ARRAY[0..200] OF INTEGER;
  YA2 = ARRAY[0..120] OF INTEGER;
  YA3 = ARRAY[0..40] OF INTEGER;

PROCEDURE PLACESTARS(VAR X1:XA1;
                         X2:XA2;
                         X3:XA3;
                         Y1:YA1;
                         Y2:YA2;
                         Y3:YA3);
VAR
  COUNT:INTEGER;
  X,Y:REAL;

BEGIN
  RANDOMIZE;
  FOR COUNT:=0 TO 200 DO
    BEGIN
      X:=RANDOM(640);
      Y:=RANDOM(480);
      X1[COUNT]:=ROUND(X);
      Y1[COUNT]:=ROUND(Y);
    END;

FOR COUNT:=0 TO 120 DO
    BEGIN
      X:=RANDOM(640);
      Y:=RANDOM(480);
      X2[COUNT]:=TRUNC(X);
      Y2[COUNT]:=TRUNC(Y);
    END;

FOR COUNT:=0 TO 40 DO
    BEGIN
      X:=RANDOM(640);
      Y:=RANDOM(480);
      X3[COUNT]:=TRUNC(X);
      Y3[COUNT]:=TRUNC(Y);
    END;
END;

PROCEDURE MOVESTARS;

VAR
  X1:XA1;
  X2:XA2;
  X3:XA3;
  Y1:YA1;
  Y2:YA2;
  Y3:YA3;
  RATEX1,RATEX2,RATEX3:INTEGER;
  ACCELX,ACCELY,COUNT:INTEGER;

BEGIN
  ACCELX:=10;
  ACCELY:=40;
  RATEX1:=3;
  RATEX2:=2;
  RATEX3:=1;
  REPEAT
    FOR COUNT:=0 TO 200 DO
    BEGIN
      PUTPIXEL(X1[COUNT],Y1[COUNT],0);
      IF X1[COUNT]<=320 THEN X1[COUNT]:=X1[COUNT]-((320-X1[COUNT]) DIV ACCELX)-RATEX1;
      IF X1[COUNT]>320 THEN X1[COUNT]:=X1[COUNT]+((X1[COUNT]-320) DIV ACCELX)+RATEX1;
      IF X1[COUNT]<0 THEN X1[COUNT]:=TRUNC(RANDOM(640));
      IF X1[COUNT]>640 THEN X1[COUNT]:=TRUNC(RANDOM(640));
      IF Y1[COUNT]>240 THEN Y1[COUNT]:=Y1[COUNT]+((Y1[COUNT]-240) DIV ACCELY)+RATEX1;
      IF Y1[COUNT]<=240 THEN Y1[COUNT]:=Y1[COUNT]-((240-Y1[COUNT]) DIV ACCELY)-RATEX1;
      IF Y1[COUNT]<0 THEN Y1[COUNT]:=TRUNC(RANDOM(480));
      IF Y1[COUNT]>480 THEN Y1[COUNT]:=TRUNC(RANDOM(480));
      PUTPIXEL(X1[COUNT],Y1[COUNT],15);
    END;
    FOR COUNT:=0 TO 120 DO
    BEGIN
      PUTPIXEL(X2[COUNT],Y2[COUNT],0);
      IF X2[COUNT]<=320 THEN X2[COUNT]:=X2[COUNT]-((320-X2[COUNT]) DIV ACCELX)-RATEX2;
      IF X2[COUNT]>320 THEN X2[COUNT]:=X2[COUNT]+((X2[COUNT]-320) DIV ACCELX)+RATEX2;
      IF X2[COUNT]<0 THEN X2[COUNT]:=TRUNC(RANDOM(640));
      IF X2[COUNT]>640 THEN X2[COUNT]:=TRUNC(RANDOM(640));
      IF Y2[COUNT]>240 THEN Y2[COUNT]:=Y2[COUNT]+((Y2[COUNT]-240) DIV ACCELY)+RATEX2;
      IF Y2[COUNT]<=240 THEN Y2[COUNT]:=Y2[COUNT]-((240-Y2[COUNT]) DIV ACCELY)-RATEX2;
      IF Y2[COUNT]<0 THEN Y2[COUNT]:=TRUNC(RANDOM(480));
      IF Y2[COUNT]>480 THEN Y2[COUNT]:=TRUNC(RANDOM(480));
      PUTPIXEL(X2[COUNT],Y2[COUNT],7);
    END;
    FOR COUNT:=0 TO 40 DO
    BEGIN
      PUTPIXEL(X3[COUNT],Y3[COUNT],0);
      IF X3[COUNT]<=320 THEN X3[COUNT]:=X3[COUNT]-((320-X3[COUNT]) DIV ACCELX)-RATEX3;
      IF X3[COUNT]>320 THEN X3[COUNT]:=X3[COUNT]+((X3[COUNT]-320) DIV ACCELX)+RATEX3;
      IF X3[COUNT]<0 THEN X3[COUNT]:=TRUNC(RANDOM(640));
      IF X3[COUNT]>640 THEN X3[COUNT]:=TRUNC(RANDOM(640));
      IF Y3[COUNT]>240 THEN Y3[COUNT]:=Y3[COUNT]+((Y3[COUNT]-240) DIV ACCELY)+RATEX3;
      IF Y3[COUNT]<=240 THEN Y3[COUNT]:=Y3[COUNT]-((240-Y3[COUNT]) DIV ACCELY)-RATEX3;
      IF Y3[COUNT]<0 THEN Y3[COUNT]:=TRUNC(RANDOM(480));
      IF Y3[COUNT]>480 THEN Y3[COUNT]:=TRUNC(RANDOM(480));
      PUTPIXEL(X3[COUNT],Y3[COUNT],8);
    END;
  UNTIL KEYPRESSED;
END;

PROCEDURE GRAPHINIT;

var
  grDriver : Integer;
  grMode   : Integer;
  ErrCode  : Integer;
begin
  grDriver := Detect;
  InitGraph(grDriver,grMode,'M:\DOSAPPS\TP6.0\BGI');
  ErrCode := GraphResult;
  if ErrCode <> grOk then
    WriteLn('Graphics error:',
            GraphErrorMsg(ErrCode));
end;

VAR
  X1:XA1;
  X2:XA2;
  X3:XA3;
  Y1:YA1;
  Y2:YA2;
  Y3:YA3;
  CH:CHAR;

BEGIN
  GRAPHINIT;
  PLACESTARS(X1,X2,X3,Y1,Y2,Y3);
  MOVESTARS;
  CLOSEGRAPH
END.

Other Threads