Results 1 to 13 of 13

Thread: Open World Template

  1. #1
    Member sdfgeoff's Avatar
    Join Date
    May 2010
    Location
    Kalpana One
    Posts
    5,039

    Open World Template

    Well, Someone the other day wanted a simple setup for an open world game that dynamically loads whatever the player is near. So I made one!
    -----------------------------------------------------------------------------------------------
    What it does:
    Dynamically loads and frees blend files that are near the player based on a naming scheme (a 3x3 grid around the player)

    What it does not do:
    Manage saves/loads of world sections - if you do something, move away and come back, it will probably be undone.
    If the player moves to fast, sections of world may not have loaded in time. So as the game creator: make the tiles big enough the player can't cross them really fast, but small enough to load fast.
    -----------------------------------------------------------------------------------------------
    Read the readme in the zip file for more information.

    i got bored making colored tiles for the world sections, so it's 5x5 with some gaps, I see no reason why this couldn't be 1000x1000, and there's no problem with gaps in places ie: water so you don't have to have the underwater sections. Just use the names to represent where you want the pieces to be loaded.


    Things to consider doing later (probably won't unless someone really asks for it):

    Load things in a 5x5 grid around the player to minimize the probability of the player seeing the edge.
    Prevent the player moving to within viewing range of the edge using invisible collision walls
    World Wrapping



    Well, here's the blend/zip of lots of blends:
    Open World Template.zip
    "Someone applied a roof texture to that wall" - martinsh

    Website: www.sdfgeoff.space



  2. #2
    Member 3d solar system builder's Avatar
    Join Date
    Mar 2012
    Location
    texas
    Posts
    1,902
    I tried to change line 3.So i changed it to what was in the console.Which is this.PLAYER_OBJECT = 'cubeactive_camera'
    I still get a error.



  3. #3
    Member sdfgeoff's Avatar
    Join Date
    May 2010
    Location
    Kalpana One
    Posts
    5,039
    You can change it either to:
    PLAYER_OBJECT = 'active_camera'

    Or you can pick any object in character.blend and chance line 3 to:
    PLAYER_OBJECT = 'object_name_here'
    "Someone applied a roof texture to that wall" - martinsh

    Website: www.sdfgeoff.space



  4. #4
    Member 3d solar system builder's Avatar
    Join Date
    Mar 2012
    Location
    texas
    Posts
    1,902
    Okay thankyou.



  5. #5
    Member
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    5
    if i start the base file with my player, the view does't switch to the characters view. how can i fix this?



  6. #6
    I made line 3 PLAYER_OBJECT = 'active_camera'.And i get this error.

    I am using 2.73.




    Code:
    Blender Game Engine Started
    Loading chunk (0, 1)
    Loading chunk (0, 0)
    Loading chunk (2, -1)
    Warning: Unable to open 'C:\Users\barbara\Desktop\Open World Template\World Sections\world_2_-1.blend': No such file or directory
    Continuing anyway. Hopefully it is the edge of the world!
    Loading chunk (2, 1)
    Loading chunk (2, 0)
    Loading chunk (0, -1)
    Loading chunk (1, 0)
    Loading chunk (1, -1)
    Warning: Unable to open 'C:\Users\barbara\Desktop\Open World Template\World Sections\world_1_-1.blend': No such file or directory
    Continuing anyway. Hopefully it is the edge of the world!
    Loading chunk (1, 1)
    Blender Game Engine Finished
    Last edited by Lostscience; 01-Sep-15 at 14:02.



  7. #7
    Member sdfgeoff's Avatar
    Join Date
    May 2010
    Location
    Kalpana One
    Posts
    5,039
    You may notice the line:
    Continuing anyway. Hopefully it is the edge of the world!
    That is because the system does not know how big the world is, and if it can't load a segment, it prints out the warning.

    Anyway, the problem is that .... I made a typo. Change line 3 into:
    Code:
    PLAYER_OBJECT = 'Cube'
    And the world should now load around the player.
    "Someone applied a roof texture to that wall" - martinsh

    Website: www.sdfgeoff.space



  8. #8
    I did not know you had to move around the ground planes in the areas they should be.This does not dynamically load and free the terrains.It loads them all at ounce from each blend.I was expecting more than this.



  9. #9
    Member sdfgeoff's Avatar
    Join Date
    May 2010
    Location
    Kalpana One
    Posts
    5,039
    No, it dynamically loads and frees them. It loads a 3x3 grid around the player. Anything outside that is freed from memory.
    Check the code. See the function called 'remove.' Add a print statement next to the libfree, and you'll see that stuff is being loaded and freed from memory as the player moves.
    "Someone applied a roof texture to that wall" - martinsh

    Website: www.sdfgeoff.space



  10. #10
    It is not freeing.Nothing is disappearing when the player moves away.Here is your openworld template back with my modifications.I got rid of the errors in the console.
    Attached Files Attached Files



  11. #11
    Member
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    5
    changing the line to: PLAYER_OBJECT='Cube'
    will just spawn a cube and no terrain is loading.

    changing the line to: PLAYER_OBJECT='player_mover'..............(my character) will load the world, but the view will not switch to fps view.



  12. #12
    Can I use this for a game?



  13. #13
    I just read the readme... oops.



Posting Permissions

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