Page 2 of 13 FirstFirst 123412 ... LastLast
Results 11 to 20 of 121

Thread: G.T.A.2 Map Editor

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

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

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

  4. #14
    I finally fixed problems with slopes 49-52. All there is now with slopes is to add flat faces (not all slopes can have them) and add picking code back.
    Some slopes do not have flat faces but i must verify each slope in GTA2 to actually see how it renders each slope flat faces.

    Also i added the LID shading (fake shadows) which do look pretty good.
    Arrows show the thing.

  5. #15
    Do you have rendering order for transparent surfaces? With Z-buffer alone they would show up bugged depending on camera angle.

  6. #16
    I guess you mean Z fighting? I had these problems, it was very ugly when i rotated the cam and i solved it with small value (0.001) added / subtracted from either Z or X vertex coords and now they don't flicker.
    The faces are drawn with that tiny offset but it's very hard to see anything unless you look very close to the flat face.
    And no, i don't have any specific order of rendering.

    Atm, im trying to draw zones (areas) with nx.CreatePlane with specific colors and alpha (so you can see through it).
    Last edited by hwnd; 16-02-2013 at 10:57 AM.

  7. #17
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    It depends on how the type of transparency if you need to sort transparent meshes, it's hard to tell from the screenshots if the textures are fully blended with an 8 bit alpha channel (requires sorting, think an additive blend of a fire particle system) or if pixels of a certain colour are discarded (results in 'sharp' edges where the transparent coloured pixels would meet the textured pixels, so no actual blending of Source Colour to Destination, does not require sorting).

    For extra FPS in any renderer, you should render front to back to minimize overdraw (zbuffer discards fragments before they're rasterized if they're behind what's already been written(drawn) to the buffer(Screen).

    For a top down view on a planar world (like GTA2 maps) you probably wouldn't save much to make sorting a worthwhile option as very little is rendered behind visible geometry. However if the camera is looking out across the map from an FPS like perspective then you'll benifit from sorting before you render each frame.

    I see that the visible portion of the map in your editor is clipped to a quad that is centered on the cameras position, are you also able to render the map clipped to the cameras view frustum? I think it'd be awesome if you could walk around the map in first person!
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

  8. #18
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    oh and btw to render your minimap, you could use GL Framebuffers and then as a pre-process before you start the render loop, put your camera into orthographic projection, place it in the middle of your world, set the width and height to the bounds of the world and then render the whole lot into the Framebuffer (yes might take a fraction of a second to complete but you don't need to do it every frame). then you have a texture (or renderbuffer etc) in truecolour of your entire map that you can render as a textured quad (or blit the render buffer etc). You might want to exclude things from this map render pass that you don't want visible on the map, like say walkways across roads that might result in spidery grid like patterns on the image.
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

  9. #19
    Hi. Thanks for your replies.
    Yes, map rendering is limited, because i can't draw whole map at once. Fps goes down to 1-2 then.
    I was thinking about walking around in city as in FPS games, but i don't know how it will look like. Because all blocks are 1*1*1 units in size. Some guys made a conversion for GTA San Andreas but i have to tell you, it looked very bad. At least for me. These blocks (maps) are not meant for FPS style. Maybe it will look better, if you create a race game with some "lowrider" and then drive around with camera almost on the ground but 3D car physics is not for me.

    What i want to do is make the ped walking around in the map, actually i already have it but without any collisions.
    I have collision code also, but just have been lazy to include it.

    However i will try to look again at the map with low camera position (ground view) and how it looks.
    Maybe if i scale blocks up a bit, it will look better. I haven't tried that yet.

    The minimap method you posted is ok for game actually. But i found that original editor actually updates minimap as you remove / add / modify stuff (blocks) on the map.

    But i will use your idea for game minimap. So when game loads it's stuff, it will create minimap and renders it on some plane.

    I added displaying of zone names, the info it displays of course will be modified later.
    This is just a test.
    Got some neat text code from

    User137 It would be nice to have that 3D text thingy in nxPascal.
    I know you have fonts and stuff, but there is no functionality for 3D text that always faces the camera.

    And i can now display 3D text that's facing cam always, without glut.
    Few examples with zone names:

    Also thanks to neat InRange() function of Delphi i can only draw strings that are currently in visible range of map.
    Also thanks to nx.DrawScaled() i can draw neat planes for zones:
    Last edited by hwnd; 16-02-2013 at 04:21 PM.

  10. #20
    Quote Originally Posted by hwnd View Post
    It would be nice to have that 3D text thingy in nxPascal.
    I know you have fonts and stuff, but there is no functionality for 3D text that always faces the camera.
    Sorry, not having easy answer to this. There are many ways you can draw 3D text with nxPascal, i can tell a few:

    1) Using gluProject() you can transform 3D coordinate into where it's located on the 2D screen. Then you can draw the font in 2D ortho mode (nx.Enable2D()). There is nx.GetViewDetails() which will get you the OpenGL view details needed for gluProject() call.

    2) If you want truly 3D text like that guard name, and floating combat text like that:
    you could use a little matrix math. This could be simpler and more efficient if you use the nxPascal camera class, instead of relying on OpenGL matrix commands. To turn rendering towards camera, you would first read the camera rotation matrix and invert it. Multiply camera with the inverted rotation matrix. Then there's matter of drawing the font... 3D coordinates are usually in smaller scale, 1.0 meaning roughly 1 meter, whereas 1.0 in 2D is 1 pixel. So that must be drawn centered (there is draw function for that) and scaled smaller.

    Yes, map rendering is limited, because i can't draw whole map at once. Fps goes down to 1-2 then.
    Also about minimap, you could render it to framebuffer once, and then draw only the framebuffer afterwards. It's just 1 texture in practise, and wouldn't hurt FPS at all. I tried to show some use of framebuffers in the demos.
    Last edited by User137; 16-02-2013 at 05:35 PM.

Page 2 of 13 FirstFirst 123412 ... LastLast

Tags for this Thread


Posting Permissions

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