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

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

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

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

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

  6. #6
    You can read the limitations on wiki:
    http://www.opengl.org/wiki/NPOT_Texture
    Bottom line: "All newer hardware can handle NPOTs of any kind perfectly."

    While i still had that white/black texture bug myself because of 3, 4 thing, i implemented the TQuadTexture class. It divides the texture into power of 2 texture parts. There's also 2 different loading options for textures:
    toScale: Loads image into power of 2 texture, and scales to nearest match. For example 400x900 would round to 512x1024.
    toFitScale: Loads image into power of 2 texture, and makes the size to current or higher match. This actually doesn't scale, but leaves black gaps on the outside area. Each texture has separately SizeX, SizeY, Width, Height, where Width/Height is the actual image size, and SizeX, SizeY is texture size. So nx drawing functions still know how to deal with them.

    QuadTexture - Reserves near exactly the needed area from memory, pixel perfect.
    toScale - May cause slight blurring, pixel perfect data is propably lost, memory efficient.
    toFitScale - Keeps pixel perfection but reserves more memory than QuadTexture, propably not very usable on 3D-models.
    (no option at all) - Pixel perfect, memory efficient non power of 2, if card supports it.
    Last edited by User137; 17-02-2013 at 04:04 PM.

  7. #7
    About getting black textures when trying to deal with non-POT stuff, I had the same problem until I began to include this in my texture loading code:
    Code:
    glPixelStorei(GL_UNPACK_ALIGNMENT,1);

  8. #8
    Quote Originally Posted by User137 View Post
    toFitScale - Keeps pixel perfection but reserves more memory than QuadTexture, propably not very usable on 3D-models.
    Why not very usable on 3D models?
    I tried these options and best seems to be toFitScale.
    The other one blurs too much.

    All my 3D models are just small "planes". For ped i created this:
    Code:
    model.CreatePlane(2,2);
    2,2 is ofc too big for ped, it's just for testing purposes. Later it will be even smaller.

    But loading NPOT textures from file seems to work fine.
    Will try later how to supply img data from memory to it and how it renders them.

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
  •