diff --git a/README.md b/README.md index 14e07af..029719d 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,12 @@ -# CCCB-Tanks +# servicepoint-tanks -## Service point display - - - -In CCCB, there is a big pixel matrix hanging on the wall. It is called "Airport Display" or "Service Point Display". - -- Resolution: 352x160=56,320 pixels -- Pixels are grouped into 44x20=880 tiles (8x8=64 pixels each) -- Smallest addressable unit: row of pixels inside of a tile (8 pixels = 1 byte) -- The brightness can only be set per tile -- Screen content can be changed using a simple UDP protocol -- Between each row of tiles, there is a gap of around 4 pixels size. This gap changes the aspect ratio of the display. - -### Binary format - -A UDP package sent to the display has a header size of 10 bytes. -Each header value has a size of two bytes (unsigned 16 bit integer). -Depending on the command, there can be a payload following the header. - -The commands are implemented in DisplayCommands. - -To change screen contents, these commands are the most relevant: -1. Clear screen - - command: `0x0002` - - (rest does not matter) -2. Send CP437 data: render specified text into rectangular region - - command: `0x0003` - - top left tile x - - top left tile y - - width in tiles - - height in tiles - - payload: (width in tiles * height in tiles) bytes - - 1 byte = 1 character - - each character is rendered into one tile (mono-spaced) - - characters are encoded using code page 437 -3. Send bitmap window: set pixel states for a rectangular region - - command: `0x0013` - - top left tile x - - top left _pixel_ y - - width in tiles - - height in _pixels_ - - payload: (width in tiles * height in pixels) bytes - - network byte order - - 1 bit = 1 pixel - -There are other commands implemented as well, e.g. for changing the brightness. - -## Tanks game - -- By default, the backend also hosts the frontend - ### Backend +- Uses the C# bindings from the [servicepoint library](https://github.com/cccb/servicepoint/) for communication with the display. - Stack: .NET / C# / ASP.NET / AOT-compiled - Both traditional JSON over HTTP APIs and real-time WebSocket communication - runs all game logic @@ -66,6 +16,7 @@ There are other commands implemented as well, e.g. for changing the brightness. - One frame is ~7KB, not including the text and player specific data - maps can be loaded from png files containing black and white pixels or simple text files - some values (like tank speed) can be configured but are fixed at run time +- By default, the backend also hosts the frontend ### Frontend diff --git a/tanks-backend/TanksServer.sln b/tanks-backend/TanksServer.sln index f26467a..a3b976e 100644 --- a/tanks-backend/TanksServer.sln +++ b/tanks-backend/TanksServer.sln @@ -7,7 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{12DB7D Dockerfile = Dockerfile EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint2", "servicepoint\servicepoint2-binding-cs\src\ServicePoint2.csproj", "{DFCC69ED-E02B-4631-8A23-5D394BA01E03}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint", "servicepoint/crates/servicepoint_binding_cs/ServicePoint/ServicePoint.csproj", "{DFCC69ED-E02B-4631-8A23-5D394BA01E03}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/tanks-backend/TanksServer/Endpoints.cs b/tanks-backend/TanksServer/Endpoints.cs index baf476b..74ec4cb 100644 --- a/tanks-backend/TanksServer/Endpoints.cs +++ b/tanks-backend/TanksServer/Endpoints.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Diagnostics.HealthChecks; -using ServicePoint2; +using ServicePoint; using TanksServer.GameLogic; using TanksServer.Interactivity; diff --git a/tanks-backend/TanksServer/GameLogic/MapService.cs b/tanks-backend/TanksServer/GameLogic/MapService.cs index 753d007..1e3c0e6 100644 --- a/tanks-backend/TanksServer/GameLogic/MapService.cs +++ b/tanks-backend/TanksServer/GameLogic/MapService.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; -using ServicePoint2; +using ServicePoint; using TanksServer.Graphics; namespace TanksServer.GameLogic; diff --git a/tanks-backend/TanksServer/Graphics/DrawMapStep.cs b/tanks-backend/TanksServer/Graphics/DrawMapStep.cs index 3fc59b5..062a94f 100644 --- a/tanks-backend/TanksServer/Graphics/DrawMapStep.cs +++ b/tanks-backend/TanksServer/Graphics/DrawMapStep.cs @@ -1,4 +1,4 @@ -using ServicePoint2; +using ServicePoint; using TanksServer.GameLogic; namespace TanksServer.Graphics; diff --git a/tanks-backend/TanksServer/Graphics/GeneratePixelsTickStep.cs b/tanks-backend/TanksServer/Graphics/GeneratePixelsTickStep.cs index de83cbb..5f92056 100644 --- a/tanks-backend/TanksServer/Graphics/GeneratePixelsTickStep.cs +++ b/tanks-backend/TanksServer/Graphics/GeneratePixelsTickStep.cs @@ -1,4 +1,4 @@ -using ServicePoint2; +using ServicePoint; using TanksServer.GameLogic; using TanksServer.Interactivity; diff --git a/tanks-backend/TanksServer/Graphics/IFrameConsumer.cs b/tanks-backend/TanksServer/Graphics/IFrameConsumer.cs index 9ee8d3e..d21f88b 100644 --- a/tanks-backend/TanksServer/Graphics/IFrameConsumer.cs +++ b/tanks-backend/TanksServer/Graphics/IFrameConsumer.cs @@ -1,4 +1,4 @@ -using ServicePoint2; +using ServicePoint; namespace TanksServer.Graphics; diff --git a/tanks-backend/TanksServer/Interactivity/ClientScreenServer.cs b/tanks-backend/TanksServer/Interactivity/ClientScreenServer.cs index 2832fba..a9d1514 100644 --- a/tanks-backend/TanksServer/Interactivity/ClientScreenServer.cs +++ b/tanks-backend/TanksServer/Interactivity/ClientScreenServer.cs @@ -1,5 +1,5 @@ using System.Net.WebSockets; -using ServicePoint2; +using ServicePoint; using TanksServer.Graphics; namespace TanksServer.Interactivity; diff --git a/tanks-backend/TanksServer/Interactivity/ClientScreenServerConnection.cs b/tanks-backend/TanksServer/Interactivity/ClientScreenServerConnection.cs index 483176a..8ffe7b2 100644 --- a/tanks-backend/TanksServer/Interactivity/ClientScreenServerConnection.cs +++ b/tanks-backend/TanksServer/Interactivity/ClientScreenServerConnection.cs @@ -1,6 +1,6 @@ using System.Buffers; using System.Net.WebSockets; -using ServicePoint2; +using ServicePoint; using TanksServer.Graphics; namespace TanksServer.Interactivity; diff --git a/tanks-backend/TanksServer/Interactivity/SendToServicePointDisplay.cs b/tanks-backend/TanksServer/Interactivity/SendToServicePointDisplay.cs index 3effe4d..0f57195 100644 --- a/tanks-backend/TanksServer/Interactivity/SendToServicePointDisplay.cs +++ b/tanks-backend/TanksServer/Interactivity/SendToServicePointDisplay.cs @@ -1,10 +1,10 @@ using System.Diagnostics; using System.Net; using System.Net.Sockets; -using ServicePoint2; +using ServicePoint; using TanksServer.GameLogic; using TanksServer.Graphics; -using CompressionCode = ServicePoint2.BindGen.CompressionCode; +using CompressionCode = ServicePoint.BindGen.CompressionCode; namespace TanksServer.Interactivity; diff --git a/tanks-backend/TanksServer/Program.cs b/tanks-backend/TanksServer/Program.cs index 89c71ae..d0599fb 100644 --- a/tanks-backend/TanksServer/Program.cs +++ b/tanks-backend/TanksServer/Program.cs @@ -2,7 +2,7 @@ using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; -using ServicePoint2; +using ServicePoint; using SixLabors.ImageSharp; using TanksServer.GameLogic; using TanksServer.Graphics; diff --git a/tanks-backend/TanksServer/TanksServer.csproj b/tanks-backend/TanksServer/TanksServer.csproj index aefb03e..d4ef742 100644 --- a/tanks-backend/TanksServer/TanksServer.csproj +++ b/tanks-backend/TanksServer/TanksServer.csproj @@ -29,7 +29,7 @@ - + diff --git a/tanks-backend/servicepoint b/tanks-backend/servicepoint index 548c957..8bf1452 160000 --- a/tanks-backend/servicepoint +++ b/tanks-backend/servicepoint @@ -1 +1 @@ -Subproject commit 548c957bf476471f81c5e8743671fd0f5a95a108 +Subproject commit 8bf1452e31c4dc14635c783987288111ebe5dce3