Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Map sizes

Discussion in 'General Discussion' started by Deleted User, Feb 15, 2016.

  1. Deleted User

    Deleted User

    Guest

    N1warhead likes this.
  2. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    16.

    I think.
     
    N1warhead and Deleted User like this.
  3. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    967
    16
     
    N1warhead likes this.
  4. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    967
    To elaborate, think of it this way, 1x1km is 1 km^2. With 4x4, how many 1x1 squares can you fit? 16.
     
    N1warhead and Deleted User like this.
  5. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
  6. Deleted User

    Deleted User

    Guest

  7. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    967
    You can do bigger than 16 though, at least in Unity, don't know about lumberyard but I'd guess there as well. Moving 4km from the origin shouldn't cause any problems for most games, even 6 or 8 could be OK. But you've got to remember that you can move equally far in the opposite direction, giving you 8x8 or even 16x16 km.
     
  8. Deleted User

    Deleted User

    Guest

    You can do bigger in anything with a point of origin reset and a tiled async streamed setup..
     
  9. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    967
    Yeah but I mean out of the box today.
     
  10. Deleted User

    Deleted User

    Guest

    Oh ok, I've moved out the way of doing massive openworld games since filling it with stuff was quite the problem. But yeah I agree ;)..
     
  11. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,301
    It is area_size = width * height. Therefore 4 km * 4 km = 16 km^2.

    Also, you can go bigger than 4 km.

    Floating point precision (for single precision floats).is six decimal digits. After that it depends on minimum precision you want to maintain. So, if you want to retain 1cm precision anywhere, it'll be 1cm * 1000000 = 10km. Since 10 is not a power of two, we could take 8km. The thing is it is +- 8km, not 8 km, so that'll be 16x16 = 256 km^2. With 4x4 area minimum preision will be less than 1cm. However, you should still be able to maintain megastructures beyond the area (as long as it doesn't bork enlighten).
     
  12. AlanGameDev

    AlanGameDev

    Joined:
    Jun 30, 2012
    Posts:
    437
    Neither. It's 16km², or 16 square-kilometers; or maybe even (4km)², or 4km 'squared'.

    Square-meters have nothing to do with the quantity of meters squared (i.e.: to the power of two). The former is an area measurement unit.
    If you have a 16m² (square-meters) area, and it's a square, then the length of sides are the square root of that number.
    It's easier to think in 'meters of area' rather than square meters or m² to avoid confusion with 'squared'.

    In other words, you're talking about 16(m^2), and not (16m)^2, which could be interpreted as 256 'linear' meters, although that's wrong unless you're talking about a 'strip' of 1m×256m. I'd say that (16m)^2 is better defined as a square of 16m×16m.

    I also had this doubt when I was a kid. Used to argue with my father. To me you could fit 256 1m×1m squares in a 16m² area. I thought that number was the measurement of one side of the 'square', I used to mix it up with 'squared'. Then I started to think of it as 'area' and eventually got used to it.

    Edit:
    Think of square-meter as a square of 1m×1m, so in other words, 16m² is nothing more than:
    16×1m²,
    or:
    16×(1m×1m),
    or:
    a quantity of 16 of these 1m×1m squares.

    Edit:
    You could as well use a 2m×2m 'square' as a measurement unit, so you could say that 16m² is the same as 4×(2m×2m), or even better, 2×(4m×2m), or better yet, 1×(4m×4m)... oops...
     
    Last edited: Feb 16, 2016
    angrypenguin, Deleted User and Ryiah like this.
  13. Deleted User

    Deleted User

    Guest

    @BeliarTheEvil

    Ahhh had some nice refreshing sleep, actually "16KM Squared" is english phraseology and is completely correct. I won the "debate" anyway, thanks again everyone..

    Ever had it where you're really tired, look at a word and think.. That doesn't sound right even though you've spelt it right?
     
  14. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
    All the time. Usually when I've been using it excessively.
     
    Teravisor and Deleted User like this.
  15. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,373
    when you square the unit you always have to multiply the one-dimensional values too, so:

    4 km * 4 km = 4*4 [km*km] = 16 km^2
     
    Ryiah and Deleted User like this.
  16. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    967
    That's an oversimplification. The precision at a given distance, the epsilon, can easily be computed with something like this:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using System.Runtime.InteropServices;
    5.  
    6. public class FloatEpsilon : MonoBehaviour
    7. {
    8.     [StructLayout(LayoutKind.Explicit)]
    9.     public struct FloatIntUnion
    10.     {
    11.         [FieldOffset(0)]
    12.         public uint intValue;
    13.         [FieldOffset(0)]
    14.         public float floatValue;      
    15.     }
    16.  
    17.     public float Epsilon(float value)
    18.     {
    19.         FloatIntUnion u = default(FloatIntUnion);
    20.         u.floatValue = value;
    21.         u.intValue++;
    22.         return u.floatValue - value;
    23.     }
    24.  
    25.     void Start()
    26.     {
    27.         for (float f = 1; f <= 8192f; f *= 2f)
    28.         {
    29.             Debug.LogFormat("Value: {0} -- Epsilon: {1}", f-1f, Epsilon(f-1f));
    30.         }
    31.     }
    32. }
    33.  
    As you can see from this, the precision at 8km out, is ~0.000488, about half a millimeter if your units are meters.

    That's not the only issue though, you might run into stability issues as well, for example with physics. The problem comes from doing operations on values that differ in orders of magnitude. Imagine a physics rigidbody at a large distance from the origin, moving with a low velocity -- in the period of one timestep, the delta movement of this object might end up being lower than the precision, and due to rounding it will end up not moving at all.

    The only way to determine if this is acceptable to your game is to try it out at the maximum distance. From the experiments I've done, 4km from the origin is totally fine for your average first/third person game, 8km is pushing it but should probably be OK if you're not doing a lot of physics.
     
    Ryiah and Deleted User like this.