Ejemplo n.º 1
0
        protected override void ThreadFunction()
        {
            ProgressTracker.Instance.PushActivity("Creating the " + MapSize.ToString());

            ProgressTracker.Instance.PushActivity("Allocating space");
            PreInitializeMap(MapSize, MapSeed);
            ProgressTracker.Instance.PopActivity();

            ProgressTracker.Instance.PushActivity("Populating");
            Map.Initialize();
            while (!Map.Initialized)
            {
                ThreadManager.Instance.Update();
            }
            ProgressTracker.Instance.PopActivity();

            if (GameManager.Instance.RenderEdges)
            {
                ProgressTracker.Instance.PushActivity("Moving data into graph module");
                EuclideanGraph.EuclideanGraph <Containers.Container> graph = new EuclideanGraph.EuclideanGraph <Containers.Container>();
                Util.LinkedList <Containers.Container> smallBodies         = Map.GetAllSmallBodies();
                foreach (Containers.Container body in smallBodies)
                {
                    graph.AddNode(body);
                }
                ProgressTracker.Instance.PopActivity();

                ProgressTracker.Instance.PushActivity("Creating graph");
                graph.GenerateDelaunayTriangulation();
                graph.GenerateMST();
                graph.AddNoise(MapSeed);
                ProgressTracker.Instance.PopActivity();

                ProgressTracker.Instance.PushActivity("Moving data out of graph module");
                WarpJumps = new List <CelestialBodyIdentifier[]>();
                foreach (Containers.Container[] edge in graph.GetEdges())
                {
                    WarpJumps.Add(new CelestialBodyIdentifier[]
                    {
                        edge[0].ID,
                        edge[1].ID
                    });
                }
                ProgressTracker.Instance.PopActivity();
            }
            else
            {
                WarpJumps = new List <CelestialBodyIdentifier[]>();
            }

            ProgressTracker.Instance.PopActivity();
        }
Ejemplo n.º 2
0
    private void DelaunayTest()
    {
        MapGenerator.ProgressTracker.Initialize();

        MapGenerator.Containers.Container Map = new MapGenerator.Containers.SolarSystem(new CelestialBodyIdentifier(CelestialBodyType.SolarSystem), 1216466133, true);
        Map.Initialize();
        MapGenerator.EuclideanGraph.EuclideanGraph <MapGenerator.Containers.Container> graph = new MapGenerator.EuclideanGraph.EuclideanGraph <MapGenerator.Containers.Container>();
        Util.LinkedList <MapGenerator.Containers.Container> smallBodies = Map.GetAllSmallBodies();
        foreach (MapGenerator.Containers.Container body in smallBodies)
        {
            graph.AddNode(body);
        }
        graph.GenerateDelaunayTriangulation();
    }