public GameplayController() { commands = new Queue<DevCommand>(); tbSquadDecisions = new TimeBudget(SQUAD_BUDGET_BINS); tbEntityDecisions = new TimeBudget(ENTITY_BUDGET_BINS); tbFOWCalculations = new TimeBudget(FOW_BUDGET_BINS); }
public GameState() { UUIDGenerator.SetUUID(0); EntityHashSet = new Dictionary<int, IEntity>(); teams = new RTSTeam[MAX_PLAYERS]; activeTeams = new IndexedTeam[0]; Regions = new List<ImpactRegion>(); // No Data Yet Available VoxState = new VoxState(); VoxState.World.worldMin = Point.Zero; Scripts = new Dictionary<string, ReflectedScript>(); grid = new LevelGrid(); //grid.L0 = null; grid.L1 = null; grid.L2 = null; curFrame = 0; timePlayed = 0f; tbMemBuildings = new TimeBudget(BUILDING_MEMORIZATION_LATENCY); lckParticles = new object(); particles = new List<Particle>(); tmpParticles = new List<Particle>(); }
public void Hook(RTSRenderer renderer, GameState s, int ti) { ImageWidth = s.CGrid.numCells.X; ImageHeight = s.CGrid.numCells.Y; Terrain = renderer.CreateRenderTarget2D(ImageWidth, ImageHeight, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, RenderTargetUsage.DiscardContents); TeamIndex = ti; Team = s.teams[TeamIndex]; Vector3 center = new Vector3(s.CGrid.size.X * 0.5f, 0, s.CGrid.size.Y * 0.5f); float h = Grey.Vox.Region.HEIGHT + Camera.INITIAL_HIGH_SETTINGS.MaxDistance; mV = Matrix.CreateLookAt(center + Vector3.Up * (h + 1f), center, -Vector3.UnitZ); mP = Matrix.CreateOrthographic(s.CGrid.size.X, s.CGrid.size.Y, 0, h + 2f); mVP = mV * mP; fxCamera = renderer.CreateEffect(); fxCamera.LightingEnabled = false; fxCamera.FogEnabled = false; fxCamera.TextureEnabled = false; fxCamera.VertexColorEnabled = true; fxCamera.View = mV; fxCamera.Projection = mP; fxCamera.World = Matrix.Identity; mapPlanes = new Plane[6]; float off = s.CGrid.size.Length() * 0.25f; mapPlanes[0] = new Plane(Vector3.UnitX, off); mapPlanes[1] = new Plane(Vector3.UnitY, 0); mapPlanes[2] = new Plane(Vector3.UnitZ, off); mapPlanes[3] = new Plane(-Vector3.UnitX, s.CGrid.size.X + off); mapPlanes[4] = new Plane(-Vector3.UnitY, h + 2f); mapPlanes[5] = new Plane(-Vector3.UnitZ, s.CGrid.size.Y + off); refreshFOW = true; s.CGrid.OnFOWChange += (x, y, p, f) => { refreshFOW = refreshFOW | (p == ti); }; TeamMap = renderer.CreateTexture2D(s.CGrid.numCells.X, s.CGrid.numCells.Y, SurfaceFormat.Color, false); qSeen = new Queue<SeenEntity>(); tbScanner = new TimeBudget(SCAN_BINS); float r = (float)s.CGrid.numCells.X / SCAN_BINS; for(int i = 0; i < SCAN_BINS - 1; i++) { tbScanner.AddTask(new ScanTask((int)(r * i), (int)(r * (i + 1)), s.CGrid, Team, qSeen)); } tbScanner.AddTask(new ScanTask((int)(r * (SCAN_BINS - 1)), s.CGrid.numCells.X, s.CGrid, Team, qSeen)); }