Page 1 of 4 123 ... LastLast
Results 1 to 10 of 34

Thread: Thyandyr's voxel engine

  1. #1

    Delphi Voxel Engine

    DVE - Delphi Voxel Engine

    https://github.com/Thyandyr/DVE
    Last edited by Thyandyr; 13-12-2017 at 08:47 PM.

  2. #2
    26/10/17 Didn't get anything done today. Trying to figure out best way to do chunk management.
    29/10/17 Some progress on chunk management. Next need to make my OpenGL code compatible with arbitrary amount of objects. Too late in the night to start that.
    Last edited by Thyandyr; 29-10-2017 at 11:05 PM.

  3. #3
    I see it is minecrafty. I'm not saying its bad.

    Since you're not using any framework, may be it can be used with SDL or Allegro or GLScene, can it?

    Also, did you plan to make it compatible with FreePascal?
    No signature provided yet.

  4. #4
    Quote Originally Posted by Ñuño Martínez View Post
    I see it is minecrafty. I'm not saying its bad.

    Since you're not using any framework, may be it can be used with SDL or Allegro or GLScene, can it?

    Also, did you plan to make it compatible with FreePascal?
    It looks like that yes, but it won't be minecrafty. Gamewise, I am juggling between Dwarf fortress, Master of Magic, UFO etc. It'll definitely be a management game. I like stuff like evolution and fuzzy logic and geological evolution. I have no idea how those ingredients turns into a game Maybe it'll just be my own sandbox for weird ideas.

    The engine itself should end up being relatively reusable so that I can use it for various things. Also because I do not know what I am doing, and I always forget everything so it needs to be something that is relatively easy to jump onto. I do not know what it entails to make it compatible with free pascal.

  5. #5
    In reference to freeing all the TChunks in TDictionary<string, TChunk>, how do I do it?

    I don't see a way to just do

    Code:
    for I = 0 to count-1 do 
      TDict.Items[0].Free
    as it is not sorted or indexable in that way

    Do I need to extract all the keys and then iterate with that list? That hardly seems like a smart way to do it.

    OK this works

    Code:
    for Chunk in TDict.Values do Chunk.Free
    Last edited by Thyandyr; 01-11-2017 at 09:32 PM.

  6. #6
    SO I'm adding lot of single values into one VBO. Things work OK until somewhere slightly above

    Vertices:467544
    Indices :100188
    Total :567732

    some (full) chunks just seem to be missing from where it should be on screen.

    So I draw 23 chunks size 11x11x11 and it all shows great, but 24 chunks and some start to disappear. If I draw 30 chunks it looks like swiss cheese!
    Last edited by Thyandyr; 01-11-2017 at 10:36 PM.

  7. #7
    Quote Originally Posted by Thyandyr View Post
    In reference to freeing all the TChunks in TDictionary<string, TChunk>, how do I do it?

    I don't see a way to just do

    Code:
    for I = 0 to count-1 do 
      TDict.Items[0].Free
    as it is not sorted or indexable in that way

    Do I need to extract all the keys and then iterate with that list? That hardly seems like a smart way to do it.

    OK this works

    Code:
    for Chunk in TDict.Values do Chunk.Free

    Uhhh... why aren't you just using a TObjectDictionary with "doOwnsValues" set in the ownerships parameter in the constructor? That's what they're there for. That way, it works exactly like a TObjectList that has OwnsObjects set to true, and you don't need to do anything at all in your destructor as all the dictionary values will be freed automatically.

    As far as your VBO problem, what kind of GPU are you using?
    Last edited by Akira13; 02-11-2017 at 01:16 AM.

  8. #8
    I have several dictionaries that juggle values between them, so I want to manage the lifetime of the contents myself. But when closing the program I rather empty all the dictionaries. I had a code looping the keys and then getting the values and then freeing the values. that resulted in mem leaks. But I found I can just iterate the values directly and free them. I just haven't used dictionary before. Anyway it is solved.

    For graphics card I have Nvidia GFX 860M or something like that. Laptop. I didn't see any notes about maximum size in the OpenGL documentation. Will continue on this issue tonight.

  9. #9
    I'm not sure exactly how TDictionary works but in general when you are removing items from Lists it is always better to go from last item to first instead of always removing first item in a loop. Why?
    Because when you remove first item from the list all other items needs to be shifted in order to fill the hole that you caused by removing that one item. This results in lots of unneeded data moving in the list internal array.

  10. #10
    Quote Originally Posted by SilverWarior View Post
    I'm not sure exactly how TDictionary works but in general when you are removing items from Lists it is always better to go from last item to first instead of always removing first item in a loop. Why?
    Because when you remove first item from the list all other items needs to be shifted in order to fill the hole that you caused by removing that one item. This results in lots of unneeded data moving in the list internal array.
    I agree and would have done it 'from count-1 downto 0' but that is not possible with TDictionary. Anyway freeing the Chunks is only for the program shutdown so performance is not that important anyway.

    Also I think if I do

    for Chunk in TDict.Values do Chunk.Free

    it still leaves the keys in, so the size of TDict size is not updated. Might be the size is not updated even if I removed the key as well, since there is some method to it called TrimExcess

    Didn't work much today.

    Fixed one bug, but made no progress on the case of too large VBO size causing full chunks disappear.

    Line of 11x11 size chunks along X axis. If I decrease the count by few they all fill a nice solid line as supposed to. Too many like here, and something gets corrupted. Note the closest artifact, the whole chunk is not missing, only half of it (It is hollow since none of the cubes that should not be visible are not drawn)

    Image2.jpg
    Last edited by Thyandyr; 03-11-2017 at 12:05 PM.

Page 1 of 4 123 ... LastLast

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
  •