Page 6 of 16 FirstFirst ... 45678 ... LastLast
Results 51 to 60 of 159

Thread: The Probe

  1. #51
    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

  2. #52
    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.

  3. #53
    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

  4. #54
    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

  5. #55
    Heh, I find that any time I try to use a tile based system, I always make it extremely complicated very fast, which ends up forcing me to implement file loading earlier. Most of the time, I use Tiled as my map editor of choice, and depending on what I am deploying, will either use XML or CSV exporting. Very handy!

  6. #56
    Tiled sounds neat, but I'm going to 'roll my own'

    I already have some very cool ideas for my updated level editor...

    • If a tile is added above/below the existing tiles, the editor will insert a row above/below the rows already there to accommodate the new tile being placed, and similar for the columns.
    • Pan the map with the cursor keys or other keys, place tiles with the mouse.
    • Make the map editor use the in-game engine for ease of use, and not be a separate GUI program.


    cheers,
    Paul

  7. #57
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Hay dazappa, I'm with you on that one TileD all the way, but TileD does not do scripting for my maps, and objects which is why I'm having a nice time making a map editor.

    Cheers for that snippet paul. large help and the personification of simplicity... My load/save procedures are usually upwards of 200 lines. 100 and up after they are stripped bare for speed. My tests point at loading at around 80kbytes/sec which for a 1mb map file is quite a long time
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  8. #58
    Quote Originally Posted by code_glitch View Post
    Cheers for that snippet paul. large help and the personification of simplicity... My load/save procedures are usually upwards of 200 lines. 100 and up after they are stripped bare for speed. My tests point at loading at around 80kbytes/sec which for a 1mb map file is quite a long time
    "personification of simplicity" - I love it!

    Glad I could shed some light on your problems

    cheers,
    Paul

  9. #59
    Tiled does support objects, but no scripting. Personally I don't mind having level data separated into multiple files (so, eg: properties or mini scripting in one file and the map data in another), but I can understand the preference for it being all self contained.

    I'd go with Paul, in that if you want to roll your own map editor you should do it in the game itself. This way, you can easily deploy the map editor for everyone to enjoy

  10. #60
    I thought I'd share how I'm going with my new editor for The Probe...



    I am doing it all in-game, and even using my Immediate Mode GUI system I was using for The Probe setup screens...this makes it easy to do input

    I can register tiles with the editor, and click on them to select one. I can't put it into the level yet, but that shouldn't take long...

    The selectable tiles are buttons (hidden) with a graphic over the top, and I have check boxes to show/hide layers.

    As a nice bonus, everything animates because the editor is now part of the game

    cheers,
    Paul
    Last edited by paul_nicholls; 21-03-2011 at 05:32 AM.

Page 6 of 16 FirstFirst ... 45678 ... 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
  •