GithubHelp home page GithubHelp logo

entelectchallenge / 2024-sproutopia Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 21.0 3 MB

C# 90.52% Dockerfile 0.99% JavaScript 0.68% Java 3.44% Kotlin 1.50% Python 1.14% TypeScript 0.63% Batchfile 0.64% Shell 0.45%

2024-sproutopia's People

Contributors

entelectchallenge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

2024-sproutopia's Issues

Bot Commands Occassionally Dropped in Multiplayer Matches

Hi there

Problem:

I noticed that when the number of players is greater than 1, sometimes RunnerHub drops player commands. It appears as though when multiple commands are received at roughly the same time, not all of them are processed.

I say that because I noticed SignalR logs indicate that a player command was received but RunnerHub.SendPlayerCommand is not executed.

SignalR logs:

2024-04-06T17:49:48.3372874+00:00 Debug Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher - Received hub invocation: "InvocationMessage { InvocationId: \"\", Target: \"SendPlayerCommand\", Arguments: [ Domain.Models.BotCommand ], StreamIds: [ ] }".

I added custom logging on the first line of RunnerHub.SendPlayerCommand to confirm it isn't executed at all.

This was happening roughly every 20 ticks in my local games. I initially noticed when replaying games that some commands weren't processed.

Solution:

I noticed the last years engine didn't register RunnerHub as a singleton. When I removed it as a singleton, all works as expected.

Line to remove:

services.AddSingleton<RunnerHub>();

Hope this helps

Dockerfile referenced in run.cmd and run.sh not included in repo

When trying to execute the run.sh or run.cmd you will receive the following error "ERROR: failed to solve: failed to read dockerfile". This is raised in the docker build as this command expects either the Dockerfile to be referenced or for there to be a Dockerfile in the directory root.

Logger config not friendly to non-Windows setups

Heyo, looking forward to the EC for this year! I've started playing around with the engine, and I've noticed that log files are currently written to a hardcoded path:

.WriteTo.File("logs\\engGame.json")

This path 1. literally creates a file named 'logs\engGame.json' on Linux (doesn't nest it in a logs directory) and 2. will get overwritten on each game. Can this please be updated to use a timestamp as the filename so that logs don't overwrite each other?

TrailProtection bug

I've noticed an issue when I intentionally run into my own trail to trigger the protection.
It correctly places me at the start of the trail, however the trail I had made was not wiped out (at least on the heroWindow).
I hadn't tested if I could run into this remnant trail and prune myself but will do later and update this issue.

Naturally if this trail can get you pruned it will leave you incredibly vulnerable until you capture the area around it in order to convert the territory to your own.

Incorrect (and possibly ambiguous) claiming behaviour in hole-y gardens

Hi there, claiming seems to to behave a bit ambiguous when your garden becomes a bit hole-y. See below:

Screen.Recording.2024-04-21.at.13.21.39.mov

To be honest, I don't even know what the right behaviour should be in this case? ๐Ÿค” Not pictured here was another hole in the garden (not connected to this one) which was also claimed.

Not sure what's the case for holy gardens, haven't tested there yet ๐Ÿคท

Bot respawn doesn't properly reclaim territory when other other bot owns respawn point

When a bot gets pruned and gets respawned, it's new territory is initialised here:

public BotResponse RespawnBot(Guid botId)
{
if (!_gardens.TryGetValue(botId, out var garden))
{
throw new ArgumentException("Unknown bot", nameof(botId));
}
// Ensure that respawned bot's garden is pruned
PruneGarden(botId);
// Create new starting garden for bot
int size = 3;
int radius = 1 + size / 2;
var respawnPosition = _botManager.GetBotState(botId).RespawnPosition;
int left = Math.Max(respawnPosition.X - radius + 1, 0);
int top = Math.Max(respawnPosition.Y - radius + 1, 0);
int right = Math.Min(respawnPosition.X + radius, _width);
int bottom = Math.Min(respawnPosition.Y + radius, _height);
var polygon = new Polygon(new LinearRing(new[]
{
new Coordinate(left, top),
new Coordinate(right, top),
new Coordinate(right, bottom),
new Coordinate(left, bottom),
new Coordinate(left, top),
}));
_gardens[botId] = new Garden(botId, polygon);
return new BotResponse
{
NewPosition = respawnPosition,
Momentum = BotAction.IDLE,
Alive = true
};
}

While this does create the new bot's territory/garden, it doesn't remove the new territory from other bots' gardens. This means that when the opposing bot (which originally owned the respawn point) claims another piece of territory, and it recalculates/joins the polygons, it ends up overwriting the bot's respawn territory. This can lead to very weird states where a bot has no territory and only a trail ๐Ÿ˜…

Screen.Recording.2024-04-14.at.18.13.20.mov

Attached video shows red getting respawned, then brown claims a new, unrelated piece of territory (not even linked to the blob in which red is) and then red's original territory disappears

botPostions spelling

Not a huge issue, but a needless thing to run into when coding things.
Can we correct these typos?

botPostions - > botPositions (*this is really the only thing I actually tripped over)
opposingBotPosistions -> opposingBotPositions
_staticTeture -> _staticTexture

Leaderboard generation ordering not guaranteed

Currently, from what I can tell, the player index (i.e. the bot's numeric ordering [0,1,2,3], which is used in the cell types) can be inferred from the leaderboard key in the state update. The ordering of this key however is not guaranteed, as it's making use of the normal Dictionary which may or may not preserve insertion order. Can this please be updated to make use of an OrderedDictionary, so that the order of the keys are guaranteed to match up with the player indices? Thanks!

Edge case for claiming causes engine crash

Hey there, I think I've found an edge case in the claiming logic which causes an engine crash due to a null dereference

In the following video, player 1 = blue territory and player 2 = red territory.

Screen.Recording.2024-04-13.at.11.46.42.mov

The problematic line is here:

var newPoly = territoryStart!.Union(territoryEnd).Union(trailGeo) as Polygon;

territoryStart never gets set (because the trail start is no longer in player 1's garden), and that causes the following error to get raised:

2024-04-13T09:44:25.1945076+00:00 Error  - Game failed with exception: Object reference not set to an instance of an object.

This should probably handled similarly to how split territories are handled, where the trail simply gets converted -> claimed land.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.