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
    The logic is pretty tricky there. It's hard to figure out things if code is badly formatted and contains lot's of commented out lines of code from debug time. In my case this quickly builds up and i have source where most of the space is wasted by commented out lines. So i started to rewriting this thingy and that's the reason why i wanted to init nxPascal with button (actually menu item later). So i can slowly move on with GUI. And at the same time continue with rendering part.

    And that initializing stuff stopped me. I will try to make this work first. I will let you know how it goes.

    Of course im not rewriting this from 0 again, it's just i wanted to move on with GUI and move the existing code to this fresh GUI and at the same time cleanup and debug my code.

    Also from the video above it's possible to see that flat (transparent) faces bug, graffiti on the walls, Z fighting (flickering). Not a big problem but just looks bad for eyes. Nothing else.
    I have to add some very small value to flat vertices, like 0.001 or 0.01 or something like that.
    Last edited by hwnd; 29-01-2013 at 09:17 PM.

  2. #2
    Little log again.

    I worked on the editor GUI and added many things and debugged at the same time.
    I added the docking tiles panel where the tiles will be drawn later (on the grid) and some tile info (like small selected tile preview). For docking panel i used old but working component DockPanel from http://www.torry.net/pages.php?s=79

    (DockPanel is a component which was originally created for the open perl IDE. This release has been modified to be substantially easier to use, requiring virtually no code to actually impliment it, and a few new features including tabposition, and Tabtype (Icon or strictly text). This produces a docking style similiar to that which is seen in Delphi, and Homesite.)

    Does it's job very well and it's very easy to get up and running. Whats even better, it saves it's positions. I don't have to do anything. Also made the menu items to show and hide the side panels, including tiles panel. Made the shortcuts to work.
    Messed with FormShortCut handler to handle any shortcuts or things except the 4 arrow keys. I will handle these by my own:
    Code:
    procedure TfrmMain.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
    var Key: Word;
    begin
    
      if MenuToolbar.IsShortCut(Msg) then
      begin
        Handled := True;
      end;
    
      Key := Msg.CharCode;
      
      //We handle arrow keys by our own
      if Key in [37..40] then
        Handled := False
      else
        Handled := True;
    end;
    I need this so that arrow keys will not mess with components on the form like some Listboxes or buttons, in old versions of editor i had this problem. Arrow keys were messing up everything.
    This handles the issue for me.
    Also i figured out why nxPascal didn't receive a Key values in GameLoop. That was that shortcut thingy again.
    Now it works and i can move my camera movement to gameloop now.


    That's it for now. I must wake up early so i will go to sleep.
    Last edited by hwnd; 30-01-2013 at 01:55 AM.

  3. #3
    I was surfing whole day on he net and found a good tutorial how to make dynamic and more than 8 lights with opengl.
    I downloaded the example, messed around with it alot to understand what he is doing.
    He used simple .obj model for lighting effect but i slowly added my own test vertex coords from map editor and i got it working with my vertices. The results look very very promising for me, im very happy with results so far.

    I believe i can show lights like these in my editor very soon:
    http://img853.imageshack.us/img853/683/lights2w.png
    http://img72.imageshack.us/img72/1940/edtrlights.png
    Last edited by hwnd; 03-02-2013 at 07:04 PM.

  4. #4
    Nothing much to write atm but i took a small break from this thing. Currently im working on that "logic" that draws the transparent faces (walls) and with some slopes that had problems previously, fortunately there is only 4 of them that need special handling when rendering them.

    Im making them work face by face. Easier in that case. Not writing all out and then debugging.
    Found more lighting examples, but i must review each of them, find their pros and cons and find one that works at the best in my case.

  5. #5
    Worked a bit on generation of minimaps (map thumbnails) (256x256 in size). Few examples:









    It's not final ofc. I noticed some small problems with it. It's skips some things.
    Last edited by hwnd; 10-02-2013 at 08:32 PM.

  6. #6
    It looks cool, but why so red/yellow city?

  7. #7
    Actually the maps are not yellow, just minimaps, just the way i generate colors, i take some color and then take into account the actual Z of the X,Y,Z loop and doing "COLOR or Z" logical op. And take into account the "ground type" at current X,Y,Z This results the "yellow" minimaps.
    Now if i look at them i think they are too yellow.

    I work with 64x64 tiles, there can be max 991 of them. Its very slow to actually loop through entire map and resize all textures to 1x1 pixel and draw bmp, this way it would match colors of actual map but i have to find a faster way of doing this. I did some quick tests. Of course i did all in one X,Y,Z "triple" loop. Alot of repeating.

    Will try something else later.


    Also i made the camera move to work with mouse dragging on the minimap. Even on the scaled down version of minimap which i needed very much, because 256x256 on the form is way too big.
    Very simple math. Sadly i didn't figure out this by myself but thanks to one open source fpc project. But it works perfectly.
    Last edited by hwnd; 10-02-2013 at 10:19 PM.

  8. #8
    Found a bit of motivation to fix bug with rendering of flat (transparent) faces. Marked as arrows:





    What i have to do for rendering and picking such faces is to add additional vertex coords for all slopes.
    When i do picking i have to check if face is flat or not and process specific vertex data.
    I tried this method on few slopes and it worked fine.

    Also i fixed today the flickering of flat faces (graffiti) on the walls. Added a 0.001 value.

    EDIT: also added minimap to editor and navigating on the map when moving small rectangle on the minimap with mouse. Minimaps are not yellow now, i still have to tweak it but not much.
    That's all for now. Gtg to sleep.
    Last edited by hwnd; 12-02-2013 at 03:40 AM.

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
  •