Results 1 to 10 of 121

Thread: G.T.A.2 Map Editor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    It's a buggy feature. This compiles on D7
    Code:
    function test(a, b, c: integer): integer;
    begin
      result:=a+b+c;
    end;
    
    procedure test2();
    begin
      test(1, 2, 3,);
    end;

  2. #2
    Ok, thanks. So im not the only one.


    Btw, i compiled simplest app using nxPascal, game loop etc in C++ Builder 6.
    I know, noone probably uses it, but i have personal version around and decided to try.
    BCB is able to compile / link Delphi units. I had to do some minor tweaks (the BCB code converter is a bit buggy) but it compiles and links fine.

    Had to replace #include "dglOpengl.hpp" with "#include <GL/gl.h>"
    But it works fine. I dont use shaders or other fancy stuff. So its enough.


    Got my nice black window

    I have plan to rewrite my editor in C++ Builder because of all the nice stuff C++ has, vectors, templates, auto_ptr etc etc.

    I got game loop to work and thats the most important thing.
    And even more important for me, all the timing code (fixed fps) etc.
    I dont know how to code it properly.

    So i have the power of nxPascal and power of C++ / STL at my hands.
    I wanted to try and do this for a long time now.

    I once tried this, but got so many errors and i gave up.
    Now i found that i actually already had some generated .hpp and .obj files from nxPascal sources and decided to try again.

    Add files carefully to C++ Builder project and compile each time and link.
    Finally it compiles everything and no unresolved things or such.

    Had to of course derive from nxPascal classes like in Delphi. But again this was also very good learning step. C++ is not new to me but alot is unknown for me. Because im more of a Delphi guy. Doing this "porting" is good exercise.

    EDIT: cube is rotating on the screen

    I can still use all the code of yours, nxTypes etc, only difference is that instead of Pascal syntax i have to use C++ syntax, all the stuff is available. GetMouseRay etc etc.
    Ofc. after you do some major updates, i have to rebuild fully.
    Last edited by hwnd; 31-07-2013 at 10:24 PM.

  3. #3
    Quote Originally Posted by hwnd View Post
    I have plan to rewrite my editor in C++ Builder because of all the nice stuff C++ has, vectors, templates, auto_ptr etc etc.
    On defence of pascal language, it has all those features aswell. Vectors - TList, inc(pointer_variable) etc. I cannot say about templates, generics whatever, it is my assumption they exist in some form in FPC, but i don't use them.

    If i understood right, you are somehow using pascal-compiled object files with C++, then just making header files for it? This might not be crossplatform way at least, not even 32-64-bit compatible. But if you create something that could be shared in public, i could let you upload to new folder in SVN trunk. (I cannot say that i would be able to test it though :/ )
    Last edited by User137; 01-08-2013 at 01:33 PM.

  4. #4
    Quote Originally Posted by User137 View Post
    On defence of pascal language, it has all those features aswell. Vectors - TList, inc(pointer_variable) etc. I cannot say about templates, generics whatever, it is my assumption they exist in some form in FPC, but i don't use them.
    I know, i like Delphi more, its compiler is faster than BCB6. I can modify something in my Delphi project src and run and see the results immediately, Delphi compiler is so fast (talking about D7 here). The more recent version the slower the compiler is.
    In BCB its pretty slow. I know it has to compile also alot but still its faster than i guess the BCB2009 and newer.
    Whats really bad in case of BCB6, the TBX and TB2k do not work well in it. I get lots of out of memory access violations and BCB6 IDE just crashes and doesnt allow itself to close.
    There seems to be no free replacement for TB2K / TBX addon. Just the ugly default TToolbar and TMainmenu. But with TBX its possible to make alot nicer interfaces.
    For my script compiler i use Delphi and im able to use TBX there, all working smoothly.

    Also it works fine in CodeGear BCB2007 but it doesnt like the BCB6 for some reason. Too bad..

    And to be even more honest with you, im not sure if i will convert it to BCB.
    I could and already use some DLLs made in BCB for texture caches etc, using STL stuff in DLL. And using in my editor project.

    All works fine.
    I have to think about it.

    Quote Originally Posted by User137 View Post
    If i understood right, you are somehow using pascal-compiled object files with C++, then just making header files for it? This might not be crossplatform way at least, not even 32-64-bit compatible. But if you create something that could be shared in public, i could let you upload to new folder in SVN trunk. (I cannot say that i would be able to test it though :/ )
    Yes, BCB generated .hpp and .obj files from Delphi DCUs and links them into exe.
    I wish Delphi could link PURE C++ .obj files / libs into its exes. And if this would allow to link stl stuff in, i would be very happy.

    But atm we must use DLL's, at least they invented DLLs.

    To be honest in my projects i dont care about crossplatform. GTA2 is only for WIN32 so is my editor.
    And also i dont make games so much. At least currently.
    Im not very much interested in latest XE4 also, it has some new and maybe even crossplatform things in it. But i dont know. I havent read about this. I know it should support 64bit but i dont have such computers. People talk pretty bad things about latest versions. People constantly leaving or laid off from Embarc. etc. Bad things going on.
    I have seen many articles from real ex. people from inside Embarc. talking about how bad things inside Embarc. actually are.

    I miss the good "old" Borland.

    If you would want to include this BCB version in svn, then i will have to make it more clean and more professional. Atm its quick and dirty. But i guess it wont hurt to add BCB version there.
    Last edited by hwnd; 01-08-2013 at 02:40 PM.

  5. #5
    Any ideas how implement undo redo guys?
    I have tried several Delphi units for undo/redo, even with command patters and state machines. Even dig out some website archives for SHAREWARE (!) Delphi units for creating undo / redo and mailed to authors of them to get the units for free (without much hope for any response).
    Etc.

    I got them but nothing works for me. I see "lots" of examples that use simple TBitmap.SaveToStream method.
    Its neat and easy way to make undo / redo.

    But how about 3D map editor like this?
    Map is 256x256x8 (W*H*Z), i only draw small portion of it (20x20).

    I guess i have to invent "gamemap.portion.savetostream" command.

    Whole uncompressed map takes 6MB of disk space, depending how complex map is. But 6MB is minimum for empty map.
    So saving whole map each time is not way to go. it would work for small tilemaps / tilemap editors, but not in this case.

    One way would be just save all the blocks in current view but if camera moves, then what to do?
    I tried that without moving cam, it seems to work, its buggy a bit, i just cant think clearly atm why its buggy, i have to eat and come back to this.

    When camera moves i guess i have to remember the offset to the place where previous undo / redo was made or something and undo / redo in that area, or make some record and in record make a member called XYZpos for storing the start position of the area where the changes were made, dunno something like that maybe.

    Map has so easy format, i didnt know that making a undo/redo will be so difficult for this.
    I have read that if you dont think about undo/redo at the first time you create your app, integrating later any of the algorithms for undo/redo will be difficult.

    So i guess here i am.

    I could modify my rendering function if i could reorganize my map array somehow.

    This is where i need your help / tips / tricks / ideas how to do it.
    Even some pseudo code would help i guess.

    Thanks.
    Last edited by hwnd; 02-08-2013 at 03:57 PM.

  6. #6
    Few ways come to mind. All solutions consist primarily of array or list of undo operations. But what each operation is, may differ:
    1) Compress the map using TCompressionStream and TDecompressionStream. Your data size per undo-operation might go down to some number measured in kilobytes.

    2) Just save the action what was done, not whole map (unless necessary). You can make base-class TUndoAction, and inherit from it like:
    Code:
    // Some action where you select rectangular area, and move it in some direction...
    TMoveUndoAction = class(TUndoAction)
    public
      selEnd, selSize, moveDelta: TVector3f;
      procedure Execute; override;
    end;
    
    // Free tile-painting for map. You might need to save the entire map for this, so you can use the TCompressionStream
    // to write in TMemoryStream.
    TPaintUndoAction = class(TUndoAction)
    public
      map: TMemoryStream;
      procedure Execute; override;
    end;
    You get the idea, there can be lots of kinds of undo operations, some of which may not be related to tiles at all. And i'm not sure what all your editor can do.

  7. #7
    Ohh, you gave me great idea about compressionstream.. Thanks.
    I did a quick test atm, official large map fully compressed is 1.23MB.
    It contains lots of cubes / tiles. After 7z: 343KB

    Empty map, compressed 273KB.
    And now compressed with 7z: 385 bytes lol.

    This map format contains lots of 0. Thats why 7z is able to compress it so well.
    I will try with compressionstreams..

    Yes maps must be first compressed with specific way, before game is able to load them.
    For undo its not needed.

    This of course probably will be the easiest solution. Just take whole map and compress.
    And if i limit undo count, maybe it will even work.

    Atm i would like just to have undo / redo for tile "painting".

Tags for this Thread

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
  •