OgarProject / Ogar

An open source Agar.io server implementation, written with Node.js.
Other
719 stars 821 forks source link

Make the console async #670

Closed Andrews54757 closed 8 years ago

Andrews54757 commented 8 years ago

In the comment, you said "Too lazy to learn async". Well, now its done! I originally did it for https://github.com/AJS-development/OpenAgar/blob/master/source/core/shellService.js, but I thought, "Why should I just help myself?" . So I decided to allow Ogar to have that code.

Advantages:

  1. It is much more efficient: OpenAgar wasn't efficient at the beginning, so Readline would just freeze when there was lag. So I made it async and it worked even during lag. (Now though, OpenAgar is the most efficient agar.io server available)
  2. It has all the features of readline: I even added the "remembering" feature that allows you to use the arrow keys to see the commands you made earlier

Disadvantages:

  1. Not much but there are tiny things that are easily fixable.

Notes:

  1. I didn't add fancy text support but you can add them by adding characters to the escapeChar() function. Edit the allowed string. Characters are separated by spaces
  2. If the string is very long, it won't erase it completely if you delete one charactor. So if I had abcdefghijklmnophdihwiishihdh, and I delete a bunch of characters, it will become like abcdef nophdihwiishihdh with a gap in the middle. This is also very easily fixable by editing process.stdout.write('\r '); (use \r\x1b[k?)

NOTE: THIS CODE IS COPYRIGHTED BY AJS DEVELOPMENT, BUT OGAR IS AN EXCEPTION. (Basically, do not copy in your own project to sell it. I give exclusive rights to ogar because I owe lots of my js skills to this project)

Andrews54757 commented 8 years ago

Everything is tested. And it works flawlessly

Andrews54757 commented 8 years ago

@vram4 ?

ZfsrGhS953 commented 8 years ago

@Andrews54757

most efficient agar.io server available

I'm not sure about that. I develop my own agar.io clone server implementation - Petridish Ogar. While I understand that the petridish client may not be an efficient one, the server is based on MultiOgar (which is already fast by itself) and contains many optimizations. I think you should test your implementation against mine.

Andrews54757 commented 8 years ago

@ZfsrGhS953 OpenAgar is twice as efficient as MultiOgar currently. If I find one that is more efficient, I will make it even more efficient. Note that OpenAgar is not finished, so the stats might be a little off. But I have very big plans for it. Since OpenAgar is not confined official clients and whatnot, unlike others, I can optimize things from client-side to server side. So that:

  1. Some game logic will be handled client side (todo)
  2. Bots will run on a different process (cpu core) (todo)
  3. Server side cache (todo)
  4. Server will be slowed down a lot as the velocity and path will be predetermined and sent (fps will be lower) (done, now 6 fps from 30)
  5. Bots will be dynamic (todo)
  6. client-side cache (done)
  7. And other things. (mostly)

And yes, I was impressed by MultiOgar the first time I saw it. Yet I feel like we can do much much better. I envision a server holding 1000 players and 500 bots without any lag at all.

ZfsrGhS953 commented 8 years ago
  1. That will allow cheats that are much worse than bots.
  2. I have thought of that already, but didn't add it.
  3. What cache? I can't think of any cache that can speed up the server a lot. Also, I think it's quite hard to make a JS program that'll make CPU cache the bottleneck.
  4. Interesting idea, it also saves bandwidth a lot. I think that's the main reason why it's twice as efficient as MultiOgar.
  5. "Dynamic" means every bot will be able to have different AI instead of one?
  6. Don't throw too much things in one server to avoid lag.
Andrews54757 commented 8 years ago
  1. There will be checks to make sure that wont happen.
  2. Lol, not even done yet
  3. There are lots.
  4. This hasnt even been done yet, and caches and hashbounds are the reason why its twice as fast
  5. No, some ais will be dumb, others smart for preformance
  6. Too bad

And another thing. OpenAgar detects if the server is lagging and adjusts to it. In order to minimise lag

Andrews54757 commented 8 years ago

Some other things Im gonna add:

  1. Nonvisible nodes are ignored (so no collision and whatnot if a player is not within some range) (todo)
  2. Minions will have no update loop unlike OgarUL (done)
  3. Slow clients will be detected and will be dropped. (todo)
Andrews54757 commented 8 years ago

UPDATE: I implemented the slow fps method. It is now 6 times faster

Andrews54757 commented 8 years ago

Is this project dead? @vram4 ? Last edit was in july

Luka967 commented 8 years ago

No, vram4 is dead

ZfsrGhS953 commented 8 years ago

The problem is much more severe. Not only Ogar is dead, "The big three", how I call it, of the private servers (Ogar, MultiOgar, Ogar-Unlimited) is dead. Last Ogar update was in 28 July, MultiOgar update was in 12 August, and Ogar-Unlimited update (aside from patches and uniban updates) in 20 August.

Andrews54757 commented 8 years ago

Oh well, time for OpenAgar to take the lead again. And I am going to invite the creators of the "big three" to help out

m-byte918 commented 8 years ago

Holy crap! He's alive!

BaumanDev commented 8 years ago

!!!