3d GridWorld

Options
paulpach
edited February 2012 in Photon Server
I am initializing MmoWorld with 3d vectors. However, when I get the Max and Min, the Z component has some large number that is different from what I provided.

Does GridWorld support 3d grids? It is unclear from the documentation.

If not, can someone provide some pointers as to how to implement my own GridWorld that does?

Comments

  • Tobias
    Options
    The MMO Demo only supports 2d and elevation is faked throughout the demos (by height map). If you really need a height component, then you will have to go through all places where positions are used and change those.
    Make sure you only use the MMO Demo when you really need a lot of players in a seamless world. If you can fake a world by setting up multiple regions for < 20 players seeing each other, then you better use the Rooms as provided with the Lite Application.
  • Tobias. Yes, I am aware of the faked elevation. I already did go through all the code and changed it to use 3d positions, lower left corners, top right corners and tile sizes, both on the server and on the client.

    The roadblock I am facing is that the GridWorld class (for which no code is provided), is changing the Z components of the lower left, top right and tile size components, ignoring what I provide.
    Would it be possible for you to share the source of the GridWorld class? I would write my own based on it.

    In my game, I do want a seamless world, can't fake it. The MMO Demo is a perfect base for what I want to do, I just want to extend it to 3d.
  • Tobias
    Options
    I was answering out of my head and didn't realize this is part of the Socketserver assembly.
    I attached the GridWorld class source. Hope this helps.
    We decided to take a few hours next week and see if and how we release the source that currently hidden.

    Let us know how far you get with this class, ok? Thanks.
  • Tobias, thank you for the code. It served me well as an example of what I had to do.

    My world is "infinite" in 3d, and by infinite I mean limited only by the size of int. The total amount of regions is about 200K x 200K x 200K.

    In the GridWorld.cs class, all regions are instantiated up front, which I cannot do. So what I am doing is to instantiate the regions on demand. As players walk around, and their interest area causes GetRegion method calls on the world, regions are instantiated and kept in a ConcurrentDictionary. This works great. It is fast, and scalable. However, the problem I have is disposing of the regions once the player walks away. Currently, from the InterestArea class, there does not seem to be a method to override or way to detect if a region is no longer covered. Neither can I override anything in the Region class (methods are not virtual).

    Another problem is thread safety, I think the GetRegion api might not let me do this in a thread safe way. Rather than a GetRegion method, I think I need a "EnterRegion" which would atomically create and subscribe to a region, and a "ExitRegion" which would unsubscribe, and dispose (if no subscribers left) of the region.

    Would it be possible for you to provide the source for InterestArea, so that I can write my own to support this?

    Do you have any other idea of how to do this?
  • Tobias
    Options
    I'm sorry for the slow replies! Sometimes I get very distracted by work :(

    Your problem is one we have with rooms as well. We needed some way to track how many players are using it, so we came up with reference counting.
    I am attaching the InterestArea code and hope it helps.