Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: Carver Explorer

  1. #1
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206

    Carver Explorer

    This is some what of a sand boxing frame work. the end goal is to create a firemonkey like solution for the fpc that would be suitable for game engine design graphic tool developement educational software.

    The Explorer model is built around a custom link list design and so it inherits a very connected nature. because of this design sharing resources is very second nature to the explorer deticated managers are not really necessary. but should one need such micro management it would be quite easy to insert.

    Scripting is also a big part of the design. it provides both structured input/output as well as a modular scripting language. a typical application in the explorer may have a number of script engines within it. each customized to the modules it controls. a shade module will contain commands to build shaders for the opengl while the texture rendering modules would have comands for loading,manipulating or creating texturing purely from script.

    currently it is more for tool development and later for exploring game engine design.while my editor still looks a little crude don't be fooled by its appearance. it uses the fold file format I created for my self many years ago. this format works with most all languages and allows me to work with large files. it is quite programable as you can see I was able to throw together a simple interactive texture editor. it still needs alot of work but I am able to high lite a number and roll the mouse wheel to change to value and hit the run button to see the changes. all the textures are create from scripts and will be part of the framework when it is finished.
    Attached Images Attached Images
    Last edited by Carver413; 11-08-2012 at 10:38 PM.

  2. #2
    OMG Please choose a different font. My eyes are bleeding.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  3. #3
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Aside from the font, thats some good work indeed
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  4. #4
    I see that you are using Perlin Noise for texture generation. Would you mind sharing sorce code for it so I can do some comparison with my Perlin Noise like algorithm that I made for myself? Mostly I would just like to do some speed comparison bethween them.

  5. #5
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    Actually that is not perlin noise, I don't have a good working perlin. if you want a fast perlin then your going to have to cheat like everone else. there are many different methods out there if you take the time to dig around a bit. I'm not really doing much with perlin right now so I haven't really perused it myself this. try this http://drilian.com/category/developm...ural-textures/ and see if there are some better ideas for you

  6. #6
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    Glscene also contains some perlin stuff maybe you should browse thru that as well

  7. #7
    Here is my Perlin Noise unit I made up around 2006 - not sure how fast it is?

    Code:
    Unit PerlinNoiseUnit;
    
    Interface
    
    {$R-}
    {$Q-}
    
    Const
      _B = $100;
      BM = $ff;
    
      N = $1000;
    
    Type
        TPerlinNoise = Class
        Private
            P : Array[0..(_B+_B+2)-1] Of Integer;
            G1: Array[0..(_B+_B+2)-1] Of Double;
        Public
            Constructor Create(Seed: Integer);
    
            Procedure InitNoise(Seed: Integer);
            Function Noise1d(x: Double): Double;
            Function Noise2d(x,y: Double): Double;
            Function Noise3d(x,y,z: Double): Double;
    
            Function PerlinNoise1d(x: Double;
                                   Persistence: Single = 0.25;
                                   Frequency: Single = 1;
                                   Octaves: Integer = 4): Double;
            Function PerlinNoise2d(x,y: Double;
                                   Persistence: Single = 0.25;
                                   Frequency: Single = 1;
                                   Octaves: Integer = 4): Double;
            Function PerlinNoise3d(x,y,z: Double;
                                   Persistence: Single = 0.25;
                                   Frequency: Single = 1;
                                   Octaves: Integer = 4): Double;
        End;
    
    Implementation
    
    Uses
        SysUtils;
    
    Function TPerlinNoise.Noise1d(x: Double): Double;
    Var
      bx0,bx1: Integer;
      rx0,sx,t,u,v: Double;
    Begin
      t := x+N;
      bx0 := Trunc(t) And BM;
      bx1 := (bx0+1) And BM;
      rx0 := t-Trunc(t);
    
      sx := (rx0*rx0*(3.0-2.0*rx0));
    
      u := G1[P[bx0]];
      v := G1[P[bx1]];
    
      Result := u+sx*(v-u);
    End;
    
    Function TPerlinNoise.Noise2d(x,y: Double): Double;
    Var
      bx0,bx1,by0,by1: Integer;
      i,j: Integer;
      rx0,ry0: Double;
      sx,sy: Double;
      a,b,t,u,v: Double;
    Begin
      t := x+N;
      bx0 := Trunc(t) And BM;
      bx1 := (bx0+1) And BM;
      rx0 := t-Trunc(t);
    
      t := y+N;
      by0 := Trunc(t) And BM;
      by1 := (by0+1) And BM;
      ry0 := t-Trunc(t);
    
      i := P[bx0];
      j := P[bx1];
    
      sx := (rx0*rx0*(3.0-2.0*rx0));
      sy := (ry0*ry0*(3.0-2.0*ry0));
    
      u := G1[P[i+by0]];
      v := G1[P[j+by0]];
      a := u+sx*(v-u);
    
      u := G1[P[i+by1]];
      v := G1[P[j+by1]];
      b := u+sx*(v-u);
    
      Result := a+sy*(b-a);
    End;
    
    Function TPerlinNoise.Noise3d(x,y,z: Double): Double;
    Var
      bx0,bx1,by0,by1,bz0,bz1: Integer;
      i,j,k,l: Integer;
      rx0,ry0,rz0: Double;
      sx,sy,sz: Double;
      a,b,c,d,t,u,v: Double;
    Begin
      t := x+N;
      bx0 := Trunc(t) And BM;
      bx1 := (bx0+1) And BM;
      rx0 := t-Trunc(t);
    
      t := y+N;
      by0 := Trunc(t) And BM;
      by1 := (by0+1) And BM;
      ry0 := t-Trunc(t);
    
      t := z+N;
      bz0 := Trunc(t) And BM;
      bz1 := (bz0+1) And BM;
      rz0 := t-Trunc(t);
    
      i := P[bx0];
      j := P[bx1];
    
      k := P[i+by0];
      l := P[j+by0];
      i := P[i+by1];
      j := P[j+by1];
    
      sx := (rx0*rx0*(3.0-2.0*rx0));
      sy := (ry0*ry0*(3.0-2.0*ry0));
      sz := (rz0*rz0*(3.0-2.0*rz0));
    
      u := G1[P[k+bz0]];
      v := G1[P[l+bz0]];
      a := u+sx*(v-u);
    
      u := G1[P[i+bz0]];
      v := G1[P[j+bz0]];
      b := u+sx*(v-u);
    
      c := a+sy*(b-a);
    
      u := G1[P[k+bz1]];
      v := G1[P[l+bz1]];
      a := u+sx*(v-u);
    
      u := G1[P[i+bz1]];
      v := G1[P[j+bz1]];
      b := u+sx*(v-u);
    
      d := a+sy*(b-a);
    
      Result := c+sz*(d-c);
    End;
    
    constructor TPerlinNoise.Create(Seed: Integer);
    Begin
      inherited Create;
    
      InitNoise(Seed);
    End;
    
    procedure TPerlinNoise.InitNoise(Seed: Integer);
    Var
      i,j: Integer;
    Begin
      RandSeed := Seed;
    
      For i := 0 to _B - 1 Do
      Begin
        P[i] := i;
        G1[i] := 2*Random-1;
      End;
    
      For i := 0 to _B - 1 Do
      Begin
        j := Random(_B);
        P[i] := P[i] xor P[j];
        P[j] := P[j] xor P[i];
        P[i] := P[i] xor P[j];
      End;
    
      For i := 0 to _B+2 - 1 Do
      Begin
        P[_B+i] := P[i];
        G1[_B+i] := G1[i];
      End
    End;
    
    Function TPerlinNoise.PerlinNoise1d(x: Double;
                                        Persistence: Single = 0.25;
                                        Frequency: Single = 1;
                                        Octaves: Integer = 4): Double;
    Var
        i: Integer;
        p,s: Double;
    Begin
        Result := 0;
        s := Frequency;
        p := 1;
        For i := 0 to Octaves - 1 Do
        Begin
            Result := Result + p * Noise1d(x * s);
            s := s * 2;
            p := p * Persistence;
        End;
    End;
    
    Function TPerlinNoise.PerlinNoise2d(x,y: Double;
                                        Persistence: Single = 0.25;
                                        Frequency: Single = 1;
                                        Octaves: Integer = 4): Double;
    Var
        i: Integer;
        p,s: Double;
    Begin
        Result := 0;
        s := Frequency;
        p := 1;
        For i := 0 to Octaves - 1 Do
        Begin
            Result := Result + p * Noise2d(x * s,y * s);
            s := s * 2;
            p := p * Persistence;
        End;
    End;
    
    Function TPerlinNoise.PerlinNoise3d(x,y,z: Double;
                                        Persistence: Single = 0.25;
                                        Frequency: Single = 1;
                                        Octaves: Integer = 4): Double;
    Var
        i: Integer;
        p,s: Double;
    Begin
        Result := 0;
        s := Frequency;
        p := 1;
        For i := 0 to Octaves - 1 Do
        Begin
            Result := Result + p * Noise3d(x * s,y * s,z * s);
            s := s * 2;
            p := p * Persistence;
        End;
    End;
    
    End.
    Games:
    Seafox


    Pages:
    Syntax Error Software itch.io page

    Online Chess
    http://gameknot.com/#paul_nicholls

  8. #8
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    This looks very nice Paul, I'll have to play around with it a bit and see what kind of trouble I can get into

  9. #9
    Quote Originally Posted by paul_nicholls View Post
    Here is my Perlin Noise unit I made up around 2006 - not sure how fast it is?

    Code:
    Unit PerlinNoiseUnit;
    
    Interface
    
    {$R-}
    {$Q-}
    
    Const
      _B = $100;
      BM = $ff;
    
      N = $1000;
    
    Type
        TPerlinNoise = Class
        Private
            P : Array[0..(_B+_B+2)-1] Of Integer;
            G1: Array[0..(_B+_B+2)-1] Of Double;
        Public
            Constructor Create(Seed: Integer);
    
            Procedure InitNoise(Seed: Integer);
            Function Noise1d(x: Double): Double;
            Function Noise2d(x,y: Double): Double;
            Function Noise3d(x,y,z: Double): Double;
    
            Function PerlinNoise1d(x: Double;
                                   Persistence: Single = 0.25;
                                   Frequency: Single = 1;
                                   Octaves: Integer = 4): Double;
            Function PerlinNoise2d(x,y: Double;
                                   Persistence: Single = 0.25;
                                   Frequency: Single = 1;
                                   Octaves: Integer = 4): Double;
            Function PerlinNoise3d(x,y,z: Double;
                                   Persistence: Single = 0.25;
                                   Frequency: Single = 1;
                                   Octaves: Integer = 4): Double;
        End;
    
    Implementation
    
    Uses
        SysUtils;
    
    Function TPerlinNoise.Noise1d(x: Double): Double;
    Var
      bx0,bx1: Integer;
      rx0,sx,t,u,v: Double;
    Begin
      t := x+N;
      bx0 := Trunc(t) And BM;
      bx1 := (bx0+1) And BM;
      rx0 := t-Trunc(t);
    
      sx := (rx0*rx0*(3.0-2.0*rx0));
    
      u := G1[P[bx0]];
      v := G1[P[bx1]];
    
      Result := u+sx*(v-u);
    End;
    
    Function TPerlinNoise.Noise2d(x,y: Double): Double;
    Var
      bx0,bx1,by0,by1: Integer;
      i,j: Integer;
      rx0,ry0: Double;
      sx,sy: Double;
      a,b,t,u,v: Double;
    Begin
      t := x+N;
      bx0 := Trunc(t) And BM;
      bx1 := (bx0+1) And BM;
      rx0 := t-Trunc(t);
    
      t := y+N;
      by0 := Trunc(t) And BM;
      by1 := (by0+1) And BM;
      ry0 := t-Trunc(t);
    
      i := P[bx0];
      j := P[bx1];
    
      sx := (rx0*rx0*(3.0-2.0*rx0));
      sy := (ry0*ry0*(3.0-2.0*ry0));
    
      u := G1[P[i+by0]];
      v := G1[P[j+by0]];
      a := u+sx*(v-u);
    
      u := G1[P[i+by1]];
      v := G1[P[j+by1]];
      b := u+sx*(v-u);
    
      Result := a+sy*(b-a);
    End;
    
    Function TPerlinNoise.Noise3d(x,y,z: Double): Double;
    Var
      bx0,bx1,by0,by1,bz0,bz1: Integer;
      i,j,k,l: Integer;
      rx0,ry0,rz0: Double;
      sx,sy,sz: Double;
      a,b,c,d,t,u,v: Double;
    Begin
      t := x+N;
      bx0 := Trunc(t) And BM;
      bx1 := (bx0+1) And BM;
      rx0 := t-Trunc(t);
    
      t := y+N;
      by0 := Trunc(t) And BM;
      by1 := (by0+1) And BM;
      ry0 := t-Trunc(t);
    
      t := z+N;
      bz0 := Trunc(t) And BM;
      bz1 := (bz0+1) And BM;
      rz0 := t-Trunc(t);
    
      i := P[bx0];
      j := P[bx1];
    
      k := P[i+by0];
      l := P[j+by0];
      i := P[i+by1];
      j := P[j+by1];
    
      sx := (rx0*rx0*(3.0-2.0*rx0));
      sy := (ry0*ry0*(3.0-2.0*ry0));
      sz := (rz0*rz0*(3.0-2.0*rz0));
    
      u := G1[P[k+bz0]];
      v := G1[P[l+bz0]];
      a := u+sx*(v-u);
    
      u := G1[P[i+bz0]];
      v := G1[P[j+bz0]];
      b := u+sx*(v-u);
    
      c := a+sy*(b-a);
    
      u := G1[P[k+bz1]];
      v := G1[P[l+bz1]];
      a := u+sx*(v-u);
    
      u := G1[P[i+bz1]];
      v := G1[P[j+bz1]];
      b := u+sx*(v-u);
    
      d := a+sy*(b-a);
    
      Result := c+sz*(d-c);
    End;
    
    constructor TPerlinNoise.Create(Seed: Integer);
    Begin
      inherited Create;
    
      InitNoise(Seed);
    End;
    
    procedure TPerlinNoise.InitNoise(Seed: Integer);
    Var
      i,j: Integer;
    Begin
      RandSeed := Seed;
    
      For i := 0 to _B - 1 Do
      Begin
        P[i] := i;
        G1[i] := 2*Random-1;
      End;
    
      For i := 0 to _B - 1 Do
      Begin
        j := Random(_B);
        P[i] := P[i] xor P[j];
        P[j] := P[j] xor P[i];
        P[i] := P[i] xor P[j];
      End;
    
      For i := 0 to _B+2 - 1 Do
      Begin
        P[_B+i] := P[i];
        G1[_B+i] := G1[i];
      End
    End;
    
    Function TPerlinNoise.PerlinNoise1d(x: Double;
                                        Persistence: Single = 0.25;
                                        Frequency: Single = 1;
                                        Octaves: Integer = 4): Double;
    Var
        i: Integer;
        p,s: Double;
    Begin
        Result := 0;
        s := Frequency;
        p := 1;
        For i := 0 to Octaves - 1 Do
        Begin
            Result := Result + p * Noise1d(x * s);
            s := s * 2;
            p := p * Persistence;
        End;
    End;
    
    Function TPerlinNoise.PerlinNoise2d(x,y: Double;
                                        Persistence: Single = 0.25;
                                        Frequency: Single = 1;
                                        Octaves: Integer = 4): Double;
    Var
        i: Integer;
        p,s: Double;
    Begin
        Result := 0;
        s := Frequency;
        p := 1;
        For i := 0 to Octaves - 1 Do
        Begin
            Result := Result + p * Noise2d(x * s,y * s);
            s := s * 2;
            p := p * Persistence;
        End;
    End;
    
    Function TPerlinNoise.PerlinNoise3d(x,y,z: Double;
                                        Persistence: Single = 0.25;
                                        Frequency: Single = 1;
                                        Octaves: Integer = 4): Double;
    Var
        i: Integer;
        p,s: Double;
    Begin
        Result := 0;
        s := Frequency;
        p := 1;
        For i := 0 to Octaves - 1 Do
        Begin
            Result := Result + p * Noise3d(x * s,y * s,z * s);
            s := s * 2;
            p := p * Persistence;
        End;
    End;
    
    End.
    I think you can improve speed if you use a type cast to integer (t as integer) instead of that trunc(t) function. Also you can remove the sysutils unit as it seems your code didn't use anything from it. Random and RandSeed are declared in the implicit system unit.

  10. #10
    @Paul
    Thank you for that. Where were you when I was asking about this in next thread: http://www.pascalgamedevelopment.com...eneration-code
    I will test it when I get home. It also gave me solution for improving my own algorithm for some capability that I need.

    @Carver431
    That site seems verry good. I will take some time reading trough but it will have to wait after the competition.
    Last edited by SilverWarior; 13-04-2012 at 06:52 AM. Reason: Adding more text

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •