Skip to content

Commit

Permalink
temp fix to pass UUID as player name and fix AMPQ issue, will update …
Browse files Browse the repository at this point in the history
…later to pass user provided callsign. Also, moved canvas to layer 0 so login UI can get mouse clicks
  • Loading branch information
dudash committed Jun 12, 2022
1 parent 8007e56 commit 87dc3c0
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 26 deletions.
33 changes: 12 additions & 21 deletions .vs/srt-godot-client/xs/UserPrefs.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
<Properties>
<MonoDevelop.Ide.Workbench ActiveDocument="README.md">
<MonoDevelop.Ide.Workbench ActiveDocument="Networking/ServerConnection.cs">
<Files>
<File FileName="Scenes/SupportScenes/PlayerShip.cs" Line="129" Column="1" />
<File FileName="Scenes/SupportScenes/PlayerShip.cs" Line="56" Column="1" />
<File FileName="Autoload/CSLogger.cs" />
<File FileName="Networking/Server.cs" />
<File FileName="Scenes/SupportScenes/SpaceMissile.cs" />
<File FileName="README.md" Line="27" Column="1" />
<File FileName="README.md" />
<File FileName="Networking/proto/box2d.proto" />
<File FileName="Networking/proto/SecurityCommandBuffer.cs" />
<File FileName="Scenes/MainScenes/Game.cs" />
<File FileName="Networking/ServerConnection.cs" Line="132" Column="42" />
<File FileName="Networking/proto/RawInputCommandBuffer.cs" />
<File FileName="Networking/proto/EntityGameEventBuffer.cs" />
<File FileName="Networking/proto/GameEventBuffer.cs" />
<File FileName="Networking/proto/box2d.cs" />
<File FileName="Resources/client.cfg" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Option id="ShowAllFiles" value="True" />
<Node name="srt-godot-client" expanded="True">
<Node name=".DS_Store" selected="True" />
<Node name="srt-godot-client" expanded="True">
<Node name="Autoload" expanded="True" />
<Node name="Networking" expanded="True" />
<Node name="Scenes" expanded="True">
<Node name="SupportScenes" expanded="True" />
</Node>
</Node>
</Node>
</State>
</Pad>
</Pads>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ run `./artemis create gamebroker --user XXXXX --password XXXXX --role admin --na
It will provide the command to run your newly configured broker

* Option 3. Running in a Kubernetes cluster
TBD - helm or an operator to launch
TBD - helm to launch

#### Server
Find/follow instructions for the [game server here](https://github.com/redhat-gamedev/srt-godot-server).
Expand Down
2 changes: 1 addition & 1 deletion Resources/client.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[amqp]
server_string="amqp://127.0.0.1:5672"
server_string="amqp://localhost:5672"
disable_cert_validation=true
1 change: 1 addition & 0 deletions Scenes/LoginScreen.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ margin_left = -512.0
margin_top = -300.0
margin_right = 512.0
margin_bottom = 300.0
mouse_filter = 1
script = ExtResource( 2 )

[node name="TextureRect" type="TextureRect" parent="."]
Expand Down
6 changes: 4 additions & 2 deletions Scenes/MainScenes/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public bool JoinGameAsPlayer(string playerName)

// construct a join message
SecurityCommandBuffer scb = new SecurityCommandBuffer();
scb.Uuid = playerName; //ServerConnection.UUID;
scb.Uuid = ServerConnection.UUID;
scb.Type = SecurityCommandBuffer.SecurityCommandBufferType.Join;
CommandBuffer cb = new CommandBuffer();
cb.Type = CommandBuffer.CommandBufferType.Security;
Expand All @@ -71,6 +71,8 @@ public bool JoinGameAsPlayer(string playerName)
Label nameLabel = mapOverlay.GetNode<Label>("PlayerNameLabel");
nameLabel.Text = playerName;
return true; // TODO: this can't always be true

// TODO: send my name and player preferences over to the severside
}

/// <summary>
Expand Down Expand Up @@ -142,7 +144,7 @@ void ProcessInputEvent(Vector2 velocity, Vector2 shoot)
cb.rawInputCommandBuffer = ricb;
serverConnection.SendCommand(cb);
}

// // Called every frame. 'delta' is the elapsed time since the previous frame.
// public override void _Process(float delta)
// {
Expand Down
1 change: 1 addition & 0 deletions Scenes/MainScenes/Game.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
script = ExtResource( 2 )

[node name="MapCanvasLayer" type="CanvasLayer" parent="."]
layer = 0

[node name="MapOverlay" parent="MapCanvasLayer" instance=ExtResource( 1 )]
margin_right = 0.0
Expand Down
1 change: 1 addition & 0 deletions Scenes/MainScenes/MapOverlay.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
margin_right = 896.0
margin_bottom = 480.0
mouse_filter = 1

[node name="SectorLabelTextureRect" type="TextureRect" parent="."]
anchor_left = 1.0
Expand Down
27 changes: 27 additions & 0 deletions Scenes/SupportScenes/PlayerShip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public override void _Ready()
playerIDLabel.Text = uuid;
}

/// <summary>
///
/// </summary>
/// <param name="BufferType"></param>
/// <returns></returns>
public EntityGameEventBuffer CreatePlayerGameEventBuffer(EntityGameEventBuffer.EntityGameEventBufferType BufferType)
{
EntityGameEventBuffer egeb = new EntityGameEventBuffer();
Expand All @@ -83,15 +88,25 @@ public EntityGameEventBuffer CreatePlayerGameEventBuffer(EntityGameEventBuffer.E
return egeb;
}

/// <summary>
///
/// </summary>
/// <param name="egeb"></param>
public void UpdateFromGameEventBuffer(EntityGameEventBuffer egeb)
{
this.GlobalPosition = new Vector2(egeb.Body.Position.X, egeb.Body.Position.Y);
this.RotationDegrees = egeb.Body.Angle;
this.CurrentVelocity = egeb.Body.AbsoluteVelocity;
}

/// <summary>
///
/// </summary>
public void ExpireMissile() { MyMissile = null; }

/// <summary>
///
/// </summary>
public void FireMissile()
{
// only one missile allowed for now
Expand Down Expand Up @@ -132,6 +147,10 @@ public void FireMissile()
cslogger.Debug("Added missile instance!");
}

/// <summary>
///
/// </summary>
/// <param name="Damage"></param>
public void TakeDamage(int Damage)
{
cslogger.Debug($"Player.cs: {uuid}: Taking damage: {Damage}");
Expand All @@ -146,6 +165,10 @@ public void TakeDamage(int Damage)
// theServer.RemovePlayer(uuid);
//s}

/// <summary>
///
/// </summary>
/// <param name="delta"></param>
public override void _Process(float delta)
{
if (HitPoints <= 0)
Expand All @@ -156,6 +179,10 @@ public override void _Process(float delta)
}
}

/// <summary>
///
/// </summary>
/// <param name="delta"></param>
public override void _PhysicsProcess(float delta)
{
// somewhat based on: https://kidscancode.org/godot_recipes/2d/topdown_movement/
Expand Down

0 comments on commit 87dc3c0

Please sign in to comment.