Results 1 to 2 of 2

Thread: VB6 R-Tree Demo for large Game-Maps

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    VB6 R-Tree Demo for large Game-Maps

    In larger 2D (or 2.5D) Games, there's often the question of efficient Map-Handling...
    Not only with regards to Map-creation or -definition, but also with regards to efficient re-rendering after the View-Rectangle was shifted.

    This Demo addresses these questions, by placing *all* the resources in a little SQLite-DB in the App-Path.
    (it contains Routines, which can import Tile- and Map-Placment-Infos into this DB efficiently).

    It also contains Code, which demonstrates an efficient Selection (via SQL, in about 1msec) of:
    - all Tile-Types which are fully contained in the current View-Window, as well as
    - all Tile-Types which are only partially contained (overlap) with the current View-Window

    The reason for the good query-performance (even if your world is made up, out of Millions of different Tiles),
    is the SQLite RTree-Module (demonstrated in Class cTilePlacments).

    Beginners should not be discouraged, the Code-Volume in each of the 4 Modules is (on average) only 50 Lines.
    It is also well-commented, and to get a first impression how everything works together, perhaps start with stepping through with the <F8>-Key.

    Here is, what it looks like:


    At the Top-Left-Corner there's a little PicBox, which shows the "global World" in its entirety.
    Within that PicBox is a little red-bordered Shape-Rectangle, which can be moved with the Mouse...
    And when moved, the "View-Window" (in our case the entire Form) will "follow along", rendering the found Tiles in that View...

    Ok, here's the Source-Code: RTreeMapDemo.zip

    Have fun,

    Olaf

  2. #2
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: VB6 R-Tree Demo for large Game-Maps

    Thanks Olaf, this is a gem of a work! Looking forward to analyzing it. PNG's used are much appreciated!

    Name:  Another Piece Secured.jpg
Views: 352
Size:  151.0 KB

Posting Permissions

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



Click Here to Expand Forum to Full Width