chore: bumped engine version
This commit is contained in:
6
.vscode/launch.json
vendored
6
.vscode/launch.json
vendored
@@ -6,7 +6,7 @@
|
|||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build-client",
|
"preLaunchTask": "build-client",
|
||||||
"program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net9.0/Pong.dll",
|
"program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net10.0/Pong.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build-client",
|
"preLaunchTask": "build-client",
|
||||||
"program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net9.0/Desktop.dll",
|
"program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net10.0/Pong.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build-server",
|
"preLaunchTask": "build-server",
|
||||||
"program": "${workspaceFolder}/Platforms/Server/bin/Debug/net9.0/Server.dll",
|
"program": "${workspaceFolder}/Platforms/Server/bin/Debug/net10.0/Server.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"env": {
|
"env": {
|
||||||
"PORT": "8888",
|
"PORT": "8888",
|
||||||
|
|||||||
2
Engine
2
Engine
Submodule Engine updated: a050909375...913af2a4a4
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<RollForward>Major</RollForward>
|
<RollForward>Major</RollForward>
|
||||||
<PublishReadyToRun>false</PublishReadyToRun>
|
<PublishReadyToRun>false</PublishReadyToRun>
|
||||||
<TieredCompilation>false</TieredCompilation>
|
<TieredCompilation>false</TieredCompilation>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RootNamespace>Pong.Platforms.Server</RootNamespace>
|
<RootNamespace>Pong.Platforms.Server</RootNamespace>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Engine.Core;
|
using Engine.Core;
|
||||||
using Engine.Integration.MonoGame;
|
using Engine.Systems.Graphics;
|
||||||
|
|
||||||
namespace Pong.Behaviours;
|
namespace Pong.Behaviours;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Engine.Core;
|
using Engine.Core;
|
||||||
using Engine.Integration.MonoGame;
|
using Engine.Systems.Graphics;
|
||||||
|
|
||||||
namespace Pong.Behaviours;
|
namespace Pong.Behaviours;
|
||||||
|
|
||||||
|
|||||||
@@ -7,19 +7,14 @@ using Engine.Systems.Network;
|
|||||||
using Engine.Physics2D;
|
using Engine.Physics2D;
|
||||||
using Engine.Systems.Input;
|
using Engine.Systems.Input;
|
||||||
using Engine.Systems.Tween;
|
using Engine.Systems.Tween;
|
||||||
|
using Engine.Core.Debug;
|
||||||
|
|
||||||
namespace Pong.Behaviours;
|
namespace Pong.Behaviours;
|
||||||
|
|
||||||
public class Paddle(Keys Up, Keys Down, float High, float Low, float Speed) : Behaviour2D,
|
public class Paddle(Keys Up, Keys Down, float High, float Low, float Speed) : Behaviour2D,
|
||||||
IFirstFrameUpdate, IPhysicsIteration, IPostPhysicsUpdate,
|
IFirstFrameUpdate, IPhysicsIteration, IPostPhysicsUpdate,
|
||||||
IPacketListenerServer<Paddle.PaddleKeyStatePacket>, IPacketListenerClient<Paddle.PaddleKeyStatePacket>
|
IPacketListenerServerEntity<Paddle.PaddleKeyStatePacket>, IPacketListenerClientEntity<Paddle.PaddleKeyStatePacket>
|
||||||
{
|
{
|
||||||
private Keys Up { get; } = Up;
|
|
||||||
private Keys Down { get; } = Down;
|
|
||||||
public float High { get; } = High;
|
|
||||||
public float Low { get; } = Low;
|
|
||||||
public float Speed { get; set; } = Speed;
|
|
||||||
|
|
||||||
private bool isUpPressed = false;
|
private bool isUpPressed = false;
|
||||||
private bool isDownPressed = false;
|
private bool isDownPressed = false;
|
||||||
|
|
||||||
@@ -66,18 +61,19 @@ public class Paddle(Keys Up, Keys Down, float High, float Low, float Speed) : Be
|
|||||||
private void OnDownPressed(IButtonInputs<Keys> sender, IButtonInputs<Keys>.ButtonCallbackArguments args) { isDownPressed = true; networkClient?.SendToServer(new PaddleKeyStatePacket(this)); }
|
private void OnDownPressed(IButtonInputs<Keys> sender, IButtonInputs<Keys>.ButtonCallbackArguments args) { isDownPressed = true; networkClient?.SendToServer(new PaddleKeyStatePacket(this)); }
|
||||||
private void OnDownReleased(IButtonInputs<Keys> sender, IButtonInputs<Keys>.ButtonCallbackArguments args) { isDownPressed = false; networkClient?.SendToServer(new PaddleKeyStatePacket(this)); }
|
private void OnDownReleased(IButtonInputs<Keys> sender, IButtonInputs<Keys>.ButtonCallbackArguments args) { isDownPressed = false; networkClient?.SendToServer(new PaddleKeyStatePacket(this)); }
|
||||||
|
|
||||||
public void OnServerPacketArrived(IConnection sender, PaddleKeyStatePacket packet)
|
public void OnEntityServerPacketArrived(IConnection sender, PaddleKeyStatePacket packet)
|
||||||
{
|
{
|
||||||
physicsEngine2D.StepIndividual(rigidBody, -sender.Ping.Min(.05f));
|
physicsEngine2D.StepIndividual(rigidBody, -sender.Ping.Min(.05f));
|
||||||
|
|
||||||
isUpPressed = packet.IsUpPressed;
|
isUpPressed = packet.IsUpPressed;
|
||||||
isDownPressed = packet.IsDownPressed;
|
isDownPressed = packet.IsDownPressed;
|
||||||
|
ILogger.Shared.Log(this, $"Packet Server {isUpPressed} | {isDownPressed}");
|
||||||
|
|
||||||
physicsEngine2D.StepIndividual(rigidBody, sender.Ping.Min(.05f));
|
physicsEngine2D.StepIndividual(rigidBody, sender.Ping.Min(.05f));
|
||||||
networkServer?.SendToAll(new PaddleKeyStatePacket(this));
|
networkServer?.SendToAll(new PaddleKeyStatePacket(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClientPacketArrived(IConnection sender, PaddleKeyStatePacket packet)
|
public void OnEntityClientPacketArrived(IConnection sender, PaddleKeyStatePacket packet)
|
||||||
{
|
{
|
||||||
if (packet.IsDownPressed || packet.IsUpPressed) // Check if the server paddle is moving
|
if (packet.IsDownPressed || packet.IsUpPressed) // Check if the server paddle is moving
|
||||||
if (isDownPressed == packet.IsDownPressed && isUpPressed == packet.IsUpPressed) // Check if we are the ones giving the inputs
|
if (isDownPressed == packet.IsDownPressed && isUpPressed == packet.IsUpPressed) // Check if we are the ones giving the inputs
|
||||||
@@ -87,6 +83,7 @@ public class Paddle(Keys Up, Keys Down, float High, float Low, float Speed) : Be
|
|||||||
|
|
||||||
isUpPressed = packet.IsUpPressed;
|
isUpPressed = packet.IsUpPressed;
|
||||||
isDownPressed = packet.IsDownPressed;
|
isDownPressed = packet.IsDownPressed;
|
||||||
|
ILogger.Shared.Log(this, $"Packet Client {isUpPressed} | {isDownPressed}");
|
||||||
|
|
||||||
physicsEngine2D.StepIndividual(rigidBody, sender.Ping);
|
physicsEngine2D.StepIndividual(rigidBody, sender.Ping);
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Engine.Integration.MonoGame;
|
|||||||
using Engine.Physics2D;
|
using Engine.Physics2D;
|
||||||
using Engine.Systems.Network;
|
using Engine.Systems.Network;
|
||||||
using Engine.Systems.Tween;
|
using Engine.Systems.Tween;
|
||||||
|
using Engine.Systems.Graphics;
|
||||||
|
|
||||||
using Pong.Behaviours;
|
using Pong.Behaviours;
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@ public static class PongUniverse
|
|||||||
universe.InstantiateUniverseObject().SetUniverseObject("Camera")
|
universe.InstantiateUniverseObject().SetUniverseObject("Camera")
|
||||||
.BehaviourController.AddBehaviour<Transform2D>()
|
.BehaviourController.AddBehaviour<Transform2D>()
|
||||||
.BehaviourController.AddBehaviour<CameraController>()
|
.BehaviourController.AddBehaviour<CameraController>()
|
||||||
|
.BehaviourController.AddBehaviour<MonoGameTriangleBatch>()
|
||||||
.BehaviourController.AddBehaviour<MonoGameCamera2D>();
|
.BehaviourController.AddBehaviour<MonoGameCamera2D>();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RootNamespace>Pong.Shared</RootNamespace>
|
<RootNamespace>Pong.Shared</RootNamespace>
|
||||||
<AssemblyName>Pong.Shared</AssemblyName>
|
<AssemblyName>Pong.Shared</AssemblyName>
|
||||||
|
|||||||
Reference in New Issue
Block a user