Results 1 to 10 of 159

Thread: The Probe

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    The screenshots look much better than the ascii-levels IMHO

  2. #2
    Thanks Jonax

    cheers,
    Paul

  3. #3
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    I must say I do do one thing very differently in terms of maps. I have a tendency to go towards developing a layered format which stores data in 2d csv array between meta style tags. Each array corresponds to each layer. Then there is a LOT of tags that define 'objects' so whereas floor, terrain, rocks, caves, walls and etc are defined as tiles in the 2d arrays, an object might be a person, chair, TV and others you can interact with. Also, each object has a script file so it can edit X,Y positions, the shown image and etc. The map itself also has a script file in case you want it to change dynamically. Quite a bit more complicated which I guess is why I have a right job in making editors to work with it all. Especially the 20th odd revision of this format. This map editor is indeed proving exceptionally tricky.

    I like the touch where you store data as T, 0,1,W and etc... I might start doing that to replace my Integer tile codes once I get the latest revision optimised. It only does 35 odd fps when drawing a total 7,000 elements at 800x600 32bpp whereas earlier formats reached 175fps in equal element counts. Darn. Opengl Should give that a right change I hope.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  4. #4
    Quote Originally Posted by code_glitch View Post
    I must say I do do one thing very differently in terms of maps. I have a tendency to go towards developing a layered format which stores data in 2d csv array between meta style tags. Each array corresponds to each layer. Then there is a LOT of tags that define 'objects' so whereas floor, terrain, rocks, caves, walls and etc are defined as tiles in the 2d arrays, an object might be a person, chair, TV and others you can interact with. Also, each object has a script file so it can edit X,Y positions, the shown image and etc. The map itself also has a script file in case you want it to change dynamically. Quite a bit more complicated which I guess is why I have a right job in making editors to work with it all. Especially the 20th odd revision of this format. This map editor is indeed proving exceptionally tricky.

    I like the touch where you store data as T, 0,1,W and etc... I might start doing that to replace my Integer tile codes once I get the latest revision optimised. It only does 35 odd fps when drawing a total 7,000 elements at 800x600 32bpp whereas earlier formats reached 175fps in equal element counts. Darn. Opengl Should give that a right change I hope.
    Hey code_glitch, you do realise that I'm not actually going to use ASCII characters as levels in my final game? I am going to use my level editor that I wrote for The Probe earlier on...it uses binary files to load/save levels.

    Good luck with your level editor dude

    cheers,
    Paul

  5. #5
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Ah, that does explain things a lot, guess you have some mighty small map files then since the engine seems to handle it all. I might have to give that a go to try and improve performance on mine. Good luck on the probe, looks like you made a lot of ground with this one.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  6. #6
    My level map files in The Probe are just simple 2d arrays of a TEngineObject record, one array for each layer in the map...

    Code:
      TEngineObject = record
        Enabled: Boolean;
        Health: Single;
        Moving: Byte;
        OfsX: Single;
        OfsY: Single;
        case Integer of
          0: (Id,Attrib,Scanned,Stationary: Byte);
          1: (Value: LongWord);
      end;
    Here is my load/save code I am now using in The Probe prototype (levels are binary files):

    Code:
    procedure TTheProbeEngine.SaveToStream(const aStream: TStream);
    var
      w,h,L: Word;
      Layer,x,y: Word;
    begin
      w := FWidth;
      h := FHeight;
      L := FLayerCount;
    
      aStream.Write(w,SizeOf(w));
      aStream.Write(h,SizeOf(h));
      aStream.Write(L,SizeOf(L));
      aStream.Write(FUpdateCount,SizeOf(FUpdateCount));
    
      for Layer := 0 to FLayerCount - 1 do
        for y := 0 to FHeight - 1 do
        begin
          for x := 0 to FWidth - 1 do
          begin
            aStream.Write(FLayers[Layer][y,x],SizeOf(TEngineObject));
          end;
        end;
    end;
    
    procedure TTheProbeEngine.LoadFromStream(const aStream: TStream);
    var
      w,h,L: Word;
      Layer,x,y: Word;
    begin
      aStream.Read(w,SizeOf(w));
      aStream.Read(h,SizeOf(h));
      aStream.Read(L,SizeOf(L));
      aStream.Read(FUpdateCount,SizeOf(FUpdateCount));
    
      SetBounds(L,w,h);
    
      for Layer := 0 to FLayerCount - 1 do
        for y := 0 to FHeight - 1 do
        begin
          for x := 0 to FWidth - 1 do
          begin
            aStream.Read(FLayers[Layer][y,x],SizeOf(TEngineObject));
          end;
        end;
    end;
    
    procedure TTheProbeEngine.LoadFromFile(const aFileName: AnsiString);
    var
      fs: TFileStream;
    begin
      fs := TFileStream.Create(aFileName,fmOpenRead or fmShareDenyWrite);
      try
        LoadFromStream(fs);
      finally
        fs.Free;
      end;
    end;
    
    procedure TTheProbeEngine.SaveToFile(const aFileName: AnsiString);
    var
      fs: TFileStream;
    begin
      fs := TFileStream.Create(aFileName,fmCreate or fmShareDenyWrite);
      try
        SaveToStream(fs);
      finally
        fs.Free;
      end;
    end;
    Maybe this will help you?

    cheers,
    Paul

  7. #7
    Hey all,
    I have now started sending updates via my Twitter account (http://twitter.com/theprobegame)

    So feel free to follow me there too

    cheers,
    Paul

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
  •