StickMick / BYOC

Bring Your Own Client. An online game with no client - challenge yourself by creating your own and compete with others.
MIT License
9 stars 2 forks source link

Suggestion To Improve Performance #1

Closed musictopia2 closed 2 years ago

musictopia2 commented 2 years ago

I saw you were using enums and looping through them. I created a source generator for fast enum. If you are interested, then I can contribute and use my source generator that creates enums that are much faster than the standard enum. If you want to see a sample, I can send a sample of it. With my source generator, it actually generates a record structs that acts like enums. Plus has some lists as well without reflection.

StickMick commented 2 years ago

Sounds good to me! Many of the systems are completely up in the air at the moment while the concept is still coming together, but happy to accept any contributions.

Feel free to fork and submit a pull request :)

StickMick commented 2 years ago

Merged in! Some great optimizations in there, let me know if there's anything else you want to work on

musictopia2 commented 2 years ago

I would love to work on other things. I always had the problem of having nothing to do. One idea I have is this can eventually be a blazor app. The only challenge is finding some simple images for things like dirt, etc. I have a game package I created which this game can eventually integrate into the system as well.

musictopia2 commented 2 years ago

Here is my repository i had for the fast enum https://github.com/musictopia2/FastEnumGenerator What i basically do is you populate some simple enum code and the source generator creates the rest of the class (which is actually record struct). Also, i have a huge open source project here https://github.com/musictopia2/CommonBasicLibrariesSolution which has many common helpers that are useful for many projects including the random, plus many other things as well.

StickMick commented 2 years ago

Thanks! I'll have to have a look through those repos later.

I would love to work on other things. I always had the problem of having nothing to do. One idea I have is this can eventually be a blazor app. The only challenge is finding some simple images for things like dirt, etc. I have a game package I created which this game can eventually integrate into the system as well.

Well that sounds like a game client - which I intended to be left as a task for the user. My plan was for this project to be server only, with only UI for server administration - the game itself to be handled by the server and the commands, UI, etc to be supplied by the user through the servers API however they see fit.

I've put a few things on the readme as a TO DO list, but they're pretty open ended at the moment. I've done blazor apps in the past, so I was hoping I could coax people in the community with less experience to do it - with the spirit of the #CSharpChallenge

musictopia2 commented 2 years ago

I have one question. How can somebody self host it? I am guessing it would mean the multiplayer part has to be on the local network. The only issue I had with local hosting is I have been unable to get ssl to work if other computers on the network tries to access it. What do you think of this idea. That whoever hosts it is like the host and the server just relays messages between them (so the server can be reused for other games in the future). I have a game package that has a server that has over 90 multiplayer games. However, the way it works is the server does not know about any particular game. It just sends message between the players and whoever is actually hosting (another blazor web assembly client) hosts it.

StickMick commented 2 years ago

An agnostic server seems pretty interesting, but my goal was to have the server contain all the game logic and be a single point of truth - leaving only the UI as a learning task for the user.

Since all the logic is in a separate project it doesn't rule out either way, but I feel a server with existing logic and endpoints provides a lower barrier of entry than a logic library and a relay server.

I also wouldn't be against adding AI players so multiplayer isn't required, but the end goal remains the same: If a dev wants to practice their front-end skills: here's a server that plays a game, make a front end for it.

musictopia2 commented 2 years ago

That sounds good then. I would guess doing AI would be super hard though. I have many games where the computer just has to skip their turn because unless its simple to make a decision, I have found it very hard or nearly impossible for a computer to even make a decision (unless they make random moves).