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
    Didn't notice your reply here. Thanks for the info. I will test these things when i get back the motivation.
    I am pretty tired lately and slightly sick because of the cold weather etc, i don't want to see the computer for a while now.

  2. #2
    User137 or anybody.

    I have a third party OpenGL app, actually GTA1 map editor from 1998, maybe uses OpenGL 1.1 or something, dunno. What's interesting in it is that it creates very nice minimap from map. I see that minimap uses same colors as actual map and any changes made in actual map are immediately visible on minimap.
    Its a C++ MFC app, there is no source available.

    Also it has option to also draw or not to draw transparent tiles on minimap.
    This makes me think that it actually draws scaled down tiles, but how he does it so fast.
    Thats the key question.

    Any ideas how it creates that minimap? It seems that it draws actual map in small size somehow, like scaled down someway. But all minimap colors are same as in actual map and i would like to do the same in my editor.

    In opengl, what could be used to create such minimaps? I dont think that it draws whole city twice, one in actual size and one like scaled down version. Or does it?
    And its fast, changes in big map are immediately modified on minimap also.

    I once tried drawing all tiles in 1x1 pixel for minimap but something was very slow. But it gave me same colors like in actual map.

    EDIT: ok i remember, drawing 1x1 pixel tiles for 256x256 minimap was slow.

    But one idea i have atm is to have big global list where all the current (LID) tiles are, actually their ID numbers and only these that are currently used will be scaled down to 1x1 and drawn with StretchDraw and not all.

    I just need something fast.
    Last edited by hwnd; 15-04-2013 at 09:47 PM.

  3. #3
    I can think of two posible solutions for this:
    1. Draw the whole map into some chached texture (render texture), then render visible portion of the map inside your windows and finally draw that whole texture scaled down to fit the minimap size. But this might not be nest solution especially if you have large map as you would require huge texture and scaling down such texture could lead to large inacuracies.
    2. Calculate and store average color for each posible ingame tile. Then use that store information to determine the color value for each of the pixels for minimap texture (each tile is represented as single pixel). Since you are changing one tile at a time you would only need to update one pixel at a time.

  4. #4
    SilverWarior has good tips. I would do 2) to hold 256x256 colored vertex array for the pixels. Render it into texture as a 256x256 grid, that's what framebuffer demo in nx is about. It might be a little complicated demo though. You can optimize it by having a boolean variable "minimapChanged". Every time you draw to tilemap it is set True. Then every half second check if it's True. If it is, then set it False and generate the minimap texture again. For actual map drawing you're only drawing 1 quad per frame. Change texture coordinates based on where the camera is.

    edit: You can draw the whole map as is into framebuffer, if you want to make it simple and memory efficient. It will just take longer time to render. But then you can zoom the minimap with texture detail, depending on the texture resolution used on minimap. 512x512 would still only show you 2x2 area of 1 tile, but it's much more detail than 1 pixel.

    And, what it means to draw into texture... Think if it as drawing the whole map onto your screen in ortho mode. Scaled exactly in area of texture resolution 512x512 if that's what it is. You should definitely test by rendering it on screen first to see that the boundaries are right, and then switch to render it to texture.
    Last edited by User137; 16-04-2013 at 04:16 PM.

  5. #5
    Quote Originally Posted by User137 View Post
    I would do 2) to hold 256x256 colored vertex array for the pixels.
    Why bothering with veticles if you can simply do this with normal pixels. You can always stretch that texture to fit the desired size if needed.

    Quote Originally Posted by User137 View Post
    You can optimize it by having a boolean variable "minimapChanged". Every time you draw to tilemap it is set True. Then every half second check if it's True. If it is, then set it False and generate the minimap texture again.
    Why not change minimap texture as soon as you do any change to the map? Since you are usually changing one tile at a time this means that you only need to change one pixel or smal portion of your map if it is generated from map-specific mini sprites. I mean there is absolutely no need to redraw the whole map but only change the relevant part of it.

    As for your suggested approach that is more suitable to be used inside a game where map changes are more rapid (unit movments etc.) but in map editor there is no use of that.

  6. #6
    Oh you mean altering the texture data directly. Well, you might have glTexSubImage2D(), but i don't have experience of that.

    With normal methods you aren't able to change just 1 pixel, but render the whole minimap. Besides when you're editing the map you are watching the main screen where cursor is. By the time you move your eyes to minimap, with 500ms interval it would already be updated. And in the playing mode the minimap is normally not changing. Or if it, you can have an additional transparent map texture for dynamic objects.

    I just uploaded new nxPascal to SVN, with change to framebuffer demo. I had previously left it with window size locked to framebuffer size 512x512, but now it works with any window size, to emphasize the fact that screen buffer size has nothing to do with texture size.

  7. #7
    Quote Originally Posted by User137 View Post
    Oh you mean altering the texture data directly. Well, you might have glTexSubImage2D(), but i don't have experience of that.
    To be honest I also don't have much expirience with this, especially on OpenGL level. I did try once achiving this using Aphyre Sphinx TAsphyreLockableTexture which provides you with acces to each pictures pixel if needed but I don't know which OpenGL cal the Asphyre Sphinx makes for this to work.
    Another way would be to simply use ordinary TBitmap to store minimaps data and then render this butmap on screen (many graphical engines alows doing this).


    Quote Originally Posted by User137 View Post
    Besides when you're editing the map you are watching the main screen where cursor is. By the time you move your eyes to minimap, with 500ms interval it would already be updated.
    @User137 if you need 500ms to change your eyes focus from one point on the monitor to another you gotta be getting realy old
    Plese don't be ofended by my previous statement but 500ms is enough for average human not ony change the focus of his eyes from one point to another but to even turn his head for about 30 degres.
    Also you have to asume that user decides to change his eyes focus at the same time he decides to do a mouse click. And since it takes a bit of time from the pint when you decide to do mouse click and actually do it your eyes could already be on the half way to destination focus point.


    Quote Originally Posted by User137 View Post
    And in the playing mode the minimap is normally not changing. Or if it, you can have an additional transparent map texture for dynamic objects.
    Yes using multiple layers for ingame minimaps is quite often especially if the minimap background is made from series of so caled minisprites.

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
  •