Commit graph

138 commits

Author SHA1 Message Date
Coldeve-ACE
a31112ea51
Common Logging Changes (#4345)
* Update ShardDatabaseOfflineTools.cs

* Update Corpse.cs

* Update Creature_Death.cs

* Update Player_Death.cs

* Update Player_Inventory.cs

* Update WorldObject_Decay.cs

* Update HouseManager.cs

* Update Player_House.cs

* Update RecipeManager.cs

* Update Player_Allegiance.cs

* Update AuthenticationDatabase.cs

* Update ShardDatabase.cs

* Update WorldDatabase.cs

* Update Player_Magic.cs

* Update Player_Skills.cs

* Update Player_Attributes.cs

* Update Player_Combat.cs

* Update PhysicsObj.cs

* Update Player_Vitals.cs

* Update Player_Missile.cs

* Update Player_Melee.cs

* Update Monster_Melee.cs

* Update Session.cs
2025-08-11 22:38:12 -04:00
Ty Conner
479a369877
Add option for unlimited guid sequence gaps (#4137) 2024-09-15 22:32:54 -04:00
Ty Conner
dd3f1483a0
Adjust serverstatus command (#4162)
Swap out GetBiotaCount for GetEstimatedBiotaCount to explicit counting of all db records.

See https://mariadb.com/kb/en/incredibly-slow-count-on-mariadb-mysql/
2024-05-11 23:22:27 -04:00
Mag-nus
9d70b48380
Improve logging overhead by fixing string interpolation (#4107)
* First batch

* Second batch

* another batch

* last batch hopefully

* fix
2024-03-13 02:38:39 +00:00
Mag-nus
63dcd84541
Improve Offline Player Saving (#4100)
PlayerManager saves offline players in bulk, once very hour. This is done in bulk to help avoid desync between offline player updates.

Player caching is typically set to 30 min.

What can happen now is that PlayerManager may save a bunch of offline players, that will then be loaded into the player biota cache (for 30 min)... then after 30 min, they all get unloaded because nothign touches those biotas, then 30 min later again the PlayerManager performs its hourly maint of bulk save, thus, re-caching all those biotas.

Caching is not necessary for these biotas.

Caching is designed for biotas that exist in an online state.
2024-02-03 20:43:13 +00:00
Mag-nus
5eea5154e1
Improve BiotaSQLWriter for ACLogView (#4071)
This also fixes the missing order column for BiotaPropertiesPalette
2023-12-17 20:14:42 +00:00
Mag-nus
aa614fe8a2
Use existing Character Ref OnLogin, if exists (#3915)
This resolves the race condition described as follows:

Session 0 logins in, enters world.
Session 0 closes client with X.
Person reconnects asap.
Session 1 pulls a new, full character list from the DB.
Session 0, Character does final logoff (Y logoff animation completes) and does final save
Character in database is updated
Session 1 Character record is now not up to date with what exists in the DB.

This PR re-uses Character references when they exist, and thus, solving the race condition, because the character that gets updated during the Y logoff animation is the same reference that the relogged client is also holding onto (at the character selection screen).

The Character cannot be relogged (already existing) until the prev instance is fully out of world, thus, there is no worry of concurrency with two sessions holding ref to the same character object.
2022-10-27 14:57:46 -04:00
Ty Conner
10f13d04f3
Fix issue with rename admin command (#3794) 2022-01-19 02:45:42 -05:00
Ty Conner
d08bb47a18
Fix deletecharacter admin command (#3639)
* Fix deletecharacter

* Update CharacterCommands.cs
2021-08-08 19:01:40 -04:00
Ty Conner
e5351c2f0e
wire up copychar and bornagain commands (#3599)
* copychar

* bornagain

* .

* ..

* Update AdminCommands.cs

* Update PlayerManager.cs

* Update AdminCommands.cs

* Update AdminCommands.cs

* Update ShardDatabase.cs

* Update ShardDatabase.cs
2021-07-18 13:47:01 -04:00
gmriggs
c1a1c0817e
extend timeout for GetSequenceGaps (#3578) 2021-06-10 18:57:43 -04:00
gmriggs
09f4aefa98
fix GetMaxGuidFoundInRange to not be terrible, improve startup times / startup resources for large servers significantly (#3577) 2021-06-10 18:57:36 -04:00
Mag-nus
81376b89ef
Improve SaveCharacter error logging (#3463) 2021-02-13 08:25:12 -06:00
Ty Conner
3ad55dd50b
Fix query issue with recent MySQL versions (#3435) 2021-01-22 13:29:31 -05:00
Mag-nus
43c9300b10
.NET Entity Framework Core 3.1 support (attempt #2) (#3356)
* packages updated, fix compiler errors/warnings

* scaffold

* fix ShardDatabaseOfflineTools

* WorldDatabase fix performance

* ShardDatabase fix GetCharacters

* move comment

stuff

* extend UseMySQL statements

* fix character creation linq parsing

* fix exception

* fix references
2020-12-07 20:59:40 -06:00
Mag-nus
d052089247
Misc Database Improvements/Cleanup (#3357)
* Add Resilient connections

* remove some comments

* Tracking Improvements

* Spelling fix

* Create global.json

Co-authored-by: Ty Conner <tyconner@itcproductions.com>
2020-11-15 13:07:15 -06:00
Ty Conner
79dd8bd083
Fix context save issues with character rename by admin (#3116)
* Fix context save issues with character rename by admin

* Update ShardDatabase.cs
2020-08-13 12:57:23 -04:00
gmriggs
d3fd9b2c3a
including previously owned houses in hslist (#3002) 2020-05-31 19:20:18 -04:00
Mag-nus
c085564e34
EnableSensitiveDataLogging for shard and world (#2916)
* EnableSensitiveDataLogging for shard and world

* Add missing .GetFullMessage()
2020-04-16 08:29:29 -05:00
Mag-nus
75fc1ce23c
Step 3. Convert ShardDatabase/WorldObjects biota from the ACE.Database model to the new ACE.Entity model (#2731)
* Step 1. Add new adapter classes and models

All classes and objects added are in new namespaces.

This add has 0 interraction on existing ACE code.

This sets the groundwork for Step 2. Moving World DB caching to the new models

* first part of the world entity usage

* almost there

* final part

* update WeenieExtensions

* fix

* merge fixes and improvements

* ACE.Database new code

* it compiles

* InitializePropertyDictionaries

* WOrldDatabaseWithEntityCache cleanup

* ShardDatabaseWithCaching

* ShardDatabase Cleanup

* todo

* cache counts reported in serverstatus

* House InitializePropertyDictionaries

* improve ServerStatus

* BiotaModel change HousePermissions to Dictionary<uint, bool>

* PropertiesAllegiance to dictionary

* BiotaUpdater improvements

* Shard Database Cache Reporting

* More code ported from Step 3

* Remove stub CharacterCache

* Update WorldDatabaseWithEntityCache.cs

* build fixes

* code audit

* Remove non-callback functions from SerializedShardDatabase

* BiotaUpdater progress.. only emote left

* Emotes done... now need to test

* fix

* Burden/Value fix for containers

* fat fingered EncumbranceVal

* add some safety

* Don't cache player biotas for initial PlayerManager load

* fix null spellbook

* Add another null check

This is redundant as the check is also upstream.

This is to prevent an exception in the future if this function is called from another source.
2020-04-02 22:40:27 -05:00
Mag-nus
dff4617250
Improve startup time and memory consumption (#2704)
Limit number of threads used by database parallel work. This helps avoid "too many connections" errors on larger threaded machines. It also helps reduce memory consumption.

Use parallel for PlayerManager.Initialize()

ForceGC at the end of Startup, before the world is open. ForceGC is a pretty controversial thing. Typically if you're forcing gc, you're doing something wrong. In this case, we're forcing gc before the world starts up so that the work is done in an off-line state. This work will be done eventually, natrually by the gc, so better to get it done before the world is active. We force gc 10 times to make sure we get all objects. On a large server with many players and world precaching, this can free up 4 GB - 6 GB.
2020-02-12 19:49:34 -06:00
gmriggs
7cd1e64899
adding null pointer prevention to GetAllPlayerBiotasInParallel() (#2617) 2020-01-15 06:56:43 -05:00
Mag-nus
197d21c3db
Database Logging (#2596) 2020-01-06 06:57:45 -06:00
Mag-nus
e08e374d33
ShardDatabaseWithoutCaching (#2569)
This makes the legacy code for bypassing EF tracking for non player biotas back into master, and optional.

This will make it easier for ACE devs to update this legacy code for those servers that still require it, reducing the amount of work they'll have to do to merge to latest when certain schema changes happen.
2019-12-31 07:45:29 -06:00
Mag-nus
b504cb418f
Multi-thread landblock ticking (Landblock Groups w/Thread Safety) (#2303)
* WIP: Multi-thread landblock ticking

This is the start of "landblock group" ticking.

The idea behind the landblock groups are that each group may contain multiple landblocks that must be ticked on the same thread, but, each group itself can be ticked on independant threads.

The current groups are as follows:
Every outdoor landblock is in a group
Every dungeon landblock is in it's own group (one per dungeon)

This is not ready for public servers yet.

* More changes

* First pass at actual groups

* ObjMaint.KnownPlayers needs to be concurrent

* Removing original PoC code from LandblockManager

* Landblock Tick Cleanup

* VisibleObjects also needs to be concurrent

* DestructionQueue also needs to be concurrent

* KnownObjects needs to be concurrent

* Use a bool to toggle multi-threading

* Add thread safety to SequenceManager

* Move landblock phsyics ticking to LandblockManager

Also

* Cleanup log.Info level messages

Log.info is the default console output and is intended for:
server startup
connection/disconnections
admin initiated command output
server shutdown

Log.Debug is the appropriate level for debug-type messages that are to be logged and audited at a later date, but not output to the console.

* Missed a couple

* Move HandleSalvaging from Warn to Debug

* Add thread safety to Landblock

* More landblock group calc stuff

* couple comments

* Add some thread capping

* Limit database from taking all the threads

This adds limits to the database thread consumption.

It also should allow the world to now consume threads easier.

The way it is done is as follows.

- We determine the number of available threads using Environment.ProcessCount
- We allocate (int)Math.Max(Environment.ProcessorCount * .34, 1) to the World, and the remainder tothe database.

It breaks down as follows
1 vCPU = 1 thread world, 1 thread database
2 vCPU = 1 thread world, 1 thread database
3 vCPU = 1 thread world, 2 thread database
4 vCPU = 1 thread world, 3 thread database
5 vCPU = 1 thread world, 4 thread database
6 vCPU = 2 thread world, 4 thread database
7 vCPU = 2 thread world, 5 thread database
8 vCPU = 2 thread world, 6 thread database
9 vCPU = 3 thread world, 6 thread database
10 vCPU = 3 thread world, 7 thread database

I'd like to get some feedback from this PR on various sized servers.

What you may notice is that loading a player may take slightly longer (very slightly).

What you will probably notice is no discenerable difference in-game.

What I want to make sure happens is that the world doesn't end up feeling more choppy due to the parallel processing of outbound network traffic. Hopefully the more fair thread distriubiton will help prevent thread starvation.

* quit if not enough vCPU

* separate landblock group recal between add/remove

* revert landblockMutex in Landblock.cs

* World Manager AboveNormal thread priority.

* Add some tags

* Couple more

* Create LandBlockGroup entity

* remove space between tags

* Update the log4net examples

* Efficiency improvements

* fix message

* more WIP

* Improve log4net

Add color to console output

Make the default logger use Log4Net.Async

* WIP

* More WIP

* more WIP

* More WIP

* more WIP

* More WIP

* more WIP

* wip

* more WIP

* remove old processor count check

* Create ServerObjectManager

This removes the ServerObjects collection out of ObjectMaint into it's own class.

This paves the way for thread safety that will need to be added to ObjectMaint for the multi-threaded landblock groups.

* Only split if multi-threading is enabled

* remove comment

* ObjMaint refactor

* all obj maint collections are now private

* few more optimizations

* alternate objectmaint thread safety model

* fix

* Remove a couple of comments

* improved ObjectMaint locking

* lock (ThreadConfiguration.WorldLockObject) OnDeath

* progress

* set MultiThreadedLandblockGroupPhysicsTicking to false

* Move a bool

* add lock

* physics ticking thread safety improvement

* use Config.js for thread configuration

* Add config comments

* measure physics ticking performance

* /serverstatus info added

* comments
2019-10-08 20:25:49 -05:00
Mag-nus
3d02d89286
Add configuration for number of threads (#2299)
This doesn't persist to the actual .config yet, but provides a local way to manage thread count allocation.
2019-09-15 07:14:35 -05:00
Mag-nus
1d905bcdec
Limit database from taking all the threads (#2261)
* Limit database from taking all the threads

This adds limits to the database thread consumption.

It also should allow the world to now consume threads easier.

The way it is done is as follows.

- We determine the number of available threads using Environment.ProcessCount
- We allocate (int)Math.Max(Environment.ProcessorCount * .34, 1) to the World, and the remainder tothe database.

It breaks down as follows
1 vCPU = 1 thread world, 1 thread database
2 vCPU = 1 thread world, 1 thread database
3 vCPU = 1 thread world, 2 thread database
4 vCPU = 1 thread world, 3 thread database
5 vCPU = 1 thread world, 4 thread database
6 vCPU = 2 thread world, 4 thread database
7 vCPU = 2 thread world, 5 thread database
8 vCPU = 2 thread world, 6 thread database
9 vCPU = 3 thread world, 6 thread database
10 vCPU = 3 thread world, 7 thread database

I'd like to get some feedback from this PR on various sized servers.

What you may notice is that loading a player may take slightly longer (very slightly).

What you will probably notice is no discenerable difference in-game.

What I want to make sure happens is that the world doesn't end up feeling more choppy due to the parallel processing of outbound network traffic. Hopefully the more fair thread distriubiton will help prevent thread starvation.

* quit if not enough vCPU

* Give World Manager thread AboveNormal priority.

* support 1 CPU
2019-09-08 16:27:01 -05:00
gmriggs
bad821f601
persisting allegiance bans / approved vassals (#2175) 2019-08-04 14:42:19 -04:00
gmriggs
eaa9246552
persisting squelches to db (#2165)
* persisting squelches to db

* removing unneeded index

* re-running scaffolding

* re-running scaffolding

* re-running scaffolding

* adding SquelchMask

* updating SquelchMask

* adding support for masks

* updating comments

* adding global squelches

* adding chat filters in system

* adding remaining squelch filters

* fixing typo

* .

* commenting out debug lines

* updating to latest master
2019-07-31 02:05:00 -04:00
Ty Conner
2d87ef74e3
Add full support for Contracts (#2150)
* Add full support for Contracts

* Update Commands

* Update ContractManager.cs

* Update DeveloperCommands.cs

* Update ContractManager.cs

Fix PackableHashTable stuff

* Update ContractTracker.cs

Add in vaguely used Stamped version

* Update ContractManager.cs

* Update ContractManager.cs

* Some tweaks

* More tweaking

* Create ContractId.cs

* Update PropertyInt.cs

* Update ContractId.cs

* Provide feedback for IsFull

* Update QM to prevent Update from writing more solves than max allows

* null catch

* .

* Update LifestonedConverter.cs

* Update Gem.cs

* Update changelog.md

* Update changelog.md
2019-07-28 22:25:22 -05:00
Mag-nus
2f19b81c11
Revert "Only track Player biotas (#1813)" (#2099)
This reverts commit ce9791703b.
2019-07-15 06:39:54 -05:00
gmriggs
23a005a763
multihouse decommission (#2067)
* prototype: adding account-wide house recall

* updating restriction db / has permissions

* additional ObjMaint refactoring

* re-adding CheckPlayers()

* the call to GetVisibleObjects() in Monster.FindNextTarget() is no longer needed in new design

* removing more unused code

* very preliminary testing

* prevent 1 character from purchasing multiple houses

* adding account/character houses

* further work on AccountHouses / CharacterHouses

* latest updates, account/character multihouse polish, apartment deed location

* adding /house-select process

* HouseManager refactoring, removing async, fixing PlayerHouse.CompareTo equals, fixed InventoryLoaded for weenies, added Player_House.GetHouseInstance()

* first posted draft

* wiring up the remaining HouseInstance -> GetHouseInstance()

* preventing maintenance items from being added for houses owned by players in multihouse state

* cleaning up log messages, handling some edge cases
2019-07-10 13:39:10 -04:00
Mag-nus
094bdb9e20
Few more very minor things (#2046)
Also fixed an exception in WorldObject_Set when an wo didn't have an ItemLevel value
2019-06-25 22:17:04 -05:00
gmriggs
3602018459
adding verify-skill-credits (#1954) 2019-06-08 22:14:20 -04:00
Ty Conner
c62125b9dc
Misc changes attempting to prevent lost corpses (#1951)
* Misc changes attempting to prevent lost corpses

* restore db  query

* fixing GetDynamicObjectsByLandbloc

Co-Authored-By: gmriggs <gmriggs@gmail.com>

* Adjust Decay for Corpses

Co-Authored-By: gmriggs <gmriggs@gmail.com>

* Update changelog.md
2019-05-31 04:53:59 -05:00
Mag-nus
0260815e62
Create database index for GetDynamicObjectsByLandblock (#1946) 2019-05-27 13:16:52 -05:00
Mag-nus
82e83550c0
Change GetObjectsByLandblock from bit shift to min/max (#1930) 2019-05-22 19:42:39 -05:00
Ty Conner
807f8105da
Fix some issues with finger command (#1879)
* Add GetCharacterByGuid

* Adjust finger command to only return "playable" characters, and correct accounts for offline players

* Add IsDeleted and adjust IsPendingDeletion
2019-05-12 17:06:19 -05:00
Mag-nus
ce9791703b
Only track Player biotas (#1813)
This should free up a lot of the EF tracking resources that we're seeing being consumed by CE
2019-05-01 07:56:16 -05:00
Mag-nus
f117425d8f Dispose ShardContext on RemoveBiota (#1750)
This is just a partial fix for dispoing contexts properly.

The contexts that are released from BiotaContexts as biotas go out of scope are never disposed. They are only finalized when the GC collects them. I plan to come up with a solution for that as well.
2019-04-18 06:39:36 -04:00
Mag-nus
b6951c575f
Add biota id:name to db exceptions (#1707)
* Add biota id and name to db failures

* fix HouseManager exception from log statement
2019-04-12 06:32:53 -05:00
Mag-nus
4dab146548
Code cleanup (#1681)
* Flags attribute

* empty statement

* Fix Formatting

* Fix OrderBy -> ThenBy

* use OfType

* Replace with asingle call to Count(...)

* Replace with a single call to FirstOrDefault

* Merge cast with type check

* use String.IsNullOrEmpty

* use collections count property

* use format specifier (results in shorter loc)

* use Any() instead of Count() > 0

* revert ThenBy with comment
2019-04-10 20:48:34 -05:00
Mag-nus
fbd9a512a6
Retry failed shard db queries (#1654) 2019-04-08 19:12:03 -05:00
gmriggs
bf8be53041
Adding support for Augmented Understanding spell (#1616)
* oops

* Adding support for Augmented Understanding spell
2019-03-31 15:28:59 -04:00
Ty Conner
c2923cf38b
Rework Name and IsPlussed (#1510)
* Rework Name and IsPlussed a bit

* Add basic support for player weenie changes when accesslevel changes

* Cleanup

* Update changelog

* cleanup

* clean up returns

* Return to Virtual + Override

* cleanup

* Restore @rename functionality

* Strip + from killer's name in Corpse.LongDesc for VTank compatiblity

* Add @pk command

* Add in support for PlayerKillerStatus.Free

* Add Chorzite to comps list

* If Level is greater than maxlevel, do not crash

* Fix @morph command
2019-03-10 22:15:43 -05:00
Mag-nus
0095e2cfcc
Reuse available Dynamic GUIDs (#1493)
* Reuse available Dynamic GUIDs

On ACE startup, the shard database is queried for available id's in the dynamic guid range.

This helps further reduce (max + 1) id allocation.

It's a bit premature, but, based on current architecture, I don't know if we'll ever need to do a id defragment.

A requirement of this method is that ace_world may only contain guids in the static range.

* GetMaxGuidFoundInRange has no valid use in ace_world

All ids must be in the static range

* Add world update script
2019-03-07 20:17:42 -06:00
Ty Conner
e656c3b771
Update ShardDatabase.cs
Issue spotted by @kdmxp256
2019-02-11 18:54:32 -05:00
Mag-nus
57e97ecdde
Change the write lock to when we actually change the property (#1403)
This changes the SaveBiota from using a Write lock to using a Read lock. The benefit here is that now the biota can still be read while it is in the process of being saved.

We don't need a write lock when we save the biota because the only properties that will be changed are record id's will be added for records that are new.

Because we maintain the context for the life of the biota, when we add/save, it's simply a one way change, meaning, only the database will change. The biota itself is just read and compared to the clone that the context holds. Thus, this is a safe way to do it.
2019-02-03 13:21:43 -06:00
gmriggs
e682545dc9
Adding most of the remaining Allegiance features (#1396)
* Adding most of the remaining Allegiance features

* Adding house ownership verification

* Sending allegiance metadata on login

* Adding officer permission levels

* checking allegiance house permissions for recall

* Adding /allegiance house commands

* Renaming classes

* Adding allegiance locks

* Adding handler for monarch pledging allegiance

* Adding allegiance chat boot / gag

* Adding allegiance boots and bans
2019-02-03 12:09:32 -05:00
gmriggs
9c8bc7ceb0
Adding /hslist <housetype> to show list of available houses (#1373)
* Adding /hslist <housetype> to show list of available houses

* Updating RootHouse

* Updating activation requirements for wielding items

* More updates

* Adding ConvertToMoASkill to activation requirements

* reversing lock check

* Fixing floating storage chests

* Revise comment
2019-01-26 15:14:32 -05:00