Creating a base from scratch, I need some advices

06/06/2017 13:06 kerohero#1
After seeing a lot of sources, Working on them and Getting some experience. I'm gonna make my own base to increase my experience. My base will be coded in C#. The base patch is the recent, It will work on the latest version of client.

My questions!
  • What to use MySQL or MySQL with Entity Framework (Which is better in performance)?! If you have something better tell about it!
  • What should I take care about when working with Sockets?
  • Multithreading, Should I use Tasks,Threads or both?
  • Maps, Using Quad Tree or just a Simple Implantation?!
  • In packets handling, What is better, using attributes or just a switch statement with packets ids?
I really care about performance, If you have any idea to optimize it. Feel free to say it!.

Please if you don't have any experience about a question "Please don't answer it".

Sorry for my bad English, Thanks in advance.
06/06/2017 16:46 Spirited#2
I tend not to use ORM software such as EF, since it just causes performance problems and ends up abstracting a large amount of complexity. It depends on how you use it, but it's just more weight on my programs. MySQL is free and nice to use, more common than MsSQL but less common for Microsoft shops. If you're looking for experience, any SQL will do and MySQL is nice middle ground. MariaDB is what I use and I'm looking into MongoDB.

With respect to sockets, C# is pretty shitty. Go with async and that's about the most you can do, unfortunately. Threading wise, limit your use of parallel for loops to startup only. They tend to be very poorly managed and cause lockups otherwise. Having a thread pool for processing player packets isn't a bad idea either. Not necessary for getting started though. That can always be added in. Same with attributes. Keep it simple to start with. Switch statements should convert to maps anyways if it's a decent language. Go does... Not sure about C#.

Maps can use a simplified quad tree like approach. That was something I was going to implement for my source. It's not entirely necessary for a game like Conquer. It will help quite a bit, but again, not too necessary for starting a source. It also doesn't need a full quad tree implementation. Sorry if there are typos, I'm on my phone.
06/06/2017 19:38 kerohero#3
Quote:
Originally Posted by Spirited View Post
I tend not to use ORM software such as EF, since it just causes performance problems and ends up abstracting a large amount of complexity. It depends on how you use it, but it's just more weight on my programs. MySQL is free and nice to use, more common than MsSQL but less common for Microsoft shops. If you're looking for experience, any SQL will do and MySQL is nice middle ground. MariaDB is what I use and I'm looking into MongoDB.

With respect to sockets, C# is pretty shitty. Go with async and that's about the most you can do, unfortunately. Threading wise, limit your use of parallel for loops to startup only. They tend to be very poorly managed and cause lockups otherwise. Having a thread pool for processing player packets isn't a bad idea either. Not necessary for getting started though. That can always be added in. Same with attributes. Keep it simple to start with. Switch statements should convert to maps anyways if it's a decent language. Go does... Not sure about C#.

Maps can use a simplified quad tree like approach. That was something I was going to implement for my source. It's not entirely necessary for a game like Conquer. It will help quite a bit, but again, not too necessary for starting a source. It also doesn't need a full quad tree implementation. Sorry if there are typos, I'm on my phone.
Thanks for answering, I'll finish it soon and release it for feedback.