Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #32 from proepkes/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
proepkes authored Feb 14, 2019
2 parents 610e273 + 504d1ff commit bf1af9a
Show file tree
Hide file tree
Showing 130 changed files with 4,025 additions and 809 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
Expand Down
10 changes: 7 additions & 3 deletions Engine/Common/Logging/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
namespace Lockstep.Common.Logging
{
public static class Log
{
public static LogSeverity LogSeverityLevel = 0;
{
public static LogSeverity LogSeverityLevel = LogSeverity.Info | LogSeverity.Warn | LogSeverity.Error | LogSeverity.Exception;

public static event EventHandler<LogEventArgs> OnMessage;


public static void SetLogAllSeverities()
{
LogSeverityLevel = LogSeverity.Trace | LogSeverity.Info | LogSeverity.Warn | LogSeverity.Error | LogSeverity.Exception;
}

public static void Warn(object sender, string message, params object[] args)
{
Expand Down
7 changes: 7 additions & 0 deletions Engine/CopySourceToUnity.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
del ..\Unity\Assets\Integration\Lockstep.*
xcopy "Game" "..\Unity\Assets\GitIgnored\Game\" /exclude:excludeList.txt /y /S
xcopy "Common" "..\Unity\Assets\GitIgnored\Common\" /exclude:excludeList.txt /y /S
xcopy "Core.Logic" "..\Unity\Assets\GitIgnored\Core.Logic\" /exclude:excludeList.txt /y /S
xcopy "Core.State" "..\Unity\Assets\GitIgnored\Core.State\" /exclude:excludeList.txt /y /S
xcopy "Network" "..\Unity\Assets\GitIgnored\Network\" /exclude:excludeList.txt /y /S
xcopy "Network.Client" "..\Unity\Assets\GitIgnored\Network.Client\" /exclude:excludeList.txt /y /S
20 changes: 0 additions & 20 deletions Engine/Core.Logic/Interfaces/Services/INavigationService.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
namespace Lockstep.Core.Logic.Systems.Debugging
{
public class VerifyNoDuplicateBackups : IExecuteSystem
{
private readonly ServiceContainer serviceContainer;
{
private readonly IGroup<GameEntity> _backups;

public VerifyNoDuplicateBackups(Contexts contexts, ServiceContainer serviceContainer)
{
this.serviceContainer = serviceContainer;
public VerifyNoDuplicateBackups(Contexts contexts)
{
_backups = contexts.game.GetGroup(GameMatcher.Backup);
}
public void Execute()
Expand Down
17 changes: 0 additions & 17 deletions Engine/Core.Logic/Systems/Features/InputFeature.cs

This file was deleted.

20 changes: 0 additions & 20 deletions Engine/Core.Logic/Systems/Features/NavigationFeature.cs

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions Engine/Core.Logic/Systems/Game/Navigation/SyncAgentVelocity.cs

This file was deleted.

36 changes: 0 additions & 36 deletions Engine/Core.Logic/Systems/Game/Navigation/UpdateAgentPosition.cs

This file was deleted.

24 changes: 0 additions & 24 deletions Engine/Core.Logic/Systems/Game/RemoveNewFlag.cs

This file was deleted.

13 changes: 12 additions & 1 deletion Engine/Core.Logic/Systems/GameState/CalculateHashCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class CalculateHashCode : IInitializeSystem, IExecuteSystem

private readonly GameStateContext _gameStateContext;

public CalculateHashCode(Contexts contexts, ServiceContainer serviceContainer)
public CalculateHashCode(Contexts contexts)
{
_gameStateContext = contexts.gameState;

Expand All @@ -23,10 +23,21 @@ public void Initialize()
public void Execute()
{
long hashCode = 0;
hashCode ^= _hashableEntities.count;
foreach (var entity in _hashableEntities)
{
hashCode ^= entity.position.value.X.RawValue;
hashCode ^= entity.position.value.Y.RawValue;
if (entity.hasVelocity)
{
hashCode ^= entity.velocity.value.X.RawValue;
hashCode ^= entity.velocity.value.Y.RawValue;
}
if (entity.hasDestination)
{
hashCode ^= entity.destination.value.X.RawValue;
hashCode ^= entity.destination.value.Y.RawValue;
}
}

_gameStateContext.ReplaceHashCode(hashCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Lockstep.Core.Logic.Systems.GameState
{
public class OnNewPredictionCreateBackup : ReactiveSystem<GameStateEntity>
public class OnNewPredictionCreateSnapshot : ReactiveSystem<GameStateEntity>
{
private readonly GameContext _gameContext;
private readonly ActorContext _actorContext;
Expand All @@ -17,7 +17,7 @@ public class OnNewPredictionCreateBackup : ReactiveSystem<GameStateEntity>
private readonly IGroup<ActorEntity> _activeActors;
private readonly IGroup<GameEntity> _activeEntities;

public OnNewPredictionCreateBackup(Contexts contexts, ServiceContainer serviceContainer) : base(contexts.gameState)
public OnNewPredictionCreateSnapshot(Contexts contexts) : base(contexts.gameState)
{
_gameContext = contexts.game;
_actorContext = contexts.actor;
Expand All @@ -44,9 +44,7 @@ protected override void Execute(List<GameStateEntity> entities)
var currentTick = _gameStateContext.tick.value;

//Register the tick for which a snapshot is created
var snapshotEntity = _snapshotContext.CreateEntity();
snapshotEntity.AddTick(currentTick);
snapshotEntity.AddHashCode(_gameStateContext.hashCode.value);
_snapshotContext.CreateEntity().AddTick(currentTick);

foreach (var e in _activeEntities)
{
Expand Down
35 changes: 0 additions & 35 deletions Engine/Core.Logic/Systems/SimulationSystems.cs

This file was deleted.

32 changes: 32 additions & 0 deletions Engine/Core.Logic/Systems/WorldSystems.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Lockstep.Core.Logic.Systems.Actor;
using Lockstep.Core.Logic.Systems.Debugging;
using Lockstep.Core.Logic.Systems.GameState;

namespace Lockstep.Core.Logic.Systems
{
public sealed class WorldSystems : Feature
{
public WorldSystems(Contexts contexts, params Feature[] features)
{
Add(new InitializeEntityCount(contexts));

Add(new OnNewPredictionCreateSnapshot(contexts));

foreach (var feature in features)
{
Add(feature);
}

Add(new GameEventSystems(contexts));

Add(new CalculateHashCode(contexts));

//Performance-hit, only use for serious debugging
//Add(new VerifyNoDuplicateBackups(contexts));

Add(new DestroyDestroyedGameSystem(contexts));

Add(new IncrementTick(contexts));
}
}
}
Loading

0 comments on commit bf1af9a

Please sign in to comment.