Git Product home page Git Product logo

obsidian's People

Contributors

aaron2550 avatar craftplacer avatar czompi avatar dasdarki avatar dependabot[bot] avatar exeton avatar explorer3039 avatar foxtrek64 avatar gasinfinity avatar hangardonelli avatar henrymigo avatar inftord avatar jeremyespresso avatar jonpro03 avatar ma-tes avatar mechslayer avatar naamloos avatar narkdev avatar ndelta0 avatar oliver4888 avatar oolunar avatar paricbat avatar roxxel avatar seb-stian avatar spongecade avatar thebunnies avatar theverystarlk avatar tides avatar vooolox avatar xanderstoffels avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

obsidian's Issues

Update to .NET 6

During November this year (11/2021), new version of .NET will get released. We should update to make use of its performance improvements, new features and LTS.

  • Update all project files net5.0net6.0
  • Update project description (About, README, csproj...) .NET 5.NET 6
  • #125
  • #126
  • #173
  • #174

Implement GenericHost

In an effort to streamline and standardize DI, logging, and the lifetime of the bot, I would like to propose changing to a GenericHost.

Items to discuss:

  • Replace Dependency Injection with Microsoft.Extensions.DependencyInjection
  • Design server runtime around a GenericHost
    • Use Console Lifetime (naturally handles CTRL+C or SIGTERM and calls IHostApplicationLifetime.StopApplication() to gracefully stop the bot as well as unblocking asynchronous runtimes). Works very well with systemd's service management on the Linux side as well.
    • Lifetime managed by IApplicationLifetime and CancellationTokens
  • Use Microsoft.Extensions.Logging base (compatible with existing logging library).
  • App Configuration (environment variables, appsettings.json, UserSecrets)

For those unfamiliar, the GenericHost is based off the WebHost class from ASP.NET Core. However, this has the web-specific features removed in favor of a more generic long-lived service lifetime. The HostBuilder provides a set of utilities for configuring the host, such as reading configuration items, setting up database connections, and registering services. The Obsidian server itself is registered as a BackgroundService which is responsible for handling startup (database migrations and so forth).

public override async Task ExecuteAsync(CancellationToken stoppingToken)
{
    // Set up server

    Console.WriteLine("Obsidian started successfully!");

    stoppingToken.WaitHandle.WaitOne(); // Wait for a stop to be requested by the `IApplicationLifetime`.

    Console.WriteLine("Obsidian shutting down...");

    // Tear down

    Console.WriteLine("Obsidian stopped.");
}

If we decide to move forward with this, I would be more than happy to be responsible for developing this and submitting a PR (or several).

Edit: I should point out that this will likely be a disruptive change since it involves redesigning the core of the bot as well as its lifetime management. However, I do believe that this will result in aiding future development and promote contributions by providing a well-known DI system.

Implement packet ID system

Adding this will allow the server and client to be version independent, making sure that packets will have the same outcome. (referencing the different id shifts and changes in https://wiki.vg/)

Forge mod interop

Similarly to #18, it would be interesting to see a feature which brings support for forge mods as well, not just bukkit/spigot plugins.

Now while those are in most cases, direct modifications of the codebase, perhaps it would be possible to bring support for features like RefinedStorage.

I request this feature because of the implications of a C# server being capable of being optimized far more than java. Which would give better garbage collection, and therefore less memory usage.

Fix command crashing client when joining

Client crashes when sent a declaration of certain command. Command with no parameters (except for CommandContext) works fine. Adding one int parameter causes this behavior.

image

Reproduce by adding to MainCommandModule:

[Command("oops")]
[CommandInfo("This should work, but doesn't!", "/oops <value>")]
public async Task OopsAsync(CommandContext context, int value)
{
}

Implement Plugin Message (clientbound)

  • Create class
    • Figure out what's the most efficient way of implementing them (plain bytes or data classes)
  • Implement minecraft:brand ("null" -> "obsidian" server branding in MC)

Add empty summary tags to all objects, properties and methods.

After reviewing a large chunk of files, I've noticed that summary tags are not present to enable natural understanding and reduce the likelihood of open interpretation when working with objects, properties or methods. I would like to propose that summary tags be added to:

  • User-Defined Types
  • Properties
  • Methods

Additionally, if exceptions can be thrown from within methods or the get/set methods of properties then the appropriate exception tags should also be added.


At a minimum, these tags should be present, even if empty to consider this issue completed. This is because having the tags present will help encourage developers that have an understanding of the area they're working in, to add documentation for intellisense to pick up on. It also enables the ability to generate living documentation for the API project.

Fix commands tests

Commands.TestCommandExec() fails with an exception:

❌ Obsidian.Commands.Framework.Exceptions.InvalidCommandOverloadException : No such overload for command pong

It seems that command groups are not registered properly.

NullReferenceException on Held Item Change

During playtesting, moving an item around inventory, an exception was thrown.

Location

Player.GetHeldItem can return null, but the method's return type is not marked as nullable (even though Inventory.GetItem which it wraps around has nullable return type). heldItem being null then causes an exception, as its properties are being accessed.

This should be an easy fix, but I would also like to note that we clearly haven't fully used the nullable notation and we should. Perhaps we could set nullable warnings as errors (<WarningsAsErrors>Nullable</WarningsAsErrors>) to enforce null-safety? Related: #98

Resolve major warnings by GH actions compiler

Builds generated by GitHub produce some warnings. these need to be fixed. Check the actions tab for output. Any xmldoc issues that nag about non-existant docs can be ignored for now.

Plugins - Inform Plugin Dependencies of Parent Unloading

Currently, if a plugin is unloaded, its dependencies are not informed. Unexpected or undocumented behavior may occur when attempting to interact with the unloaded plugin.

When a plugin unloads itself for whatever reason, all dependent plugins should be immediately informed so they may handle the situation as is appropriate.

Implement Player Info (player list)

  • Send list of all player on login
  • Send implement properties (no information AFAIK)
  • Send changes of players that left
  • Send changes of players that changed their gamemode
  • Send changes of players that changed their ping
  • Send changes of players that changed their display name

Packet interrupting for plugins

An idea that might be interesting for plugins is adding support for interrupting packets.

My idea of how to implement such a thing:
events. We could have an event that the packet handler passes packets through before sending them, where plugins can choose to modify some values.

Limit command issuing

Original discussion from #82 (comment)

Commands will be able to be tagged with an IssuerScopeAttribute attribute, which takes an enum of following values:

  • None Command is basically disabled (probably remove this?)
  • Client Command sent by a player
  • Console Command typed into the native server console
  • RemoteConsole Command sent by remote console like RCON
  • Plugin Command executed by plugin
  • Any Flags of all values above

By default, if a command doesn't specify a scope, it will be able to be executed by any issuer (player, console, plugin).

To not force our opinions on what should be executable or not, the config should be able to configure what scopes commands have.

Implement all packets

A checklist of packets that are yet to be implemented on master (ordered as on wiki.vg):

Clientbound

  • #222
  • Spawn Painting
  • Statistics
  • Block Entity Data
  • Server Difficulty
  • Set Cooldown
  • Explosion
  • Tab Complete
  • Window Property
  • Disconnect
  • Entity Status
  • Open Horse Window
  • Effect
  • #67
  • Map Data
  • Trade List
  • Vehicle Move
  • Open Book
  • Open Sign Editor
  • Player Abilities
  • Combat Event
  • Face Player
  • Player Position And Look
  • Remove Entity Effect
  • Resource Pack Send
  • Respawn
  • Entity Head Look
  • Multi Block Change
  • Select Advancement Tab
  • World Border
  • Camera
  • Held Item Change
  • Update View Distance
  • Attach Entity
  • Set Experience
  • Update Health
  • Set Passengers
  • Teams
  • Time Update
  • Title
  • Entity Sound Effect
  • Stop Sound
  • NBT Query Response
  • Advancements
  • Entity Properties
  • Entity Effect
  • Declare Recipes

Serverbound

  • Query Block NBT
  • Query Entity NBT
  • Set Difficulty
  • Client Status
  • Tab Complete
  • Edit Book
  • Interact Entity
  • Generate Structure
  • Lock Difficulty
  • Player Position And Rotation
  • Player Movement
  • Vehicle Move
  • Steer Boat
  • Player Abilities
  • Steer Vehicle
  • Set Recipe Book State
  • Resource Pack Status
  • Advancement Tab
  • Select Trade
  • Set Beacon Effect
  • Held Item Change
  • Update Command Block
  • Update Command Block Minecart
  • Update Jigsaw Puzzle
  • Update Structure Block
  • Update Sign
  • Spectate
  • Use Item

Login

  • Login Plugin Request
  • Login Plugin Response

"privacy" mode

I was watching a FitMC video about jeb_ being griefed because some custom server indexer found the server he was playing on. This made me think it might be a good idea to add a "privacy" mode next to the whitelist, where the server will not return online player names after being queried.

Video in question:
https://www.youtube.com/watch?v=fvbVnT-RW-U

This is just an idea, but I think it might be nice to have. Maybe even a super private mode that wouldn't even return queried server info, whatever. I just think it would be nice and interesting. Let me know.

Write analyzers for plugin API

Provide a set of completions, warnings, fixes etc. for plugin developers working with Obsidian.API. For certain code actions, making an extension might be needed (I don't think that analyzers can provide completion for example). This might need additional research and probably will be postponed until Obsidian.API is complete and polished.

Parse assets with source generator

Currently we load assets at runtime upon server start. This could be changed so that assets are parsed at compile time and injected into code with a source generator. Startup would be faster and assets wouldn't be included in the build.

I've already tried to implement this, but there is an issue where System.Text.Json is not found during compilation. There may be a workaround of having the dll compiled and referenced directly in the project. Another consideration is using Newtonsoft.Json, even though I tried to move away from it in favor of System.Text.Json. However since it'd be used at compilation time, it wouldn't be a big problem.

Since I already have some experience with source generation, I will assign myself.

Make object initializers consistent.

When instantiating objects and setting members simultaneously, it can be seen that there are two ways of doing this (sometimes in the same file:

var x = new Something() { Foo = 3 };
var y = new Something { Foo = 3 };

Both are perfectly acceptable, but mixing and matching should be avoided.

Implement chunk unloading

Depends on #62.

When a chunk is load type level 34 and above, the chunk should be flushed to disk and removed from memory.

Performance improvements to voxel traversal

As stated by @Seb-stian on Discord:

 — Today at 4:26 PM
Roxxel's algorithm is great, but I would change the stuff around
[4:26 PM]
Right now it returns list of hit positions, which is not ideal for performance
[4:26 PM]
And also convenience in many cases
[4:27 PM]
But I will definitely include it at some point

Might be worth looking into it further.

Enable server garbage collection

In the future, it may be timeworthy to look into different GC settings. Server garbage collection in particular looks appealing. It should be significantly faster, but also consume more resources (great for dedicated servers?). Needs more research & runtime profiling (when Obsidian creates more garbage).

Workstation vs. Server GC (MSDN)

Use STJ source generator

The new System.Text.Json source generator can

  • increase serialization throughput
  • reduce start-up time
  • reduce memory usage
  • help with app trimming

We can already use this feature via a NuGet package, but we may want to wait for .NET 6, where it gets shipped.

This issue depends on #121

Randomize world seeds

Obsidian should randomize seeds when generating a new config. This should be a simple issue to fix.

Implement RCON abilities

The current console does not support user input. I don't think we'll ever implement this, because we run multiple servers on one console. A different option is implementing Minecraft's RCON protocol, so we can communicate with one specific server remotely.

https://wiki.vg/RCON

Hacktoberfest edit: welcome! Feel free to tackle this issue if you feel like it. The RCON protocol would have to be it's own class that is able to accept connections and interact with the console in/output from Obsidian. Good luck!

Use new math APIs

In .NET 6, these new methods were added:

  • SinCos
  • ReciprocalEstimate
  • ReciprocalSqrtEstimate

We should identify places where these methods can be used and use them. For example Entity.GetLookDirection.

Change license to MIT

Since GPL license is dissalows closed-source projects, GPL license may cause inconvenience for developers that make private projects, and this may affect on Obsidian's popularity. So, please, change Obsidian's license to MIT.

Improve networking performance

Different logger levels

Currently the logger shows all messages, this will be annoying as end product of Obsidian, as future server maintainers won't find debug information useful.

Flow field pathfinding

Implement flow fields for entity pathfinding. There are some cases, where A* is not the best choice:

  • If the graph that needs to be traversed is dense (A common example would be a grid-based graph) ✔️
  • If you have hundreds of units attempting to path to the same location ✔️
  • If the environment is highly dynamic ✔️
  • If there is a constant need to change the position of units ✔️
    (source)

Flow fields can be of great benefit for us. Some things to consider:

  • Implementation may be difficult to get right (eg. caching fields)
  • We may want to toggle between A* and Flow fields depending on distances and entity count
  • Different entities may need somewhat different vector fields (eg. zombie x spider)

For now, A* should do just fine, but I would like to see this implemented in the future.

MemoryStream disposal

The server uses a lot of memorystreams to convert data.

Perhaps its a good idea to dispose of these after they get used (to prevent memory leaking) as said by @Craftplacer

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.