31 Commits

Author SHA1 Message Date
Drew DeVault
6fb8ee7ba5 Many more optimizations and bugfixes
Again, sorry for the huge commit. Just taking on performance issues as I
see them. Changes in this:

- Deadlocks in region code finally fixed
- Chunk packet preparation optimized (saves ~10-20ms per packet, since
  we're sending these like 30 at a time that's pretty important) by
  storing chunks pre-encoded in memory (basically just using a single
  big array for IDs, metadata, and light)
- Move chunk generation and compression to the thread pool
- Move client chunk updates to the scheduler
- Improve profiler coverage
- Add knob to disable scheduling chunk events on chunk load
- Make it possible to disable specific scheduled events in config.yml
2017-05-23 18:17:44 -04:00
Drew DeVault
362c852f51 Many improvements to server stability+performance
Sorry for the vague commit message. There were a lot of changes. Here's
a list of most of them:

- Lighting updates are timeboxed each frame
- The next environment frame is queued sooner if the current one took
  longer (as soon as immediately)
- Issues with the physics engines and mobs using it were (mostly) fixed,
  mobs no longer freak out and get stuck on physics objects
- Mob AI/pathfinding is done more intelligently
- The player can no longer spawn in an ocean or a desert biome
- Some deadlocks in Region were fixed (more remain to be fixed)

The current performance bottlenecks are lighting (still) and propegating
initial chunk loads to blocks that need to schedule things (such as
grass blocks). I think the main culprit in the latter case is grass
blocks and water blocks. The former can be improved by adding a block
cache to World, but that'll take some custom work. This step is just
gonna be slow no matter what, we might have to split it across several
frames but it's never going to be great.

There still seems to be a deadlock somewhere in all of this mess, in the
world code. I'll find it later.
2017-05-22 19:51:23 -04:00
Drew DeVault
08c313a651 Add names to events for profiling puproses 2015-09-07 16:13:18 -04:00
Drew DeVault
14661c7110 Add profiler, improve event scheduler performance 2015-09-07 16:07:39 -04:00
Drew DeVault
7578d5980a Add mob wandering AI 2015-07-02 22:46:20 -06:00
Drew DeVault
7da2ca5a27 Track the subject of each scheduled event
This allows us to cancel events when the subject is no longer around.
For example, if a chunk is unloaded due to inactivity, the events within
it are cancelled (growth of wheat, propegation of fluids, etc). When a
client disconnects, events associated with it are cancelled.

To use this for your own scheduled events, pick a subject. If your
subject does not implement IEventSubject, implement it. Then, you can
pass the subject into ScheduleEvent and that's it. When the subject
dies, your events will die with it. So long as the subject remains
alive, your events still fire.

`null` is a valid subject for events that should happen regardless of
any subject expiring.

Closes #1
2015-07-01 14:02:41 -06:00
Drew DeVault
0bf8f75c5a Revert "Merge pull request #174 from Mitch528/events"
This reverts commit 43d2840171a83e8b8260f981d1918d7ad1c5ed1f, reversing
changes made to 186efa270795abefbef2b5745656fda2ae11610a.
2015-06-26 16:51:28 -06:00
Mitchell Kutchuk
2db4df9b5d Expanded upon EventScheduler
- Events are now sorted
- Thread waits until either a new event is scheduled or an existing
event is ready before continuing.
2015-06-26 10:43:52 -07:00
Mitchell Kutchuk
7820a304ae Catch packet handler exceptions 2015-06-22 08:08:15 -07:00
Mitchell Kutchuk
4225124546 Implement asynchronous sockets 2015-06-20 19:43:28 -07:00
Drew DeVault
2dd423ab11 Implement singleplayer 2015-06-02 20:31:43 -06:00
Robin Kanters
7cd6c1ffe5 Only using username for checking access 2015-05-18 08:40:49 +02:00
Robin Kanters
1eaf36ffda Moved access control to IMultiplayerServer 2015-05-18 08:40:46 +02:00
Robin Kanters
b099ac8644 Moved AccessConfiguration to the IMultiplayerServer and adjusted the loginhandler accordingly 2015-05-18 08:40:43 +02:00
Robin Kanters
4206f2d005 Fixed code issues (variable renames and such) 2015-05-08 21:56:08 +02:00
Robin Kanters
2b09ca5ce0 buttload of capitalization fixed (uppercase in parameter names) 2015-05-05 22:26:44 +02:00
Drew DeVault
4cbf9e714c Cleanly shut down on SIGTERM 2015-04-26 18:39:37 -06:00
Drew DeVault
e5a1ee3439 Implement crafting from the inventory window
This does not include all recipes in the game, and there is no support
for crafting benches yet.
2015-02-07 15:51:38 -07:00
Drew DeVault
079f8b9188 Flesh out EntityManager to sync entities w/clients
This makes sure that you get new entities as you move to chunks that
have them, and that entities are despawned as you move further away from
them.
2015-02-01 21:43:25 -07:00
Drew DeVault
eda5dd2f82 Implement bed placement and supported blocks 2015-02-01 18:53:10 -07:00
Drew DeVault
4df341e7d6 Add item repository and leaves logic 2015-02-01 14:59:02 -07:00
Drew DeVault
8feefbbbbf Implement entity physics and item drops 2015-02-01 10:38:55 -07:00
Drew DeVault
61bd2d32d3 Add block repository support code 2015-01-26 16:40:32 -07:00
Daniel Vidmar
7e608db385 Removed command event code 2015-01-23 15:23:46 -05:00
Daniel Vidmar
1d48d01648 New Command System
- Added a new command system
- Added a help command
- Added a command event
2015-01-23 04:03:28 -05:00
Drew DeVault
c2b7e4b065 Add PlayerJoined event 2015-01-01 19:49:53 -07:00
Drew DeVault
c623bb68a5 Add event handler for chat messages 2014-12-28 19:18:13 -07:00
Drew DeVault
4d3d5ee8e0 Send initial slew of chunks to connected clients 2014-12-27 18:19:42 -07:00
Drew DeVault
05e132850c Implement scheduled events 2014-12-27 18:19:41 -07:00
Drew DeVault
427329f06c Add worlds and logging to server 2014-12-27 18:19:41 -07:00
Drew DeVault
e26e31f432 Initial commit 2014-12-27 00:21:19 -07:00