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
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    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.

  2. #2
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    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.

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


    EDIT:
    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 http://wiki.delphigl.com/index.php/wglUseFontBitmaps

    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:
    http://img521.imageshack.us/img521/7585/zonenames.png


    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:
    http://img405.imageshack.us/img405/3905/zonearea.jpg
    Last edited by hwnd; 16-02-2013 at 04:21 PM.

  4. #4
    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:
    http://static.ddmcdn.com/gif/wow-guide-4.jpg
    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.

  5. #5
    Ok, i will try.

    Any ideas how to handle textures that are not POT? Not 16x16, not 32x32, not 64x64.
    But like 30x26, 8x64 etc.

    How to make opengl accept them and center them on the quad to draw them properly?
    If every texture like this has black background (for transparency) and if i go through each images background and find a pixel that is not black and if i copy all non black pixels to memory to create texture from, will this work?

    Will it be very slow?

    I need to handle such small non POT textures because GTA2 uses them for sprites like peds, map objects, guns etc.

  6. #6
    Non power of 2 textures work by default on nxPascal. I can still remember the key issue there used to be
    Code:
    glTexImage2D(GL_TEXTURE_2D, 0, intFormat, sizeX, sizeY, 0, Format, GL_UNSIGNED_BYTE, Data);
    I used to have intFormat 3 or 4, but it should be GL_RGBA or GL_RGB if no alpha channel. There were no other special tricks to make them work

  7. #7
    But what about OpenGL itself, i have read that he doesn't like such textures very much.
    And some guys were getting black textures instead of actual textures on some cards.
    But i also have read that GL 1.1 should support them. Dunno what's true and what's not.

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
  •