FullState was getting updated before ResetPredictedEntities ran instead of after. So ResetPredictedEntities was applying data to stuff like containers that depends on entities that hadn't been made yet.
* Fix light pop-in
Doh
* Uniqueness
* Refactor to be less bad
* Better perf
* Fix perf problems
* Hide debug commands under preprocessor
Can't imagine anyone using this during live-game.
* CVars
Apparently? You need to dispose of the sequencer BEFORE the synth or a funny segfault will occur... T-Thanks libfluidsynth.
Also unregisters the sequencer clients before disposing, just for cleanliness.
* MapGridSystem for grid initialization
Doesn't seem to be a clean way to hook into grids being initialized (can't duplicate directed bus events and a few systems need to EnsureComponent) hence the event.
* Address reviews
This is because the parent was attached first, and then the Entity Coordinates are set, but position doesn't change because the parent is the same and the entity is anchored.
NOTE: I only fixed the EntityCoordinates overload. Unsure if this is even a problem with MapCoordinates.
It would do .EndsWidth(), so DropDownDebugConsole and DebugConsole would get confused.
It now properly checks for path separators and also will report an error if there are two candidate XAML files.
Also, fixed the AXN0003 diagnostic having the wrong name.
* Added unit tests for the new anchor system design.
* Amend ME!
* SnapGridComponent now anchors the entity when added or removed.
TransformComponent.Anchored properly replicates it's state to clients.
* Converted all SnapGridPositionChangedEvent subscriptions to AnchorStateChangedEvent.
Removed SnapGridPositionChangedEvent.
Obsoleted SnapGridComponent.
* Allows setting Transform.Anchored in prototypes.
* Changing tile to empty under anchored ents unanchors them.
* More unit testing.
* Migrated transform gamestate tests to RobustServerSimulation.
* Fixed nasty off-by-one error when sending a full server state.
* Adds lifetime stages to Component.
* More test fixing.
* Review changes.
* Implement subscription ordering into EventBus.
* Topological helpers, rest of code uses shared topological sort, fix bugs.
* Fix tests.
Didn't realize that multi-subscriptions are allowed on input handlers like that??
* Improve and use topological sort helpers more.
No weird-ass bug this time. There was also an issue where occasionally the AABB on the client would disappear if you had a bunch of objects and used showbb but I think it's fixed now.
1. Allow loading audio directly from a sample buffer
2. SetVolumeDirect that takes a 0 -> 1 scale similar to OpenAL's AL_GAIN.
3. Fix OpenAL threading bugs with logging by caching the sawmill.
* IComponentManager holds a reference to IComponentFactory.
* Directed events for a same <TComp, TEvent> can be duplicated, component references of a component are added to the entity's event tables.
* Fix tests.
* Improvements, duplicated subscriptions are no more
* Cache component factory for faster access
* when the
* Automatically unsubscribe event bus registrations in entity system shutdown.
* Fix incorrect unsubscription of local events, obsolete unsubscribe methods.
That's what we got tests for.
* = null instead of .Clear()
- Recipients is now of type `IEnumerable<ICommonSession>`.
- This way, people need to use the Filter API to modify the recipients, instead of being allowed to modify the underlying collection directly.
- Underlying collection is now a HashSet.
- We want no duplicates at all. This will ensure that while being quite performant.
- Removes `IFilter`.
- Let's face it, everyone is gonna end up using `Filter` instead as it has a much more convenient API, and nothing else will EVER implement `IFilter`. For this reason, I've just gone ahead and removed it. Every method used `Filter` already, anyway.
- Adds EntitySystem `RaiseNetworkEvent` overload that takes in a `Filter`.
- This deduplicates a lot of code that enumerated the recipients and raised a network event per each one.
- Made AddPlayersByPvs aware of `net.pvs` and `net.maxupdaterange`, has a range multiplier parameter.
- Now it will simply add all players to the filter if PVS is disabled, and add all players in range if it's enabled.
- The range multiplier parameter allows us to make the PVS filter a bit more permissive, and generally better. The range is doubled by default, as it was already before.
- Adds `AddInRange` method to filters.
- This is useful for the AudioSystem, and the PVS methods use it, too!
- Adds `RemoveByVisibility` method to filters.
- This will remove all recipients that don't have a visibility flag in their entity's EyeComponent from the filter.
- (This will be VERY useful for Ghost Pointing, for example)
- Adds `Clone` method to filters.
- This is useful in cases where methods take in a filter and want to modify it without modifying the original instance. (See AudioSystem)
* Add serialization write benchmark
* Add baseline test and rename AddNode to Add in mapping extensions
* Optimize serialization writing
* Make reader delegate private
* Unhardcode baseline test
* Removed SnapGridOffset, there is only center now.
* SnapGridComponent methods are now static.
* Removed SnapGridComponent.OnPositionChanged.
* Refactored static functions off SnapGridComponent to MapGrid.
Refactored away usages of SnapGridComponent.Position.
* Added Transform.Anchored for checking if an entity is a tile entity.
More refactoring for static MapGrid functions.
* Static snapgrid methods on MapGrid are no longer static.
* Removed IMapGrid.SnapSize, it is now always equal to the IMapGrid.TileSize.
* Add setter to ITransformComponent.Anchored.
Removed direct references to SnapGridComponent from content.
* Grid functions now deal with EntityUids instead of SnapGridComponents.
Began renaming public API functions from SnapGrid to Anchor.
* Add some unit tests.
* SnapGridComponent now anchors itself in startup, instead of Initialize (sending directed events in init is an error).
* Make serialization work with backing fields automatically
* Fix not taking priorities into account, make the test fail when that is the case
* Turn fieldDefs back into a list
* Format it better
* Remove GetInheritanceBehaviour, expose immutable array of base field definitions
* Refactors EntityManager to not do any networking.
ServerEntityManager and ClientEntityManager now do the networking instead.
* Rename property for "backwards compat."
* Remove comented out code in robust server simulation
* Refactors MapManager to not do any networking.
Now, ServerMapManager and ClientMapManager handle any networking.
* it's christmas in april!
* Remove comented line
* Remove useless seal
* Fix incorrect semicolon
* Event is no longer overriden, has a protected Invoke method instead
* Split entity lookups from entitymanager
* Helps if you subscribe dingus
* Handle map changes
* Stacks instead
* Make mapchanges use a queue because it's probably better
Moves likely only care about the latest position
* IoC what you did there
* IoC refactor
* Minor optimisations
* Apply feedback
* My IQ dropped 3 sizes that day
* Rest of acruid's feedback
* final_no_actual commit
* enlightenment?
* Liftoff
* final_commit_v2_actual
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
* Add Robust.Benchmarks and read string benchmark
* Separate serialization manager methods, use compiled lambdas to call manager read
4 us > 200 ns
* Add int and data definition with string benchmarks
* Make serialization population use expressions to create definitions
* Make benchmark classes internal and create seed data definition
* Add complex data definition read benchmark
* Create primitive serializers, remove primitive special case
| Method | Mean | Error | StdDev |
|----------------------- |------------:|----------:|----------:|
| ReadString | 227.1 ns | 4.47 ns | 5.65 ns |
| ReadInteger | 245.4 ns | 4.82 ns | 6.26 ns |
| ReadDataDefWithString | 804.7 ns | 15.27 ns | 16.34 ns |
| ReadSeedDataDefinition | 15,846.8 ns | 312.89 ns | 773.39 ns |
* Remove testing code
* Setup delegates during initialize
* Revert "Setup delegates during initialize"
This reverts commit 7ff4d4eaaa.
* Store delegates in a concurrent dictionary because I really cannot be arsed to generate them on initialize at this point
* Wrapped the parallel GetMail function in a try/catch.
Added a hack to the ViewCulling leave message that skips ents that don't exist.
Always send ALL map and grid entities to the client.
More info logging about adding/removing maps/grids.
* Will now still send required map critical entities even if client is not attached to an entity.
PvsEnabled and PvsRange are now writeable.
* Adds barbones culling.
* Visibility culling and recursive parent ent additions.
DebugEntityNetView improvements.
Visibility moved from session to eyecomponent.
* Multiple viewport support.
* Perf improvements.
* Removed old netbubble system from ServerEntityManager.
Supports old NaN system for entities leaving view.
Supports old SendFullMap optimization for anchored, non-updating Entities.
* Fixes size of netView box.
* Remove empty EntityManager.Update method.
Switching ViewCulling back to PLINQ.
Removes NetId methods from IEntity, content does not need to be messing with them.
Fixes bug in DeleteComponent where the ComponentDeleted event was not being raised if a component did not have a NetId.
* Added an entity lifetime levels property.
Added exception when recursively deleting an entity.
* Add a directed event 'EntityTerminatingEvent' for right before an entity is deleted.
* Added MapInit lifestage to entities.
retires DataFieldWithConstantAttribute & DataFieldWithFlagAttribute in favor of new customtypeserializers
adds prototypeidvalidation, just needs to be added to the corresponding fields
fixes some behaviour in yamllinter
* Added new ComponentEventBus, combined it with IEventBus.
* Removed all traces of IEntity from ComponentDependencies.
Removed IEntityManager dependency from ComponentManager.
* Added entity create/delete events to IEntityManager.
* ComponentEvents now use EntitySystemMessages instead of their custom ComponentEvent class.
* Component events are now just overloads of entity events.
* Removed obsolete EntitySystemMessage, now everything uses the base EntityEventArgs.
* Add a bool argument for if the message should be broadcast as well as directed.
Fix ordering and init issues of events in EntityManager.
* Changed names from Component/Entity events to Directed/Broadcast.
* Fix bugs and unit tests.
The idea was that these are Task.Run'd so don't influence performance. That was before we started threading the hell out of startup.
We're getting more stuff like YAML linting now which should hopefully be able to catch 99% of this. And louder because it was always just a warning before.
* AAAAAAAAAAAAA
* Organization
* Still doesnt work
* Formatting
* It works!!
* More changes to everything
* Beginning of changes to overlays
* Makes the overlay manager GUID based (also it was very messy, still messy but i fixed some of it)
* Stencils are easy
* Questionable changes to overlays
* Minor change to HLR
* Fixed duplicate overlays when calling some commands (Like showbb)
* Fixes misleading message
* Adds a variety of worldspaces for overlays to choose from
* Caching
* Address reviews
* Merging pains
* ah.
* ahhhhh
* minor overlaymanager changes
* Work
* fix
* Merge??
* Fixes null errors
* Force update
* Delete whatever the fuck this is?
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
1. Stop using NJsonSchema, it didn't do anything useful.
2. Use System.Text.Json instead of Newtonsoft.Json.
3. General cleanup of the code, using arrays instead of lists, etc...
* Physics worlds
* Paul's a good boy
* Build working
* Ingame and not lagging to hell
* Why didn't you commit ahhhhh
* Hard collisions working
* Solver parity
* Decent broadphase work done
* BroadPhase outline done
* BroadPhase working
* waiting for pvs
* Fix static PVS AABB
* Stop static bodies from awakening
* Optimise a bunch of stuff
* Even more broadphase stuff
* I'm fucking stupid
* Optimise fixture updates
* Collision solver start
* Building
* A is for Argumentative
* Fix contact caching island flags
* Circle shapes actually workeded
* Damping
* DS2 consumables only
* Slightly more stable
* Even slightlier more stablier
* VV your heart out
* Initial joint support
* 90% of joints I just wanted to push as I'd scream if I lost progress
* JOINT PURGATORY
* Joints barely functional lmao
* Okay these joints slightly more functional
* Remove station FrictionJoint
* Also that
* Some Box2D ports
* Cleanup mass
* Edge shape
* Active contacts
* Fix active contacts
* Optimise active contacts even more
* Boxes be stacking
* I would die for smug oh my fucking god
* In which everything is fixed
* Distance joints working LETS GO
* Remove frequency on distancejoint
* Fix some stuff and break joints
* Crashing fixed mehbeh
* ICollideSpecial and more resilience
* auto-clear
* showbb vera
* Slap that TODO in there
* Fix restartround crash
* Random fixes
* Fix fixture networking
* Add intersection method for broadphase
* Fix contacts
* Licenses done
* Optimisations
* Fix wall clips
* Config caching for island
* allocations optimisations
* Optimise casts
* Optimise events queue for physics
* Contact manager optimisations
* Optimise controllers
* Sloth joint or something idk
* Controller graph
* Remove content cvar
* Random cleanup
* Finally remove VirtualController
* Manifold structs again
* Optimise this absolute retardation
* Optimise
* fix license
* Cleanup physics interface
* AHHHHHHHHHHHHH
* Fix collisions again
* snivybus
* Fix potential nasty manifold bug
* Tests go snivy
* Disable prediction for now
* Spans
* Fix ShapeTypes
* fixes
* ch ch changeesss
* Kinematic idea
* Prevent static bodies from waking
* Pass WorldAABB to MoveEvent
* Fix collisions
* manifold structs fucking WOOORRKKKINNGGG
* Better pushing
* Fix merge ickies
* Optimise MoveEvents
* Use event for collisions performance
* Fix content tests
* Do not research tests
* Fix most conflicts
* Paul's trying to kill me
* Maybe collisions work idk
* Make us whole again
* Smug is also trying to kill me
* nani
* shitty collisions
* Settling
* Do not research collisions
* SHIP IT
* Fix joints
* PVS moment
* Fix other assert
* Fix locker collisions
* serializable sleeptime
* Aether2D contacts
* Physics is no longer crashing (and burning)
* Add to the TODO list
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
* oops
* fixes serialization il
* copytest
* typo & misc fixes
* 139 moment
* boxing
* mesa dum
* stuff
* goodbye bad friend
* last commit before the big (4) rewrite
* adds datanodes
* kills yamlobjserializer in favor of the new system
* adds more serializers, actually implements them & removes most of the last of the old system
* changed yamlfieldattribute namespace
* adds back iselfserialize
* refactors consts&flags
* renames everything to data(field/definition)
* adds afterserialization
* help
* dataclassgen
* fuggen help me mannen
* Fix most errors on content
* Fix engine errors except map loader
* maploader & misc fix
* misc fixes
* thing
* help
* refactors datanodes
* help me mannen
* Separate ITypeSerializer into reader and writer
* Convert all type serializers
* priority
* adds alot
* il fixes
* adds robustgen
* argh
* adds array & enum serialization
* fixes dataclasses
* adds vec2i / misc fixes
* fixes inheritance
* a very notcursed todo
* fixes some custom dataclasses
* push dis
* Remove data classes
* boutta box
* yes
* Add angle and regex serializer tests
* Make TypeSerializerTest abstract
* sets up ioc etc
* remove pushinheritance
* fixes
* Merge fixes, fix yaml hot reloading
* General fixes2
* Make enum serialization ignore case
* Fix the tag not being copied in data nodes
* Fix not properly serializing flag enums
* Fix component serialization on startup
* Implement ValueDataNode ToString
* Serialization IL fixes, fix return and string equality
* Remove async from prototype manager
* Make serializing unsupported node as enum exception more descriptive
* Fix serv3 tryread casting to serializer instead of reader
* Add constructor for invalid node type exception
* Temporary fix for SERV3: Turn populate delegate into regular code
* Fix not copying the data of non primitive types
* Fix not using the data definition found in copying
* Make ISerializationHooks require explicit implementations
* Add test for serialization inheritance
* Improve IsOverridenIn method
* Fix error message when a data definition is null
* Add method to cast a read value in Serv3Manager
* Rename IServ3Manager to ISerializationManager
* Rename usages of serv3manager, add generic copy method
* Fix IL copy method lookup
* Rename old usages of serv3manager
* Add ITypeCopier
* resistance is futile
* we will conquer this codebase
* Add copy method to all serializers
* Make primitive mismatch error message more descriptive
* bing bong im going to freacking heck
* oopsie moment
* hello are you interested in my wares
* does generic serializers under new architecture
* Convert every non generic serializer to the new format, general fixes
* Update usgaes of generic serializers, cleanup
* does some pushinheritance logic
* finishes pushinheritance FRAMEWORK
* shed
* Add box2, color and component registry serializer tests
* Create more deserialized types and store prototypes with their deserialized results
* Fixes and serializer updates
* Add serialization manager extensions
* adds pushinheritance
* Update all prototypes to have a parent and have consistent id/parent properties
* Fix grammar component serialization
* Add generic serializer tests
* thonk
* Add array serializer test
* Replace logger warning calls with exceptions
* fixes
* Move redundant methods to serialization manager extensions, cleanup
* Add array serialization
* fixes context
* more fixes
* argh
* inheritance
* this should do it
* fixes
* adds copiers & fixes some stuff
* copiers use context v1
* finishing copy context
* more context fixes
* Test fixes
* funky maps
* Fix server user interface component serialization
* Fix value tuple serialization
* Add copying for value types and arrays. Fix copy internal for primitives, enums and strings
* fixes
* fixes more stuff
* yes
* Make abstract/interface skips debugs instead of warnings
* Fix typo
* Make some dictionaries readonly
* Add checks for the serialization manager initializing and already being initialized
* Add base type required and usage for MeansDataDefinition and ImplicitDataDefinitionForInheritorsAttribute
* copy by ref
* Fix exception wording
* Update data field required summary with the new forbidden docs
* Use extension in map loader
* wanna erp
* Change serializing to not use il temporarily
* Make writing work with nullable types
* pushing
* check
* cuddling slaps HARD
* Add serialization priority test
* important fix
* a serialization thing
* serializer moment
* Add validation for some type serializers
* adds context
* moar context
* fixes
* Do the thing for appearance
* yoo lmao
* push haha pp
* Temporarily make copy delegate regular c# code
* Create deserialized component registry to handle not inheriting conflicting references
* YAML LINTER BABY
* ayes
* Fix sprite component norot not being default true like in latest master
* Remove redundant todos
* Add summary doc to every ISerializationManager method
* icon fixes
* Add skip hook argument to readers and copiers
* Merge fixes
* Fix ordering of arguments in read and copy reflection call
* Fix user interface components deserialization
* pew pew
* i am going to HECK
* Add MustUseReturnValue to copy-over methods
* Make serialization log calls use the same sawmill
* gamin
* Fix doc errors in ISerializationManager.cs
* goodbye brave soldier
* fixes
* WIP merge fixes and entity serialization
* aaaaaaaaaaaaaaa
* aaaaaaaaaaaaaaa
* adds inheritancebehaviour
* test/datafield fixes
* forgot that one
* adds more verbose validation
* This fixes the YAML hot reloading
* Replace yield break with Enumerable.Empty
* adds copiers
* aaaaaaaaaaaaa
* array fix
priority fix
misc fixes
* fix(?)
* fix.
* funny map serialization (wip)
* funny map serialization (wip)
* Add TODO
* adds proper info the validation
* Make yaml linter 5 times faster (~80% less execution time)
* Improves the error message for missing fields in the linter
* Include component name in unknown component type error node
* adds alwaysrelevant usa
* fixes mapsaving
* moved surpressor to analyzers proj
* warning cleanup & moves surpressor
* removes old msbuild targets
* Revert "Make yaml linter 5 times faster (~80% less execution time)"
This reverts commit 2ee4cc2c26.
* Add serialization to RobustServerSimulation and mock reflection methods
Fixes container tests
* Fix nullability warnings
* Improve yaml linter message feedback
* oops moment
* Add IEquatable, IComparable, ToString and operators to DataPosition
Rename it to NodeMark
Make it a readonly struct
* Remove try catch from enum parsing
* Make dependency management in serialization less bad
* Make dependencies an argument instead of a property on the serialization manager
* Clean up type serializers
* Improve validation messages and resourc epath checking
* Fix sprite error message
* reached perfection
Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
Co-authored-by: Vera Aguilera Puerto <zddm@outlook.es>
* Adds the SoundSystem static proxy class for the AudioSystem.
Added a shared IAudioSystem interface for the future.
* Moved ConnectedClient property from IPlayerSession down to ICommonSession.
* Connected up the SoundSystem to the client/server AudioSystems.
* Converted client calls over to the new system.
* Marked the old serverside functions to play sound obsolete, use the new ones from the IAudioSystem.
* Added ISharedPlayerManager to the IoC registration.
* Added a basic server simulation framework for help with tests.
* Moved as much as possible to Robust.Shared/Containers.
Moved ContainerSlot from content to engine.
* Moved ClientContainer to shared.
* Merged client/server ContainerManagerComponents into a single shared version.
* ContainerManagerComponent is now implicitly registered with the attributes.
* Migrated to 2021 serialization technology.
* Existing Unit Tests work.
* More tests coverage.
Fixed bug with transferring items between containers.
* Container Type info is now sent over the network.
* Merge client/server container systems.
* Code cleanup.
* Attempted to fix dictionary serialization.
Logs warning when trying to check if an unknown GridId is paused.
* Remove OldCode.
* Physics worlds
* Paul's a good boy
* Build working
* Ingame and not lagging to hell
* Why didn't you commit ahhhhh
* Hard collisions working
* Solver parity
* Decent broadphase work done
* BroadPhase outline done
* BroadPhase working
* waiting for pvs
* Fix static PVS AABB
* Stop static bodies from awakening
* Optimise a bunch of stuff
* Even more broadphase stuff
* I'm fucking stupid
* Optimise fixture updates
* Collision solver start
* Building
* A is for Argumentative
* Fix contact caching island flags
* Circle shapes actually workeded
* Damping
* DS2 consumables only
* Slightly more stable
* Even slightlier more stablier
* VV your heart out
* Initial joint support
* 90% of joints I just wanted to push as I'd scream if I lost progress
* JOINT PURGATORY
* Joints barely functional lmao
* Okay these joints slightly more functional
* Remove station FrictionJoint
* Also that
* Some Box2D ports
* Cleanup mass
* Edge shape
* Active contacts
* Fix active contacts
* Optimise active contacts even more
* Boxes be stacking
* I would die for smug oh my fucking god
* In which everything is fixed
* Distance joints working LETS GO
* Remove frequency on distancejoint
* Fix some stuff and break joints
* Crashing fixed mehbeh
* ICollideSpecial and more resilience
* auto-clear
* showbb vera
* Slap that TODO in there
* Fix restartround crash
* Random fixes
* Fix fixture networking
* Add intersection method for broadphase
* Fix contacts
* Licenses done
* Optimisations
* Fix wall clips
* Config caching for island
* allocations optimisations
* Optimise casts
* Optimise events queue for physics
* Contact manager optimisations
* Optimise controllers
* Sloth joint or something idk
* Controller graph
* Remove content cvar
* Random cleanup
* Finally remove VirtualController
* Manifold structs again
* Optimise this absolute retardation
* Optimise
* fix license
* Cleanup physics interface
* AHHHHHHHHHHHHH
* Fix collisions again
* snivybus
* Fix potential nasty manifold bug
* Tests go snivy
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
* Removed IBaseSession, pushed all members down to ICommonSession.
* Pulled all members of client IPlayerSession into ICommonSession.
Marked client IPlayerSession as obsolete, use the base ICommonSession.
* Restricted setter access for properties in ICommonSession, only engine should be setting them.
* Fixed ping implementation on server.
* Moved AttachedEntityUid to ICommonSession.
* Added a shared IPlayerManager and pulled some common properties down to it.
* Added a shared player Filter class that holds a set of recipients in a networked call. Very useful for selecting recipients in a shared context.
* Added support for erasing rectangular areas
* Apply suggestions from code review
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
* Switched sending start coordinate + end coordinate to sending start coordinate + rect selection size for preventing different parented positions, general code improvements
* Rewritten certain code part so the checks pass
* Added unshaded shader to rect erasing
* Tweaked alpha of erasing rectangle for better visualizing
Co-authored-by: Manel Navola <ManelNavola@users.noreply.github.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
*Allow content to define localization functions.
* Add rldloc command to reload localizations.
* Doc comments
* Error handling
* Parallelize loading of localization files, since I can only assume we'll have a lot eventually.
* Type system stuff to allow content to pass custom data types into fluent.
* Code cleanup.
This makes Direction no longer follow a cartesian trig circle but oh well. Also helper methods to work with this.
Math tests currently fail, pushing this so Acruid can see about fixing SpriteComponent.
* Added documentation to Clyde on the sprite rendering calls.
* Added a rotation debug entity.
* Non-directional RSIs and raw textures are now rotated properly.
* Directional RSIs and Sprite Smoothing work.
* Remove the Directional flag usages.
* Supports layers with different numbers of directions.
* Fixes window rendering.
* Implement hot reloading for entity prototypes
* Implement automatic prototype hot-reloading
* Merge fixes
* Add yaml hot reloading and a message to notify the client
* Add reloading only changed files, remove cooldown, add retries and remove IPrototype
* Remove reload command
* Make the client listen for reloads instead and only when focused
* Fix errors
* Only queue a reload when the queue has items in it
* Make fails after 10 retries log instead of throw if reloading
Co-authored-by: Jackson Lewis <inquisitivepenguin@protonmail.com>
* Moved IPauseManager from server to shared.
* Moved ITimerManager from Timers to Timing.
* Added missing IConsoleHost to server/client RegisterIoC. Tests work again.
1. Add XAML namespaces https://spacestation14.io with Avalonia hacks.
2. Make markup extensions work with Avalonia hacks.
3. Add LocExtension for localized strings.
4. Add Vector2 parsing type converter to XAML compilation.
5. Make SS14Window better thanks to these improvements.
* #272 no arrow, actually change id on channel changer
* #272 ability to apply style class to child
* #272 try methods for selecting items in OptionButton.cs
* #272 allow escaping right angle bracket in formatted message
* #272 ability to detect when local player is set / unset
* #272 make RemoveModal public since PushModal is as well, so modals can be removed on-demand if needed rather than relying on a click elsewhere
* #272 revert
* Add SerializedType attribute to serialize types without the !type tag
* Fix nulls in tests
* Fix null in tests maybe
* Return to type tags
* Fix imports
* Removed the Interfaces folder.
* All objects inside the GameObjects subfolders are now in the GameObjects namespace.
* Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces.
* Simplified Robust.client.Graphics namespace.
* Automated remove redundant using statements.
Lidgren NetTime.Now is now synchronized to IGameTiming.RealTime.
NetChannel is now a nested class of NetManager.
Add IGameTiming.ServerTime, INetChannel.RemoteTimeOffset, INetChannel.RemoteTime
* Renamed shared ICommand to IConsoleCommand.
* Lots of refactoring into a shared context.
* Removed ICommonSession from server concmd Execute.
* Added argStr parameter to concmd execute.
* The execute function of client concmds now returns void, use the new shell.RemoteExecuteCommand function to forward commands.
# Conflicts:
# Robust.Client/Console/Commands/Debug.cs
* Finally move shells and commands into shared.
* Console commands can now be registered directly without a class in a shared context.
* Pulled up ConsoleHost and Console shell into a shared context.
* Pulled up half the functions of ConsoleHost into a shared context.
* Repair rebase damage.
* Make LoadConsoleCommands function not remove any previously registered commands.
* Remove the main viewport.
* Re-add main viewport in a different place
* Move screen/map translation into ViewportContainer
* Support for viewport resolution
* Fix postfx, add WorldToScreen to Viewport
* Remove useless cast
* Some cleanup.
* Fix incorrect worldBounds when rendering viewports
* nullability
Co-authored-by: 20kdc <asdd2808@gmail.com>
* Add TryCastValue to CollectionExtensions.cs
* Change TryCastValue to be more generic
* Add notnull constraing for TKey to TryCastValue
Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
Someone please performance-test this, but I think the fragment shader code simplifications speak for themselves.
Radrark found the "line in polar coordinates" equation I needed and a diagram that explained the variables.
That equation was essentially the missing piece to the whole thing.
1. Set timeBeginPeriod(3) on the server to reduce scheduler latency in the lidgren thread.
2. Add 16ms of guaranteed lag bias to client prediction calculations to account for scheduler latency.
Both of these changes are to account for how the windows scheduler seems to handle time periods in related to socket polls. See this Discord conversation for why, details down below as well: https://discord.com/channels/310555209753690112/770682801607278632/798309250291204107
Basically Windows has this thing called time periods which determines the precision of sleep operations and such. By default it's like 16ms so a sleep will only be accurate to within 16ms.
Problem: Lidgren polls the socket with a timeout of 1ms.
The way Windows seems to handle this is that:
1. if a message comes into the socket, the poll immediately ends and Lidgren can handle it.
2. If nothing comes in, it takes the whole 16ms time period to actually process stuff.
Oh yeah, and Lidgren's thread needs to keep pumping at a steady rate or else it *won't flush its send queue*. On Windows it seems to normally pump at 65/125 Hz. On Linux it goes like 950 Hz as intended.
Now, the worst part is that (1) causes Lidgren's latency calculation to always read 0 (over localhost) instead of the 30~ms it SHOULD BE (assuming client and server localhost).
That 30ms of unaccounted delay worst caseis enough to cause prediction undershoot and have messages arrive too late. Yikes.
So, to fix this...
On the server we just decrease the tick period and call it a day. Screw your battery life players don't have local servers running anyways.
On the client we bias the prediction calculations to account for this "unmeasurable" lag.
Of course, all this can be configured via CVars.
* Fixes sprite scale not being taken into account.
- Only apply scale if length of scale vector not close or equal to 1.
* I blame Remie
* Fix vector maths
I should spend more time studying maths instead of contributing, to be fair.
* Remie no please nO
Who would win?
Thirty developers
-OR-
One sneaky ` ` boi?
On windows default path to dotnet are `C:\Program Files`. Without quoting the
the command if it contains a space, it's going to break Windows builds that
install in `C:\Program Files`.
Note: Thanks to the nature of YAML properties in RobustToolbox, this commit is only an API blocker if the Softness property is directly manipulated from code, which is unlikely.
* Defer MoveEvent out of TransformComponent.HandleComponentState
* Imports
* Make the update loop more readable and call ToArray
* Fix tests
* Fix tests HALLELUJAH
It's now parallelized which cuts off ~200ms on its own for me.
Config is now shared between multiple loads which saves a lot as well.
All in all, pretty good.
Fixes#1434
This means that adding support for new architectures (e.g. ARM) is MUCH easier.
It removes download_natives.py which simplifies the build process.
It's also way less painful to maintain.
Makes it not a "temporary todo remove" API since it has merits in e.g. assembly loading performance (.NET can mmap the assembly if it has a disk path which is better).
Removed duplicated IResourceManagerInternal APIs in IResourceCache.
Microsoft isn't supporting NuGet-components ASP.NET Core ever since 3.x so using Kestrel is out.
New implementation is 100% thread pool compared to the old one which was a single specific thread.
This uses .NET 5's new Unsafe.SkipInit() function and a lot of FieldOffset.
The result of this is that you can now take a `ref` to the primary corners of the boxes, as well as better codegen in some cases.
* Numerics helpers
* Comments
* Reuse naive methods for remainders.
* Do naive operation if array length is under 4.
* NumericsHelpers takes in Span, can store elsewhere
* Make some spans read-only
* Enabled static property to disable/enable hardware accelerated paths.
* AVX support.
* welp
* .
* environment variable to disable simd
* Adds ARM support (AdvSimd)
* Fix AVX horizontal sum
* Add unit tests
* NET 5.0 moment
* RemoteExecutor moment
* Add nuget.config to the UnitTesting project only
* Add "ROBUST" prefix to env vars
* Better naming for array length utils
* Revert "Add nuget.config to the UnitTesting project only"
This reverts commit 1d474ff33d.
* Ignore ARM tests, remove #if NET5_0
* #272 avoid mouse overlapping tooltip when near edges,
change tooltip colors to match mockups
* #272 WIP customizable tooltips, old approach currently working still
* #272 WIP customizable tooltips, old approach currently working still
* #272 ensure tooltips go away when disposing control
* #272 implement row-oriented GridContainer
* #272 generalize GridContainer to support
rows or cols
* #272 improve readability in new GridContainer
logic
* #272 GridContainer can expand in opposite
direction
* #272 GridContainer can expand in opposite
direction
* #272 GridContainer can expand in opposite
direction, fix test
* #272 add GridContainer capability to
limit by size rather than count
* #272 add some clarifications about ui scale and vp / rp
* #272 don't spam showtooltip
event, calculate tooltip
positioning using combined
minimum size
* AlignWithClosestGridTile extension for EntityCoordinates
- Fixes component exception when adding a timer component to a deleted entity.
* Address review
* actually...
* Fix map deserialized entities not being included in OccluderSystem
* Revert "Fix map deserialized entities not being included in OccluderSystem"
This reverts commit 0af8b50231.
* Make it do it in occluder startup instead
* Refactor pausing
* Sprite as well woops
* Bring PauseManagerExt back with [Obsolete] so that content compiles.
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
* Add HashSet YAML serialization
* consider this
* Revert "consider this"
This reverts commit f542f2c0bf.
* you think you are so funny c#
* Remove reflection call, fix equals and add tests
* Make this code slightly less bad
* Fix hashset equality and add test
* Some stuff for auth
* Holy crap auth works
* Enable encryption even if no auth token is provided.
It's still possible that the public key was retrieved over HTTPS via the status API, in which case it will be secure.
* Fix integration test compile.
* Secure CVar API.
* Literally rewrite the auth protocol to be minecraft's.
* Better exception tolerance in server handshake.
* Auth works from launcher.
* Fix some usages of UserID instead of UserName
* Fix auth.server CVar
* Kick existing connection if same account connects twice.
* Username assignment, guest session distinguishing.
* Necessary work to make bans work.
* Expose LoginType to OnConnecting.
* Fixing tests and warnings.
* Add support for 'Rounded' mode to Range (and thus Slider)
* Make lighting resolution more configurable
* Use a lighting presets dropper because RemieRichards said so
* Make ConfigLightingQuality not a property and instead two separate methods
* More configurable lighting: cleanup to use a switch rather than an if-chain
* Added struct skeleton for EntityCoordinates.
* Polish EntityCoordinates, add tests, add EntityCoordinates to Transforms
* Doc cleanup
* Remove useless code
* Return offset 0 when you don't have a parent
* Test for making sure EntityCoordinates for entities without parents have offset 0
* Use parent transform's GridId for GetGridId.
* Adds various methods, checks and tests
* Replace GridCoordinates with EntityCoordinates
* EyeManager.WorldToScreen fix
* Address reviews
* Fix za buildo
* Fix one transform test
* Fix the remaining tests
* Remove duplicate
* Remove another merge duplicate
* Fix property
* Rename most usages of GridCoordinates to EntityCoordinates.
* Add WithEntityId method to EntityCoordinates.
* Fix EntityCoordinates usage in GetEntitiesInRange
* Remove cursed IMapGrid method, change naming.
* Makes GridTileLookupSystem use EntityCoordinates
Co-authored-by: Acruid <shatter66@gmail.com>
Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
* Added struct skeleton for EntityCoordinates.
* Polish EntityCoordinates, add tests, add EntityCoordinates to Transforms
* Doc cleanup
* Remove useless code
* Return offset 0 when you don't have a parent
* Test for making sure EntityCoordinates for entities without parents have offset 0
* Use parent transform's GridId for GetGridId.
* Adds various methods, checks and tests
* Adds new constructor to EntityCoordinates and add WithPosition method
Co-authored-by: Acruid <shatter66@gmail.com>
Correctly use KHR and OES suffixed functions for debug output and VAOs, if necessary.
Allow overriding the detected GL version for feature detection (nvidia gives me an ES 3.2 context even when ES 2.0 is requested, so...)
1. Fixes screenshots on ES by providing a fallback path for when encessary features (PBO, fence sync, mapbuffer) are not available.
2. Correctly detect fence sync as not always being available for 3.1
3. Remove the "bad OpenGL version" box. We have MessageBoxW now.
4. Separated feature detection for ES and Desktop, added more feature detections on various sides.
5. Moved GL feature detection to its own file.
Net message functions are now cached when the message is registered or the string table updates (client side). This removes the cache call from DispatchNetMessage.
Receiving net messages that we don't have reception callbacks for, or that are blocked with the new NetMessageAccept enum, will instantly cause the net manager to drop the offending connection to avoid malicious use.
This means trying to send string tables to the server will just result in an instant kick without even hitting ReadFromBuffer().
This allows us to move some if() checks to asserts.
* Add component message for an entity moving
* Bring EntityMovementMessage out of the container check
* Make entity movement messages use one instance and mark PublicAPI
Added Open() method that takes in FileMode, FileAccess AND FileShare.
Added extra extension method helpers and made use of better FileAccess/FileShare modes.
BodyType is now serializable, fixes bug with VV.
Moved both velocity properties from ICollidableComponent to IPhysBody, added default methods to IPhysBody to get the word transform.
Added DebugTools.Break() method, calling it breaks execution in the attacked debugger.
Added VV attributes to various CollidableComponent properties.
Bodies without velocity are considered for collision, lockers are fixed.
Added force/torque integration to physics bodies.
Friction is now tickrate agnostic.
First open will be top left, centered, or left vertically centered. The subsequent calls to open will open the window at the position the window was closed at.
Removed Overlay.Shader property, you need to manage the field yourself and apply the shader before you draw.
Made all overlays compatible with the new changes.
Mark some classes as sealed where possible to remove type tags.
Re-order GameStateMapData.GridCreationDatum to reduce memory usage.
Use MemoryStream.TryGetBuffer instead of .ToArray() all over the place to cut out allocations.
Use VariableInt32s for serialized buffer sizes.
Use IRobustSerializer.SerializeDirect<T> where possible.
* Replace single controller with a dictionary
* Actually initialize the controller dictionary
* Fix not upgrading old physics controllers
* Return controller when adding it in CollidableComponent
* Make GetOrCreate name consistent
* Add updating linear velocity depending on controllers
* Address reviews
* Update Robust.Shared/Physics/VirtualController.cs
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
* Add missing physics component methods
* Make method names consistent with the rest of the project
* Add documentation to controller manipulation methods
* Add another method for controller manipulation
* Add SetController method
* Add stop method
* Add stop method to controllers
* Add bool return type to controller stopping and GetControllers method
* Fix physics stop return type not being bool
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
Allow content to push modal windows in the UI framework.
The MenuBar now closes it's MenuButton frame when you select one of the buttons.
Modal controls on the stack now actually block input from the rest of the UI.
Adds the `scene` concommand for instantly switching between game states (scenes).
I took the liberty to refactor it a bit internally so we can keep up-to-date copies of the NetPeer connection and channels lists per-peer. This allows us to avoid expensive copying allocations (Lidgren does not expose NetPeer.Connections without allocating due to thread safety)
This caused https://github.com/space-wizards/space-station-14/issues/1302.
The ChatBox focuses the LineEdit in KeyDown. This then causes the next key down, UIClick, to go to the LineEdit (it's keyboard focused now). The key up however is fired on the chatbox because keyups did prioritize mouse focus. So the LineEdit gets stuck thinking you have the mouse held down.
Now keeps a list of actively lerping transforms instead of iterating every transform every tick.
Yeah it doesn't even show up in profiles anymore instead of taking like 8% of CPU time.
Actually respects terminal encoding.
Doesn't do ANSI characters if unsupported (Windows) or redirected.
Uses 4-bit color codes instead of RGB codes.
More optimal outputting of ANSI escape codes. It's const all the way down.
* Fix client-side input system not sending sequence numbers for input messages.
This caused message ordering issues and keys getting stuck down.
* Make sure EyeUpdateSystem runs after physics.
* IGameTiming.TickFraction helper.
* Subtick data for input commands.
* Literally a unit test to verify that I wasn't going insane while debugging input message ordering issues.
* More prediction logs behind net.predict.
* Move physics to shared and run it on the client.
* Synchronize grid gravity.
* Fix ResetPredictedEntities crash when entities get deleted server-side.
* Fix CollidableComponent setters not calling Dirty()
* Fix going into space while predicting.
* Watch window uses history line edit.
* Fix unpredicted objects stuck-jittering.
* VV tags for interp vars on transform.
* Fix 0 mass objects on client.
* Fix friction calculations being TPS dependent.
* Reset predict flag on handelComponentState
* rework ComponentManager
create indexing solution, UniqueIndex
split out ComponentEventArgs, add sealed variants
fix up documentation
fix terrible crap
make benchmark work
* woops, ordered enumerables are already a copy
* naming
* clean up comments
* nullable enable
* add some doc comments to unique index
* perf tweaks
add UniqueIndexHkm for high key mutability
extract internal interface mostly for documentation
add nullability support and constraints
* fix doc comment for UniqueIndexHkm
* make PVS threaded
* remove redundant member declarations in interface
* fix grid loss crap on client shutdown
* fix nullability warning when retrieving from always constructed threadlocal
* add comment explaining chan == null check
remove inParallel parameter
* make lidgren use spans everywhere where it can
convert custom pooling to shared array pool impl
add unit tests for read/write
add native socket extensions to socket so we can legit pass spans for SendTo/ReceiveFrom
bump version in lidgren csproj
replace some random "% 8" w/ "& 7"
more minor nullability hacks to fix static analysis complaints
made receiving packets use span
minor native sockets refactor to use pinvoke
add read/write constrained/prealloc'd bit stream impl to lidgren and update usages
fixed missing stream cleanup
remove outstanding stream cleanup since it refs buffer thru the class, can't read some other buf
apply suggestions from code review
remove unsafe cruft
* add tests to gh actions
* make stats use interpolation in tostring and remove m_bytesAllocated since it's all in the shared pool now
* this pr still open so fuck it
stats, human readability, faster BitsToHold methods
* add api compatible version of ReadBytes
* rename ReadOnlyStreamWrapper -> ReadOnlyWrapperStream
rename WriteOnlyStreamWrapper -> WriteOnlyWrapperStream
add AppendViaStream, AppenderStream impl
add and update documentation on read/write bytes methods
also fix some goofs
update a bunch of packages and use JetBrains.Annotations as private asset as needed
mark some hot math methods agg inline to benefit from loop opts
use FMA for interp
use canny min/max/clamp
make Quaternion NormalizeAngle fixed time and faster
clean up YamlDotNet references
* implements shared string dictionary and handshake from net-code-2
* fix unit test
switch to szr sawmill
* try to silence some warnings around ZipEntry
* rebase and use system zip instead of icsharplib
fix rebase artifacts
* Update Robust.Shared/Interfaces/GameObjects/IComponentFactory.cs
* Update Robust.Shared/Serialization/RobustSerializer.MappedStringSerializer.cs
* Update Robust.Shared/Serialization/RobustSerializer.MappedStringSerializer.cs
* Apply suggestions from code review
* Apply suggestions from code review
* Update Robust.Shared/Serialization/RobustSerializer.cs
* since no longer gathering from paths, make string splitting more robust
* make string gathering ignore strings under 4 chars long
make string gathering yet more robust
* add limit to size of mapped strings
* add more string data to feed into shared string dictionary from YAML files
add JSON importer but don't parse RSI metadata yet
fix typo that breaks nulls in MappedStringSerializer
minor refactoring
make string splitting more robust
add WriteUnsignedInt / ReadUnsignedInt for validating WriteCompressedUnsignedInt / ReadCompressedUnsignedInt aren't bogus
* comment out some log statements
* minor refactor, reorder logging
add null check due to smart typing NRT checks
* Add doc comments, readability improvements to MappedStringSerializer
The protocol, handshake, and internal logic are now more documented.
The main area that could still be improved is the documentation of how
the cache system works, but the code is readable enough for now that it
isn't immediately necessary.
* add documentation, organization
* update some more doc comments
* add flows to doc comment for NetworkInitialize
* more documentation and organization
* more docs
* instead of retrieving INetManager by IoC, assign when NetworkInitialize is invoked
* "document" the regex
* Update Robust.Shared/Network/NetManager.cs
* add missing check for LockMappedStrings
* Update Robust.Shared/Serialization/RobustSerializer.MappedStringSerializer.cs
Co-authored-by: ComicIronic <comicironic@gmail.com>
* change to warning instead of throw for unlocked string mapping
Co-authored-by: ComicIronic <comicironic@gmail.com>
Tick clearing is now done in all entity constructors on the server, and components added during ExposeData like ContainerManager don't blow up on it anymore.
This fixes the issue where CurTime on the client would sometimes jump by
massive values. It was caused by an underflow when the current tick
would be before the most recently cached tick, due to time going in
reverse.
This reverts commit d81834c913.
I realized while writing the netcode document that `EntityEvent` is a different message group and am now quite ashamed of myself. This should stay as unreliable, probably.
If you sent multiple state updates on the same frame these could easily arrive in different orders on the client, which is definitely not intended. This fixes that by sending them per frame.
As a result, this also means earlier updates on the same frame are discarded, saving bandwidth.
1. Fixed handling of repeats so that they don't fire stuff incorrectly anymore.
2. Add Priority system to keybinds because apparently C# Sort isn't stable like I thought.
CanFocus is now evaluated separately by the input and UI manager so that it is possible to handle handling/UI blocking issues cleaner. This thus makes it possible to re-introduce keybind blocking which is quite useful.
NetSerializer does not handle these well and sends the entire backing array instead of a more compact representation. This can then cause it to start sending lists of length 1 with a *capacity* of 4096 resulting in 250 KiB/s down to send updates for a single entity. As it just did on the public server...
Made it so keybinds don't block other keybinds from firing.
Why is this necessary? This allows us to have "same keybind, different functionality" binds sanely, like shift click being both TextCursorSelect and (in content) ExamineEntity. Before this change the latter was temporarily broken in UI controls because of TextCursorSelect taking priority and instantly treating the event as handled because it's CanFocus.
The offshoot of this is that all the "args.CanFocus == mouse left" UI code had to be fixed, since multiple things were now firing for that and breaking everything. For example TextCursorSelect actually BROKE because now ExamineEntity was firing inside UI again and that was seen as a left click.
EngineKeyFunctions.UIClick has been introduced as "mouse left for the UI" for this purpose.
* Special check for decimal in serialization code. Changed method in IoCManager for a little QoL
* ISelfSerialize stuff
ISelfSerialize interface for stuff that want to implement their own (de)serialization.
Forgot that desialize could exist for decimals earlier.
Added ViewVariablesPropertyEditorISelfSerialzable thing for viewvariables.
* fix TestStylesheetOverride
* Fix improper UT logic
* Somewhat neater VV lineEdit event hanlding
* remove whitespace and unused using
* uninherit ViewVariablesPropertyEditorISelfSerialzable
* Fix improper use or ToString
* seal VV classes
* Adds a derived class from Nunit's Is test constraint class.
The game camera can now be rotated.
* Added the new `bind` command to the console, used to bind a key to a keybind.
Added two new keybinds for rotating the View camera left and right.
Added more info to the ""Component does not exist for state" exception.
Added Reduced() and FlipPositive() public functions to Angle.
* Fix a copy/paste bug.
* Adds missing code to bind/unbind CameraRotateLeft.
Camera snapping now actually uses the CameraSnapTolerance constant.
* Refactor Controls to default to MouseFilterMode.Ignore
* Clean up MouseFilterMode.Ignore from Controls
* Fix BoxContainer eating UI clicks
* Fix ScrollContainer using the wrong variable
* Refactor ContainerButtons to use a StyleClass for formatting instead of typeof
* Refactor BaseButton to work when child has MouseFilter.Pass
* Rework friction to work as a sum instead of indiviually
* Removed comments
* Changed how friction works from reducing movement to increased the effect of mass.
* Changed how collision checks work
* Undid asym collision
* Push to switch machines
* Added UnitTest to clarify the logic in CollidesOnMask
* moved test into testcase
* merged in shader automatic reloading, remove internal shader reloading
add support for includes to shader reloading, modified includes reload shaders that depends upon them
* add some fault tolerance to allow playing with the file a bit
* prevent multiple watch attempts
* fix spacing
* revert project change
* add cancellation to Reload with a default of 30s
fix case sensitivity comparison
assume windows & mac are case insensitive
Removed the component message queue inside of EntityManager. There should be no time where messages are coming in before the EntityManager is initialized.
Removed the ability to send EntityEvents, you need to send either component or system messages.
* remove setter for MapPosition
change DetachParent to set WorldPosition after re-parenting to correct Map entity or MapGrid entity
* workaround until default grid not needed due to items can't be picked up if map ent parent
* Use separate define constants for exception tolerance stuff.
* Improve handling of exceptions during entity creation.
The entity in question now gets marked as deleted immediately.
* Glorious.
* Testing components, tests, wrapper exception type.
* Work on shadow casting.
* Shadowcasting depth works, code cleanup
* Adds #include support to SWSL parser.
* Move lighting shader to swsl.
Also more shader parser fixes.
* Move PI constant to correct file.
* Got functional FOV, working on wall bleed.
* Hey, it kinda works.
* Occluder component now lives in shared.
* Optimizations.
* Fix light map color format.
I set it to something else while testing perf.
* Front face cull final FOV pass.
* Fix holes in occlusion geometry due to disabled occluders.
* Starting work on better wall handling.
* Some comments.
* Improve font-face-culled FOV pass.
* Improve various light biasing things.
* VSM, smooth shadows.
Also unused VSM blurring because it didn't work but committing it like this will forever keep it in Git somewhere.
* FOV smoothing, looks kinda awful.
* Base wall bleed blur strength on camera size.
* The part where I give up.
* Comments. Many comments.
* Allow eyes to disable FOV.
* Improve OccluderComponent on the client.
* Update for occluder component changes.
* Maybe do this properly...
* bubble implementation
include contained entities
fix line edit crash when clipboard contents are null somehow
use CVar for update bubble range
remove seenMovers that get NaN'd out of MaxUpdateRange - huge reduction in network traffic from bullets
cut default of MaxUpdateRange down to 12.5 for now
maybe handle teleported things
handle removing player state on disconnect
fixed positional audio errors
make UpdateEntityTree also update player's last seen ents
make net.maxupdaterange cvar tunable at runtime w/o impacting performance
back to position nan as means to hide from client
revert work pooling as the wrong player was getting the wrong game state
ffs needed to think less about *if* something is *seen* and more about *when* it must be *unseen*
clean up usings
handle parenting and sequencing issues that arise on the client
gather needed ents to update recursively
applied suggestions from code review
fix missing recursively contained ents
make assumption that client last saw things on first tick instead of tick zero, as zero would be the "from tick" and first would be he "to tick"
add First tick as constant to GameTick due to relevance above
renamed includedEnts to checkedEnts to make usage more clear
added comments
inverted some conditions to flatten parts of the pvs logic
fixed sending states when already seen (lastChange < lastSeen to lastChange <= lastSeen)
fix sending states when no actual changes (other bugs?)
local caching of currentTick, remove priorTick
* make TransformComponent's Parent setter call Dirty() to handle replicating network state if AttachParent isn't invoked
* fixed parent changed by setting Parent on Transform not updating parent's Children collection and other stuff
rotating parent entities now are visible with their orbiting children if one of their children moves into view
* break out duplicated code as GetLastSeen
* remove unused net.parallelstates
introduce net.pvs to configure enabling/disabling PVS
* Removed the EntitySystem event implementation, it now uses the more advanced EventBus.
Removed EntitySystem.RegisterMessageTypes() function.
Removed EntitySystem.SubscribeEvents() function.
Added EntitySystemMessage.NetChannel field. This holds the remote net channel the event originated from.
* Removed the Sender object from events. If you needed this field, add it to the event class.
* Removed unused event proxy methods from Entity.
SubscribeEvent() has been split into SubscribeNetworkEvent() and SubscribeLocalEvent() methods on EntitySystem.
Most methods on EntityEventBus now require callers to specify the source (Local or Network) of the events.
* Implement HistoryLineEdit
* Refactor DebugConsole to use HistoryLineEdit
* Clean up LineEdit
Add args.Handle() for each BoundKeyFunction
Clean up if statements
* Rearrange LineEdit variables
* Reimplement DebugConsole saving and loading
* Add style to TextureRect
* Implement ContainerButton
ContainerButton is a button that resizes to fit the Controls it contains.
* Refactor OptionButton to use ContainerButton
This allows OptionButton to have an inverted triangle icon on the right to make it more obvious that the button is an OptionButton.
* Fix Popup not updating size when opened
* Fix DrawMode not getting updated when _pressed is changed
* Refactor Button to inherit from ContainerButton
* Refactor CheckBox to inherit from ContainerButton
* Fix Control.StyleClasses.GetEnumerator
It was calling GetEnumerator in an infinite loop instead of getting _styleClasses.GetEnumerator like it was supposed to do.
* Update Button references
* Fix Styling
Removed use of ConcurrentDictionary. It was slow.
Other minor optimizations around the codebase.
Added option for parallel game state generation. Seems slower than doing it single-threaded so off by default for now.
* Fix server sending ALL game states reliably.
Now only large enough game states get sent reliably. This means that when a single client stops ACKing the server isn't spamming a bunch of massive game states into Lidgren to reliably deliver.
* Do not send prototype-duplicated data in game states.
This cuts out component states and ComponentChanged data if this can already be inferred by deserialization of the prototype on the client.
* More comments.
* Remove debugging code.
* Use GetNetComponents instead of GetAllComponents.
Nice little optimization.
* implement StatusHost as a minimal Kestler based HTTP Rest service
break up and organize StatusHost
* handle weird disposal mechanics exposed by testing facility
Adds a check to the `PlayAudioPositionalMessage` case of client `AudioSystem` to make sure the grid it's playing on actually exists. If it doesn't, an error is logged and the message is ignored instead of crashing the client.
* have PhysicsManager use DynamicTree
* remove BroadPhaseNative
add BroadPhase wrapping DynamicTree
replace IBroadPhase with regards to DynamicTree
* add collision enumeration capability for proper BroadPhase
* fix slow app exit due to MapId being unavailable at various stages of shutdown
reduce code footprint of alternate query in AnyEntitiesIntersecting by using existing query (only used rarely)
* separates Rays from CollisionRays, removing collision masking from Ray
* Entity, ClientEntityManager and EntityManager classes occasionally need to UpdateEntityTree
Entity intersection queries now use a DynamicTree
DynamicTree now correctly reports Count and separately NodeCount
DynamicTree now has optionally precise queries
DynamicTree no longer incorrectly Adds on AddOrUpdate if Update is not necessary
Entity startup now starts Transform, then Collidable, then remaining components
EntityManger's Entity dictionary is now a ConcurrentDictionary to support iteration under modification
DynamicTree freeing root leaf no longer results in invalid tree
SnapGridComponent has been extended to support additional area and directional queries
* added lots of calls to UpdateEntityTree, will need to scale back during review
fixed moved/changed AABB updates to DynamicTree, missed a ref
converted other methods in EntityManager to use the tree for spatial queries
* add unit tests for DynamicTree
make Capacity and EnsureCapacity public, setting Capacity will call EnsureCapacity
* fix brace style
* Box2 Grow -> Enlarged, Combine -> Union
Clients would treat any message coming in as being from the server they're connected to, instead of ignoring them if they're not correct.
This made the client crash inside integration tests because messages came in while disconnected.
This fixes that.
This is necessary because content now loads the preferences database from the thread pool. This causes the assembly loads for that (they're lazy by the runtime) to run in that thread, which means that the resolver callback we set up in ModLoader did not work (it has to do an IoC resolve).
This change creates a new AssemblyLoadContext for every ModLoader and as such we can tie the loading in said context to a specific ModLoader, thus cutting out the need for a static IoC resolve.
This also paves the way to assembly unloadability a bit.
This allows us to make Content.Client and Content.Server Exe projects so that they can be executed directly via your IDE. This'll help wtih not forgetting to do a full rebuild and such.
* Add delete key behavior to LineEdit
Pressing delete will now delete the character in front of your cursor like usual.
* Update Robust.Client/UserInterface/Controls/LineEdit.cs
Co-Authored-By: Pieter-Jan Briers <pieterjan.briers@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
Returns early if the window or framebuffer width or height = 0 to avoid dividing by zero. Checked the vector components individually instead of using `Vector2i.Equals()` because you can end up in a situation where width is non-zero and height is zero if you manually resize the window instead of using the minimize button.
Use PLINQ for prototype loading. Most of the time is spent reading YAML so this should help a lot.
Don't regenerate collision for every tile placed by the map loader.
Grid collision rectangles are now drawn as a blue overlay in the CollisionOverlay debug view.
GridChunkPartition now also returns the bounding rectangle, which is a union of all the collision rectangles.
Each IPhysShape now handles it's own debug drawing with a new method, DebugDraw.
Added MapManager.Restart().
Added MapManager.CreateNewMapEntity() and MapManager.SetMapEntity() for manipulating the map root entity.
You can now spawn entities directly into Nullspace, after setting up the Nullspace map entity.
This is not a proper fix. A proper fix would be a better physics engine.
But as it stands I really wanna get a progress report out and having to refactor physics to do it would just suck.
This fixes batching not working for sprite layers. They'd set & reset the active shader constantly which broke batching.
Active shader is now part of batch meta data and broken like other data like textures.
This halves the memory necessary for the lighting framebuffer, so probably helps with bandwidth usage (especially on integrated GPUs) too.
I couldn't notice a decline in visual quality on my (admittedly) bad laptop screen.
* Fold animation delays into a single set for all directions.
* Update systems to use new RSI animations API.
* Fetching layer directions now done in sprite render.
* Allow overriding direction in SpriteView.
* Adds Map components to the ECS system.
* Grid entities are now created along with map grids.
Grid components are now properly reused from map deserialization when a grid is created through the MapManager.
* Make MapGridComponent shared.
Don't send Nullspace default grid to client, they have their own.
Properly link the new grid with the entity sent from the server.
* Fixes nullRefException when ToString() is called on an Entity with no Prototype.
* Adds logging debug info about binding a map/grid to an entity.
Nightly Commit.
* Client map networking now properly pivots a grid from the client entity to the shared entity.
Added IMapGridComponent.ClearGridId() to properly dissociate the component from a grid before deleting it.
WorldPosition of a default grid is always 0,0 regardless of the entity transform (if any).
Nullspace map and default grid are not bound to an entity.
Nullspace map and default grid cannot be deleted.
* Map Entities are now created along with new maps.
* Client & Server load with new scene hierarchy.
* Fix rebase damage.
* Added ContainerHelpers helper class.
* Fix Container checks.
* Fixed clothes.
* Fixing unit tests.
* Removed disabled code.
* Actually initialize and startup the Map and Grid entities.
* Use GLFW instead of OpenTK windows
* Seems to work pretty well now.
* Fix stackalloc issue on Framework.
* Add GLFW project to sln.
* Fix package downgrade.
* Fix SLN more.
* Please work.
* Fix C# version error.
1. NetManager.IsConnected no longer uses LINQ.
2. creating net messages for sending/receiving now uses cached DynamicMethods to improve speed (bypasses Activator.CreateInstance and params allocations)
3. Entity.GetComponentStates uses GetNetComponents now.
4. PhysicsManager allocates significantly less now.
* UI layout v2.
All controls now act like containers.
Moved anchor/margin layout model to LayoutContainer
Implement basic WPF-like attached properties for the above LayoutContainer.
* Fix VV.
Give BoxContainer a preset capacity to reduce allocations in layout.
Removed Control.GetChild(string) and similar. This was no longer used (and was a pretty bad idea in general), and the implementation had a lot of wasted book keeping to do.
Use UpdateLayout() instead of DoUpdateLayout() in Control minsize changed to avoid doing redundant layout, and by extension style & minsize, updates.
Used RemoveAllChildren instead of DisposeAllChildren in EntitySpawnWindow because it's faster (way less stuff to clear, just let the GC handle it).
Optimized ResourcePath with a better GetHashCode(), better Equals, replacement for List<T>.ToArray()
Fixed enumerator allocations in stylesheet SelectorElement matching to speed up style updates.
ResourceCache now caches fallbacks to avoid constructing Resource instance when fetching fallback explicitly.
ResourceCache now has nested dictionaries for Type -> ResourcePath -> BaseResource storage of resources.
Use calculated property instead of auto property for TextureResource.Fallback
* Moved IMap from Shared/Interfaces/Map to Shared/Map namespace.
* Extracted Map class out of the MapManager class.
* Removed the Map class and interface.
* Fully removed the Map and IMap class.
* add basis for debug drawing raycasts
* rays
* this was too much work
* i assumed you could do string object stuff. you cant.
* fixed a crash
* Greatly improved DebugDrawingManager code with a struct and list as opposed to dictionary
* change default ray debug color from green to magenta
* reviewed changes
* reviewed changes and adds network message to physicsmanager so it works without much user config
* raw PCM audio for clyde
* Remove soundfont.cs
* Midi stuff
* Some more work
* This actually works now!
* update
* Add nfluidsynth submodule.
* fuck
* Midi audio works!
* Lots of stuff, and cool interfaces for items
* Update
* Note limit
* Moving out of range of UI raises OnClosed now as well
* It just works
* Update nfluidsynth submodule
* Remove managed-midi, remove unused methods I added to clyde
* Remove remnants of older NFluidsynth
* Update nfluidsynth submodule.
* Fix some of MidiManager
* Add changes PJB made to soundfont loading
* Delete OpenAL source/buffers when disposed
* Remove remnants of "Rendering"
* Use ReadOnlySpan, make interface/implementation arguments consistent
* Improve EmptyBuffers performance
* Make renderers use an enum for their status
* MidiRenderer events are now invoked on the main thread
* MidiManager now has a method to dispose renderers
* Lock player
* Fun stuff
* Update nfluidsynth submodule.
* Fix midi audio rendering
* Address a few reviews
* Revert changes made to Clyde
* Create sfloader per midi renderer
* Midi file size check
* Now OpenMidi/OpenInput and their respective close methods return bools.
* Update nfluidsynth submodule.
* Move number to constant.
* Use BufferedAudioSource
* Remove unused using statements
* Use new API
* Lock player and synth correctly
* Use midi sawmill
* Adds "Disposed" property to MidiRenderer
* Remove DisposeRenderer, let midi render thread handle it instead
* Renderer position is updated from main loop
* Use nfluidsynth from nuget
* Fix appveyor, lazy fluidsynth init
* Only join MidiThread if it actually exists...
Added IClientConGroupController and implemented it as ClientConGroupController. Lets client-side code check what commands the client can use based on their console group. Serves the same purpose as the server-side IConGroupController except it doesn't load a list of permissions from groups.yml. Instead, the server ConGroupController sends updated permissions to clients whenever they change.
By making these public they can now be used by content to check if players are in the right group (admin, mod, etc) before doing certain things. Required for PR 380 on content (https://github.com/space-wizards/space-station-14/pull/380)
* WiP property animations system
* Use better lerp for Angle property animations.
* Fix handling of offset in sprite component.
* Allow animating some sprite layer properties.
* Allow animating some Transform properties.
Obviously not advisable for server entities, but great for client side entities!
* Improve animation property interpolation handling.
Added a "previous" mode.
Made values that cannot be sanely interpolated fall back to this mode.
* Improve some animation docs.
Reverts b40413dfd6.
Decorates EntityPrototype.Name with CanBeNull.
The entity spawn window now properly handles prototypes with null names. Previously, a null name would throw a NullException. Entities with null names will never show up in the spawn window search results.
* Use DynamicMethod for dependency injection.
Should be way faster to initialize types and also have no allocation overhead
* Cleanup, don't make injectors for types without dependencies
* Fix Framework, maybe?
* Test the new system explicitly.
* Adds a new IPhysicsShape object where you can define what collisions shape a PhysBody has.
AABB is now accessed through the PhysicsShape, so the BoundingBoxComponent is not required.
* Default PhysShape now copies the AABB of the BoundingBoxComponent.
* Fixed issue with serialization of PhysShapeAabbComp.
* Spatial queries now use ICollidableComponent instead of BoundingBoxComponent.
showbb now draws entities using the obsolete BoundingBoxComponent in Aqua.
* Renamed PhysShapeAabbComp to PhysShapeAabb.
Removed BoundingBoxComponent.
* Default CollidableComponent does not collide with anything now.
* Renamed ICollidable to IPhysBody.
Moved ICollidable to the Robust.Shared/Physics namespace.
* PhysShapes are now a collection of primitive shapes that contribute to the whole PhysBody.
ObjectSerializer.DataField can now deal with abstract types using YAML tags.
* Added LocalBounds property to ClickableComponent.
Added state to ClickableComponent.
* Added a Rectangle physics shape.
* ClickableComponent now actually checks that a click is inside its bounds.
* Reverted the addition of a try/catch around map loading. Any errors can propagate to the code trying to load the map again.
Prototypes will now use existing components, like transform, when loading an entity. Previously they blindly created new ones on the entity.
AddComponent now cannot overwrite a protected component, ie TransformComponent and MetaDataComponent. Entity caches these components, they cannot be changed.
Regular RemoveComponent functions are now not able to remove protected components.
* Add a check in OnContextChanged to fix some crashes
Fixes crashes due to double input like the Quit button in the Esc menu
* Changed BaseButton to only trigger on KeyBindDown and KeyBindUp on the same control
* Fixes right click menu stopping input
Removed a flag change when the modal stack was showing, which preventing the click from getting passed to the next function.
* Added parsing for mod2 and mod3 from Keybind YAML
* Fixes a crash on context change when a keybind is not defined in keybinds.yml
* Implemented ShowDebugConsole Hotkey
* Refactored input system
Refactored input system to run Key and Mouse input through the InputManager before doing stuff.
* Upgraded LineEdit and classes that use it. Fixed input while KeyboardFocused.
Upgraded LineEdit to use Keybinds.
Upgraded DebugConsole to use Keybinds.
Replaced all references to MouseDown, MouseUp, KeyDown, and KeyUp with KeyBindUp and KeyBindDown.
Moved UserInterfaceManager call from GameController.Input to InputManager event.
Stopped input going to simulation while a control has focus in UserInterfaceManager.
* Some fixes for input system
Fixed keybinds getting stuck when selecting a LineEdit.
Changed MenuBar to not error.
Fixed a few cases where LineEdit would eat input if you hovered over it and where mouse input got eaten when clicking in the world while a LineEdit was selected.
* Removed extra dependencies
* Added GUIBoundKeyEventArgs to ButtonEventArgs
* Fixes for input with LineEdit selected
Fixed multiple keybinds mapped to the same key not triggering.
Fixed keybind input not getting to LineEdit when hovering over a control.
* Implemented Key Repeat for LineEdit
* Fix for input on Robust.Lite Launcher
* Renames NonFocusKeybinds to EnableAllKeybinds
Renamed NonFocusKeybinds to EnableAllKeybinds and added comment to clarify usage
* Adds repeating keybinds
Used for TextBackspace, TextCursorLeft, and TextCursorRight
Reverts a change to LineEdit that implemented repeating keys
Adds some documentation comments
* Quick fix to flashlight radius
* SomethingAbout CSS Class
* Shitty update
* fuck
* Creativ!
* Last But not least
* Quick Change
* Fixed version
* Tiny fix
* Next Fix
* Another fix
* Refactor UI system.
Deferred updating is used for styling & layout. This fixes the awful time complexity of containers.
Removed SetDefaults and Initialize. They were a bad idea alright.
* Fix build on .NET Framework.
* Attempted Clyde cleanup, didn't get far.
* Add negation operator to Vector2i.
* Add RenderOrder to ISpriteComponent.
* Post process shaders.
Adds "post process" shaders to sprite component.
These are executed on the WHOLE sprite component (every layer)
in one draw.
This is necessary to implement functional outlines.
They no longer load system-wide config or user data.
User data is emulated through a VFS.
Also added more hooks to improve the customizability of the test,
for example allowing content to hijack their IoC registrations.
This is necessary to avoid tons of papercuts with entity systems.
Without this it is not possible to create entities inside the update loop of an entity system, which is too common for me to disallow.
As for performance, I offset it by removing the LINQ usage.
It's marginally faster than before even.
This clears the collection of style classes and adds the new one. This allows controls to easily switch between several style classes without needing to keep track of the active one in their own code.
* Project file refactor
Move all the .csproj files to the new .NET Core style.
This doesn't make any difference for compiling for Framework,
but it does reduce a ton of useless boilerplate.
As an extension of this, killed a bunch of uncompiled & unmaintained .cs files.
Compiling for release (to profile) works now.
Removed AnyCPU targets from the solution file.
* Fix compiler warnings.
* Add StyleBox overrides to ProgressBar
The overrides are StyleBoxFlat instead of StyleBox as StyleBox does not expose or possess a color property. _getBackground and _getForeground were also changed to return StyleBoxFlat instead of StyleBox to keep things simple.
* Change ProgressBar _getBackground and _getForeground back to StyleBox
* Change ProgressBar style box overrides from StyleBoxFlat to StyleBox
* Retrofitted ComponentManager_Test to use DependencyCollection.
* Renamed ComponentManager_Test to ComponentManager_Tests to follow naming conventions.
* Added component add/remove/delete events to IComponentManager.
Removed IEntity dependency from ComponentManager.
* Entities can now be spawned without a prototype.
* Removed unused function.
* CreateEntity now actually works with a null prototype ID. The other spawn functions should work as well.
Updated doc comments for IEntityManager.SpawnEntity().
* Remove unused options menu tscn
* Move SS14Window to pure C#
* Move SpriteView to pure C#
* Move EntitySpawnWindow and EntitySpawnItem to pure C#
* Removes using statements accidentally added by resharper
* Set EntitySpawnWindow default size to normal value
Note that in construction menu and storage menu this had to be done in the object initializer and didn't work if it was set in the Initialize function for the respective menus. For whatever reason setting it in the EntitySpawnWindow.Initialize works fine.
Not quite perfect, but quite usable.
Adds the ability to scale the UI. Scaling is controlled via a cvar,
and can be changed at runtime.
Fractional scaling is supported.
Some controls could be better (SpriteView, TextureRect),
but for now it's a good start.
* Tile Placement box actually uses the mouse snapgrid, not the players.
* Placement box only snaps to grids if cursor is over grid.
First tile of new grid is centered on cursor, instead of bottom left on cursor.
* Place square now sticks to the edge of a grid.
Cannot place tiles that would touch two grid Bounds.
Make containers actually handle automatic removal of entities,
like say on unpartenting.
This was because a lot of content code was doing this manually,
and it broke, really badly.
They also emit events now that said content code can use instead.
* Server works if not connected to a tty.
* Rich presence does not run IoC resolution at runtime anymore.
* Work towards integration tests.
Mostly work related to making it so the server and client can run in
parallel, and allowing more control over main loop for testing.
* Lots of code relating to integration tests.
* Split GameState processing logic out of ClientGameStateManager into the new GameStateProcessor class.
* Adds a test fixture for GameStateProcessor with a basic use test.
* More unit tests and added Extrapolated property to GameStateProcessor.
* MapInit v1, so people can criticize my code.
* Map init v1.
* Improve LocalPlayer to fix aghosting.
* Fix map saving.
* Map command improvements:
Implement loadbp
Made certain commands aware of uninitialized maps.
* Adds IMapManager.GetAllGrids()
* Add lsgrid and lsmap commands.
* MetaData component serialization fixes.
Serialize name and description default as null.
Don't serialize prototype.
* Explicit UID indices in map files.
* Update map format doc again.
* Added centered unit box static field to Box2.
* MapGrid is more testable.
* Added some unit tests for MapGrid.
Fixed bug in MapChunk.GridTileToLocal().
MapGrid.UpdateAABB() actually expands properly now.
* Moved IMapChunk to Robust.Shared.Map.
Moved Chunk class out of MapManager class.
* Added unit tests for MapChunk.
* Bounds reduce by 1, so almost working.
* Now bound shrinking works :D
* Moved MapGrid out of MapManager.
Moved IMapGrid into the Shared/Map folder.
Replaced all calls to IMapGrid.ParentMap.Index with IMapGrid.ParentMapId.
* Added more MapGrid unit tests.
Fixed a bug in TryGetTileRef.
* Added a new special MetaDataComponent to store entity data that isn't specific to a component.
* Adds ExposeData to MetaDataComponent.
Name of the entity now defaults to the prototype name.
* EntityStates changed so that the list of networked components is not sent every tick for a modified entity.
* Code cleanup & doc comments.
* MetaDataComponent Name and Description are taken from the prototype before storing them in the component.
* Adds the EntityState serializer benchmark. This isn't a test, but is really useful.
* Redesigned the logic in ServerGameStateManager.
* Adds MetaDataComponent registration to the UnitTesting project.
* You can scroll ItemLists now.
* ScrollBar actually appears!
* Remove System.Drawing
* Move total content height away from the drawing loop, recalculate it...
...when needed.
* Take ActualBackground minimum vertical size into account
* Fix cases where lists didn't scroll to the very bottom.
* Fix CalculateMinimumSize for real I hope
* Removed unused method TileRef.GetStep().
Removed unused property TileRef.TileSize.
Removed unused property TileRef.Tile, made the field public with the same name.
Made the TileRef struct readonly.
Removed property TileRef.TileDef.
Removed property TileRef.LocalPos.
Renamed GridTile to GridIndices.
Implemented IEquatable on TileRef.
Implemented Equality operators on TileRef.
Added PublicAPI attribute to TileRef.
Added doc comments to TileRef.
* Modified Tile:
Added the PublicApi annotation.
Made struct readonly.
Filled out doc comments.
Changed auto properties to readonly fields.
Renamed TileId to TypeId.
Added a static Empty tile to the struct.
Implemented IEquatable.
* Modified MapCoordinates:
Added PublicApi attribute.
Implemented IEquatable.
Filled out doc comments.
Removed Map property.
* Modified ScreenCoordinates:
Filled out doc comments.
Added the PublicApi attribute.
Implemented IEquatable.
* Modified GridCoordinates:
Removed method IsValidLocation.
* Removed property GridCoordinates.Grid.
* Removed GridCoordinates.Map.
* Removed GridCoordinates.MapId.
* Removed property GridCoordinates.IsWorld.
Removed constructors taking a MapId.
* Removed static IoCManager calls from GridCoordinates.
* Modified GridCoordinates:
Added attribute PublicApi.
Filled out doc comments.
* Filled out doc comments for MapGrid.
Filled out doc comments for MapIndices.
Misc refactors for both.
* added command to teleport grids.
* Added method Box2.Intersect.
Added method Box2.Union.
Placement manager now spawns new grids to place tiles not connected to an existing grid.
Code was changed so that time starts at tick zero, and all entities are initialized in the space between tick 0 to 1. This was a solution to the fact fromSequence was including entities with lastStateUpdate tick one less than the actual sequence number. This is purely an issue about when exactly the game does its logic relative to the tick signals, ie positive or negative edge of the tick. Right now the game is set up to run the game logic on the positive edge of a Tick (enforced by GameLoop).
The second big part is that an empty collection takes 5ish bytes more than a null collection in the NetSerializer, even though they are conceptually the same thing in a game state. This PR puts null checks around everything and allows GameStates to have whole sections of itself null. This reduced the payload size of an empty game state from 49B to 15B.
This PR also fixes the bug where the physics system marks every movable entity as dirty every tick.
RobustToolbox projects should be named Robust.*
This PR changes the RobustToolbox projects from SS14.* to Robust.*
Updates SS14.* prefixes/namespaces to Robust.*
Updates SpaceStation14.sln to RobustToolbox.sln
Updates MSBUILD/SS14.* to MSBUILD/Robust.*
Updates CSProject and MSBuild references for the above
Updates git_helper.py
Removes Runserver and Runclient as they are unusable
I guess I accidentally removed some comment strings and didn't realize until I pushed. Related to issue #180 on the content repo. I'll put in a separate PR on that repo to fix the prototype for walls too.
* add a new GameTick struct.
* Everything now uses the new GameTick struct.
* TickRate was changed to a byte, no way it is going over 255.
Fixed bug with changing TickRate after the loop has started.
Client now properly sets the TickRate when connecting to a server.
* Removed the old CurTime fields from game states.
Getting to the Connected runlevel on the client does not require a gamestate.
GameState processing now only starts after the client runlevel >= Connected.
Added some preprocessor conditions to not catch exceptions in Debug builds.
Nightly work on the GameStateManager, it is still pretty broken.
* NetMessages now have a Size property.
Player states were fixed, you can now join the game again!
* Frame interpolation kinda works.
* Frame Interpolation pretty much works!
* simulation can now catch up if a lag spike causes it to fall behind.
* Added concommand to debug draw the interpolation targets.
* Fixed a bug with applying just the NextState to an entity.
* Skip/replay a tick to slow down if the client is running ahead of the server.
* Solved a null ref exception when an extrapolated packet is applied.
* The TickRate is now officially 10.
* ClientGameStateManager stops running when the client leaves the server.
* Replaced poorly implemented FastForward with new TickTimingAdjustment.
* Update System.Runtime.CompilerServices.Unsafe to get rid of version conflict.
* Added 'net.interp' cvar.
* Disabled frame interpolation by default. The entire feature will be disabled until clientside input prediction is working.
* Removed or disabled log spam.
Fixed Transform unit test.
* Fix compile.
* Removed Static IoC calls from MapLoader.
Misc Code cleanup in MapLoader.
* Removed static IoC calls from ViewVariablesPropertyControl.
* StateManager now uses the DynamicTypeFactory to create States.
Removed static IoC calls from States.
* EntitySystemManager now uses the DynamicTypeFactory to create States.
Removed static IoC calls from EntitySystems.
Minor code cleanup.
* Removed static IoC calls from DebugDrawing.
* ComponentFactory now instantiates Components with IDynamicTypeFactory.
Removed static IoC calls from all engine components.
Misc code cleanup.
* Removed static IoC calls from all DebugMonitors.
Misc code cleanup.
* Removed static IoC calls from spawn windows.
* Removed static IoC calls from UserInterface/CustomControls.
* Fixed unit tests.
* Removed static IoC calls from AppearanceComponent.
Added a bool to ICollidable to indicate friction with the floor, for thrown items down the line.
Added a bool to PhysicsComponent to indicate if movement is possible.
Added list of PhysicsComponent that are slowing "this" down.
PhysicsComponent handles BumpEntMsg by adding the bumping entity to that list.
Implemented ICollideSpecial to prevent collision with items in that list.
Reworked movement code:
- Separated calculating movement from doing movement;
- Calculating movement now involves several recalculations to see who is on "that" list;
- Friction of a tile now slows movement down depending on an object's mass;
Optimized collision code by building a Dictionary with a snapped grid location for key, reducing the amount of bodies that need to be checked significantly.
* Changed EntityQueries for 3x perf increase for the EntitySystemManager.Update() method.
Removed the useless giant list EntityQuery.
Allowed the DependencyCollection to be able to inject itself as a dependency. Hopefully it won't be abused too bad.
Added the new IDynamicTypeFactory to IoC for instantiating arbitrary types. This removes the need for Activator.CreateInstance() and IoCManager.InjectDependencies() anywhere in code.
Utilized IDynamicTypeFactory in IComponentManager as an example of its use.
* Added IDynamicTypeFactory to SS14UnitTest.
* Rework entity initialization.
Map loading now correctly processes entity load stages:
1. First all entities are allocated. This allocates the entity and gives
it a UID, nothing more. No user code is executed.
2. Then all entities are loaded. This runs ExposeData on components.
3. Then all entities are initialized. This runs Initialize.
4. Then all entities are started. This runs Startup.
Entity spawning methods on IEntityManager now actually set position
before Initialize.
Also cleaned up a lot of spaghetti.
* Add some comments.
* Refactor tile IDs.
Tile IDs are now automatically assigned at runtime.
A mapping is also stored in map files to avoid compatibility issues.
Also removed tile prototypes. Content is now responsible for it.
This is so content can define its own data for tiles.
* Update map format specification.
* Fix tile placement.
* Reworked the net manager connection sequence.
* Correctly handle IPv4/IPv6 prioritization and fallback.
* Making a proper handshake for an auth system further down the line should be much easier now too.
* Added feedback to connection sequence in the main menu.
This PR establishes the format "Runtime-yyyy-MM-dd-THH-mm-dd.txt" for runtime logs from the server, preventing locale from messing with string escape characters and causing directory runtimes at next line. ~I've replaced the dash with an underscore as they can cause problems in some shells such as windows CLI.~ Dashes are staying because whoever has a shell that complains needs to get a new one.
~~**_I have most importantly made sure that SS14 can live on until the year of our Lord God Emperor and veritable saviour 99,999 Anno Domini of the Gregorian Calendar by extending the runtime-log-naming year range to 5 digits._**~~
~~_Let the meme PRs begin if they haven't already_~~
4 digits so logs will display until 9999, godspeed future maintainers.
I was unable to reach 60 FPS steady on my Intel UHD 630,
so I'd say this is probably warranted.
It doesn't reduce visual quality in any way I can tell.
Load up OpenTK.dll.config again. PackageReference doesn't copy it due to
incorrect packaging.
I had to make packages be downloaded locally to the solution again via
nuget.config to do this, because otherwise I couldn't get a reference to the OpenTK.dll.config in the NuGet package.
Adds a Python script to auto download freetype6.dll and openal32.dll on
Windows.
Clyde does custom shaders. Woo!
Still some things need implementing like custom uniforms and vertex shaders,
but this commit is big enough as is.
Also gets rid of texture array based batching because it was a pain.
It now assumes that a state has the same total animation length for each
direction, this solves problems like rotating resetting animations.
Also paves the way for manual animation control.
I'm channeling the power of spaghetti through individual spaghett-
Wait what do you call an individual thing of spaghetti.
A noodle?
A strand?
Should I use this word every time I write bad code?
// Noodle incoming.
So many questions.
Adds a call to viewport on opengl init in order to properly initialize the viewport size when the OS imposes a window size on window creation. Fixes Windows OS tablet mode-imposed window sizes.
That System diff is a bug.
It's never going to be re-implemented on Clyde,
so I'm making it internal so content doesn't try to touch it.
Also fixed ScrollFollowing not being set.
So uh... Godot. Mind explaining why call()ing a nonexistant function
is completely silent?
Godot's RichTextLabel is extremely complicated to re-implement.
OutputPanel is a stripped down version that's significantly simpler.
It does what it needs to for the purposes we use RichTextLabel.
This is a really crappy OpenGL 4.5 rendering backend. Doesn't draw a lot of things but it's a hell of a lot better than Godot in the stability department. Mostly.
It's far from production ready but I already wrote all this. There's some minor API improvements in here too.
Maps are now synchronized as part of game states.
This instantly fixed all race conditions and the client can now live through a round restart with 0 problems (outside of Godot crashing yay).
I took the functionality of `IoCManager` and moved it into a non-static class. This new class is called `DependencyCollection`. The static `IoCManager` is now just a proxy to a `DependencyCollection` singleton. I also added the ability to directly register instances into the collection. The Smocks library was added to `SS14.UnitTesting`.
This is super useful for unit testing, because now you can register mock instances directly into the collection and then other services can resolve them. You can also apply a shim to static `IoCManager` calls and handle them properly. Because the collection is instanced, we can now run tests in parallel (with a shim) that modify `IoCManager`. The Smocks library gives us the ability to shim static method calls.
The entity manager is supposed to delay entity messages of which the entity doesn't exist (presumably because it *might* due to networking).
Problem is that somebody put a .Clear() at the end right after re-filling the queue.
Wasn't me.
You can now "pause" a map. Ideally this would result in the map not doing significant processing until unpaused.
This can be used later to code proper map editor modes that won't have any side effects while being edited.
1. IPv6 support. Woo!
2. NetManager can now explicitly bind to adresses and work with multiple peers. ~~I thought I needed this for IPv6 because I forgot about IPv4-mapped adresses, but the code's written so let's keep it.~~ OpenBSD doesn't support IPv4-mapped IPv6 addresses so effort not wasted.
* Transforms now unparent themselves before being removed.
Fixed crash with removing deleted entities from containers.
* Removed ClickedOnEntityMessage, use the Input System.
* Removed unused types from Physics system.
* Made CollisionEnabled actually work.
Added Collision group system.
CollidableComponent now registers the collidable in Startup instead of OnAdd.
Fixed BoundingBoxComponent namespace.
* Fixes a bug with adding components remotely.
Adds setters to the new ICollidable properties.
* Fixed unit tests.
* Converted everything (I think) to ICollidable.
* Renamed CollisionManager to PhysicsManager.
Removed the bucket system out of the PhysicsManager.
RayCastResults.Distance was changed from PositiveInfinity to 0f when no entity is hit.
* Soft collidables (bullets) work again.
Previously the GameController was in control of starting the EntityManager, and GameScreen responsible for shutting it and MapManager down.
There was no way to restart the Entity Manager.
This commit makes the start/stopping be handled in the connection procedure of BaseClient.
@Acruid please review.
1. Updates all the NuGet packages (except CommandLineParser because they ruined their API)
2. Makes all projects use C# 7.2 explicitly. (not latest)
3. Use some C# 7.2 features like readonly structs and default literals.
* VV Refactor.
Yes I just wrote it and it's already inadequate and filled with legacy code.
Instances and sessions were a terrible idea, they're getting replaced with "traits".
It's not even more modular.
Practical difference: it now supports private members, fields and displaying things implementing IEnumerable.
* Clean up code, fix some bugs. Document everything.
* Fix broken unit tests.
Adds member field to BaseClient to hold onto override name string. Figured that was the closest place to the usage, so why not stick it there.
On connecting to the server, the client will prefer to use that name, if it's set, over the name from the configuration.
Adds client console command to set that field.
Fixes#660
Added unit tests for all MathHelper methods. Very open to test data values, I tried to specifically seek out edge cases, but I'm sure there're some things I've missed. Added tests for ensuring parameter preconditions throw exceptions.
Made some minor chanes to MathHelper.NextPowerOfTwo:
- Made the long, int and float overloads defer to the double overload since the original implementation was using the same thing as the double implementation anyway.
- Modified the precondition checking for negative numbers to check for non-positive numbers since the implementation for 0 shouldn't work since log(0) is undefined.
- Added precondition checks for float and double implementations to check for NaN and +/-Infinity
- Added special case handling for float and double implementations when the input is greater than zero but less than one where the previous implementation would return negative powers of 2 (ie, non-integer results), which I assumed are not intended. Depending on what people think, that same case could be extended to all inputs less than 1, or contrarily all inputs less than 1 could be considered out of range.
I've noticed that Acruid has PR #666 open to move MathHelper, among others, to a different place, so once that's in, I can merge it into this.
Lemme know if I've missed some procedure in the PR process.
Moved SS14.Shared.Math namespace into its own assembly. This allows projects to reference the math library without needing to include the entire Shared assembly.
* Engine culling.
Sandbox is gone.
Anything resembling "content" such as prototypes and textures is gone.
The engine can no longer load up directly
(short of the client's main menu, of course).
* Make tile prototype definitions workable.
Still not great though.
You can now manually specify their insertion order,
so technically tile ID.
* Move more Player things into content.
Spawning of players is now 100% up to content.
IPlayerData is now purely for content.
* Stupid sandbox.
* Sandbox pls go.
* Aaaaaah.
PlayerIndex is dead, it's been replaced by NetSessionId.
NetSessionId is basically just the client username.
Conflicts between usernames are auto resolved by the server,
due to lack of auth server & need for local testing.
dupeip config option is gone, it doesn't understand NAT.
* Migrated click handling from old `ClickParser` to new `InputSystem`. Resolves#631.
* Input Context system added. Resolves#630.
* `PlacementManager` now uses its own input context.
* Added addon `Entrypoint.PostInit` function.
* Moved EntitySystemManager initialization from after the first state update, to right after the EntitySystem init.
* Made the EntitySystems only run Update/FrameUpdate/events after the map has been initialized.
* MapIndices implements IEquatable.
* Add sane Modulo method to MathHelper.
* SnapGrid improvements.
Has an OnMoved-like event now.
GetInDir helper, basically like BYOND get_step.
* Make MapChunk use new standard mod method.
* entfo command improvements.
Can print diagnostic info from components now.
Doesn't list components multiple times.
* Transform implements IComponentDebug
* Move code to Godot 3.0.6.
It changed collections to use its own collection types.
* Helper to turn Directions.
* I forgot to commit csproj for IComponentDebug.
* Improve SpriteComponent.
Add direction offsets for layers.
Handling of directions is better now.
* Added a shared interface for player sessions.
* Mouse Keys are now additionally handled like Keyboard keys.
Added Keybind for inspect.
* Added KeyFunctionId type.
* Keys now get passed through Gamescreen and into InputSystem.
* Remove useless KeyBindDown and KeyBindUp.
* Tried to get serverside input handling working (Spoiler: It does not).
* Stopped trying to make it over complicated, serverside input handling works!
* More cleanup, made InputSystem more symmetrical between client/server.
* Made it *actually* work with the examine system.
A new component, SnapGrid, now tracks the entity position on the actual tile grid.
This can be used to provide (relatively) quick indexing for say smoothwalling, atmos room calculations, etc...
Added a new DebugTools.Assert function to replace the System Assert. The System assert does not work well on mono, and was not gracefully handled by Visual Studio. This version now throws a unique exception when it fails, instead of the popup window. You can setup Visual Studio to break whenever the exception is thrown. The call sites to the new Assert are still removed in release builds, similar to the System version.
This resolves#569 without needing to add a trace listener.
* Remove `LoadParameters`
* Significantly refactor `EntitySerializer` to be better, no longer specific to entities.
* `IExposeData` so sub objects can be deserialized.
* Map format is now standardized & good.
* Entity and grid references inside map files now cross referenced and resolved correctly. Fixes#524
* Prototype data caching to speed up prototype instantiation.
* Switch from storing the components on each entity to a central database inside of ComponentManager.
* Better deferred component remove.
* Turn the IEntity component functions into proxies of the ComponentManager functions.
* Remove Update() base function from Components. If components need to update, an EntitySystem needs to do it.
Resolves#618.
### Purpose
* Merge ServerConsole and ClientConsoleHost shells into one system named ConsoleShell.
* Migrate all server side commands to the new ConsoleShell system.
* Add a PermissionGroup system, for 'ranks' like user/mod/admin/owner.
* Track per-client permission group, allow clients to elevate permission with global 'sudo' password.
* Changed `IWritableDirProvider.Open()` to return a `Stream` instead of a `FileStream` to help test-ability.
Resolves#612.
### Open Questions and Pre-Merge TODOs
- [x] This fix is tested on the same branch it is PR'ed to.
- [x] I correctly commented my code.
- [x] This PR does not include any unnecessary .meta, .prefab or .unity (scene) changes.
- [x] This PR does not bring up any new compile errors.
- [x] This PR has been tested in editor.
- [x] This PR has been tested in multiplayer.
* Added the new writable VFS API. Resolves#566.
* Moved resource interfaces into the new Interfaces.Resource namespace.
* Adds the property `ResourcePath.Directory`.
Removes the obsolete property `IResourceManager.ConfigDirectory`.
* Marked string version of content functions as obsolete.
* Removed unused `System.IO` using statements.
* Removed the System.IO namespace from a bunch of files.
Made the string version of IResourceCache obsolete, and converted everything to use the ResourcePath versions.
This should Resolve#567.
* Fixing some bugs.
* Un-Obsolete the string functions in IResourceCache and IResourceManager.
* Rename SS14.Server/GameState directory.
* Server now runs at 60 FPS.
* RegisterNetMessage<T> more generic!
Also started refactoring game states.
* HOLY SHIT I CAN MOVE AROUND.
* Dirty(); calls and improvements.
* Implement deletions + mark components as dirty initially.
* Remove bsdiff submodule.
* Remove Bsdiff.
* Fix System.ValueTuple reference.
* Server no longer crashes when the gun is used.
* Optimize player sync.
* Prevent constant dirtiness from player input mover.
Debug monitors like coord debug, FPS and the (now re-added)
have been amde into a more centralized system.
Networking debug is back! No chart though.
Bunch of improvements and fixes to the UI code to facilitate this.
* Deactivate special placement mode after placement
Comments
Fix collision checks for placement manager
Remove unnecessary usings
Fix the alignment issues
Wow this commit has literally almost all the work done in it alone
time to test some sketchy shit, commit first
* Fix align similar
* Adds Godot shader support.
* New sprite component with a layer system.
Supports per-layer shaders. Only texture and shader properties are implemented.
More TODO.
* Basic RSI loading.
* Direct textures for layers.
* Implement a scale layer parameter.
* RSI directions work now.
* Animation support.
* Make sprites appear again.
* Fix error message about shaders on the server.
* Implements directional sprite handling & rotation of transforms.
* Remove debug logs from ShaderSourceResource.Load
* Work on a public API & better handling of errors.
* Layer addition API coded but untested.
* Fix init crash.
* Add a client side API for SpriteComponent.
* Remove dead NetIDs.
* Fix bug where sometimes entities start flat on their face.
* Refactor IconComponent.
* Adds rotation property to layers.
* Expose scale and rotation APIs, sprite-global rotation.
* Adds visibility property.
* Netcode work.
* Server side prototype loading done.
* Netcode works.
Also adds a visibility layer option.
Apparently @pjb3005 did almost all the work for this when he changed the system to godot but didn't say anything, adds a property to parse the clicktype on mousebuttoneventargs and passes it in the network message instead
* Sawmills
* They seem to work on the server now, sorta.
* They work.
* More shit that works.
* Shit works yo.
* File logging for the server.
* Adds some debug commands and finishing touches.
* Oh yeah change this default.
* Fix unit tests.
* RSI WiP
* More work but we're doing bsdiff now
* RSI loading seems to mostly work.
* Vector2u deserialization test.
* Add in packages again.
* This is the part where I realize I need a path manipulation library.
* The start of a path class but it's late so I'm going to bed.
* HIGHLY theoretical ResourcePath code.
Partially tested but not really.
* Allow x86 for unit tests I guess jesus christ.
Thanks Microsoft for still not shipping x64 VS in 2018.
* Resource paths work & are tested.
* I missed a doc spot.
* ResourcePaths implemented on the server.
* Client works with resource paths.
TIME FOR A REFACTOR.
* Some work but this might be a stupid idea so I migh throw it in the trash.
* Resources refactored completely.
They now only get the requested resourcepath.
They're in charge of opening files to load.
* RSI Loader WORKS.
* Update AudioResource for new loading support.
* Fix package references.
* Fix more references.
* Gonna work now?
* Unit test improvements.
Adds an ApproxEqualityConstraint and IApproxEquatable<T> for certain tests.
Gives [Parallelizable] to a bunch of tests.
* ParallelScope.All | ParallelScope.Fixtures
Fixes a humorous bug where you click on things that are contained in another thing because the mousedown doesn't check if something is on the map or not
* bsdiff submodule
* All the other stuff
* Upgrade to 0.2 of SS14.Shared.BSdiff
* Use streams. Even faster!
* All rendering refactors should start with the killing of the SFML submodule. Trust me I've done this before!
* And after that comes the removal of the references in the project files!
Of course, neither of these compile. Meh.
* IoC loads, now to port the entire client over.
* More work
* Trying to debug the null exception.
* More messy WiP code
* More WiP
* Transform components now make Node2Ds inside the scene tree.
* Work on the UI system.
* Redo project configurations to work better.
* More work on the Godot GUI binding.
Added BaseButton and Button bindings, including events for them.
More APIs on Controls like GetChild() and alike.
Ability to instance a Godot PackedScene and have it automatically be wrapped by the SS14 GUI wrapper, thus allowing the usage of Godot's GUI editor while maintaining the good C# API.
* Fix incorrect sRGB profile on bootsplash.png
* LineEdit API.
* Maybe commit the csproj too.
* Exit button works now!
* Change MainMenu root to a normal Control.
* Some stuff messing with window popups.
* Fix popup not scaling down again after housing large text.
* Make popup dialog helper.
* Auto wrap controls that spawn others when not instancing.
* Nice typo me.
* Work getting server connections working.
* Server didn't start anymore due to still trying to load removed zip packs.
* Made MainMenu dump UI elements in shutdown.
* We now successfully connect to the server.
* WE Ingame NOW!
* Basic map rendering works now!
* Camera & Input work.
Though I'm not sure whether the input issues are this piss poor laptop or actual bugs.
* Fix input issues.
KeyHeld() was firing KeyUp() into States, which broke everything.
* WiP Debug console.
UI Works, command processing doesn't.
* Remove some debug logs.
* Fixing focusing issues with the Debug Console.
* In which I copy paste in the DebugConsole code.
* More WiP DebugConsole work.
* Use RichTextLabel for DebugConsole.
* Disable DebugConsole test text.
Also disable context menu on the IP Box because of font size issues.
* ITextureSource for texture wrapping.
* Make resource loading not copy every build.
It now loads from repo root. Release builds are TODO.
* Bsdiff 0.3 for fixed targets.
* Fix iCCP sRGB errors.
* Give full texture paths to prototypes.
* Sprite component old API restored. *shudder*
* Finish sprite rendering.
By hitting delete on basically everything.
* Fixing camera delay with this one weird trick!
The input lag was because the camera lagged, not because the input lagged. I didn't have visualization.
* Use greyshirt as temporary human replacement.
* FPS Counter.
* Fix Windows, re-add space tile def.
Windows broke because Mono on Windows can't use System.IO.Compression.
The GZIP streams use by MsgFullState have been moved to
ICSharpCode.SharpZipLib.GZip. Works fine.
Also re-added the space tile def because everything blows up otherwise I
guess.
* Debug colliders works.
* Highly WiP varied Window code.
* Work on the quit button. Doesn't work yet. Needs state overhaul.
* Do a better job of freeing Godot objects correctly.
* Simplify game states.
States are no longer cached. They're GC'd after shut down. Their creation has been simplified too due to IoCManager.InjectDependencies().
This makes returning to main menu work GUI wise.
* Be less aggressive on resource freeing. Only dispose Mono handles now.
* More work getting quit to work.
* Grids get cleared upon disconnect correctly.
* Disable rendering of the filler space tile.
I'll leave a nice parallax background up to content.
* Oops forgot to stage these.
* Fix issues in the csproj file.
* Make controls have own namespace.
* Chatbox GUI, other stuff.
Compiles but doesn't quite work yet.
* Git fuck you
* Chat works.
* Clicking on a not-control removes focus now.
* Fix an exception.
* Update mono. Use enums instead of constants now!
* Fix window dragging
* Fix chat stealing focus from other LineEdits on MacOS I guess.
* Correctly handle client shutdown & server disconnect.
* Fix error spam on client shutdown probably.
* Tiny amount of lighting code to have access to it from other computers
* Lighting works mostly.
* Godot.Texture.Flags -> FlagsEnum
* More WiP lighting code
* Turns out you can't control custom layers with cameras eh.
* WiP lighting almost works
* Lighting WORKS!
* Lobby thing.
* Some options menu work. I'm gonna try something
* Options menu works.
* More improvements.
* In game options menu works.
* Remove a debug log.
* Fix Window Movement and Drag.
* Huh Godot edited these scenes.
* Forgot to commit projects
* It compiles.
* I never claimed that.
* Update sandbox csprojs a bit.
* Makes sandbox load.
Client goes ingame but dies due to broken map manager networking code.
* Fix grids.
* Fix relogging duplicating entities inside Godot.
* Eyes!
* How about removing the TODO entry.
* Auto fetch bsdiffwrap.
* Update TODO.
* Remove TODO list.
* Tilemaps get cleaned on disconnect now.
* Fix bsdiff submodule HOPEFULLY
* Highly WiP and not compiling or working placement.
Yes this is the best way for me to share code between my computers.
* Fix bsdiff with spaces in path names bloody MSBuild + cmd.
* PLACEMENT KINDA WORKS.
NO RENDERING OR TILES YET.
ALSO I NEED TO REBASE THIS.
* Kill EngineContentPack.zip
* Fix map code and remove sprite components from the server.
* Ok entity placement mostly works.
* Grid lines sorta work but SnapgridCenter is still broke.
* Fix Center Grid Rendering.
* Work getting tile spawns to work. Not quite there yet.
* Fix placement and remove tiledef networking.
It werks!
* Remove SolutionSpecific.targets
Didn't end up being needed.
* Kill off wearableanimatedsprite component states.
* Do not put binaries relative to the solution.
* Remove shaders, reorganize prototypes for content.
* Reimplement SpriteComponent color.
* Correctly set __engine_human DrawDepth.
* Round coordinates passed to Godot to pixels to prevent issues.
* Remove some GUI log spam.
* Resource cache now uses the VFS more-proper but still awfully.
* Fix color reading code on SpriteComponent.
See, e94bf4854b106da51c89eeeab9a609be369f9622 did work.
The problem was all the code it NEEDED to work was broken.
* Step one into trying to fix Travis and AppVeyor.
* Auto download GodotSharp on Travis.
* Let's not make dumb mistakes with the cache directories.
* 2018 and requests still isn't in the stdlib.
* This maybe?
* This maybe?
* AppVeyor time.
* How 'bout we don't download sonarqube at all outside master.
* Try to cache on AppVeyor.
* Fix mac builds maybe.
* Finishing up Godot: cleanup.
* Eh this works too for SS14Loader.
* Remove some dead files
* Make Omnisharp not choke on buildchecker.
* Controls for box containers.
* Remove debug port from project.godot.
* Control and drawing improvements.
Controls are now properly capable of overriding Godot virtuals.
Importantly minsize calculations and stuff like HasPoint.
There is now a system for doing direct drawing on controls.
This is done with a DrawingHandle system.
TextureSource has been renamed to Texture.
Also there's a wrapping for Godot's style boxes now.
* Yeah don't insult omnisharp.
* Stylebox fixes and margin API on controls.
* Hey it compiles!
* Fix things.
* Fix null godot texture conversion.
* Fix client transform parenting.
* Fix movement sticking to north.
* Some updates.
* Work on exports.
* Unstubs client/Godot timing code.
It's mostly implemented now.
* Client unit tests work.
Jesus Christ.
* Let's figure out why AppVeyor hates me.
* Does the remie.
* Update GodotSharp download URL.
* Export templates for the builds server.
* Remove mac export icon.
* TO THE BUILDS SERVER.
* Probably implement the effects system in Godot.
* Fix mouse handling everywhere.
* Fix some CollidableComponent exceptions.
* Effects system works + unshaded option for LAZORS.
* Let's not fuck with Angle yet.
* Make file/line numbers show up on Windows Godot.
A bit of a shitty function that somewhat works, get entities in a range that intersects ours but also has a center point within an angular range that we specify
* Moves client entity system to be closer to IoC registration and before gamescreen initialization
* Gives the raycasting system an argument to ignore a particular entity when finding what entity it will intersect
* Adds an arbitrary effects system
By creating a message defining things such as position, spritename, rotation, size, and delta values, you can create a temporary effect on the client. Just create a new message, define all the values upon it, pass it to the serverside effects system to send to the clients.
* Effects csprojs stuff and adding a datatype for priorityqueue from a nuget package
* Modifies nuget to use $solutiondir
* Effectsystemstuff
* Added Data Get/Set functions for use with Properties.
* Able to serialize generic List and Dictionary.
* Can now actually serialize generic lists and Dictionaries.
* Manually set the newline string for StreamWriter so the tests pass in linux/mac.
* Added Unit Tests for GameTiming.
* Added GameLoop class.
* Removed TimeScale.
* Switched server to the new GameLoop.
* Client now uses GameLoop.
* Allowed friend assemblies in release builds, so TravisCI can run tests.
* Ray -> Box intersection works.
* Turret AI finished.
* Turret Works :D
* Light masks can now be rotated.
* Shoddy angle MoveTowards works.
* Shoddy Vector2 MoveTowards works.
* And pretty broken Quaternion version..
* Slept on it, rotation works good enough now.
* Fixed nuget dependencies.
* Moved AimShootLifeProcessor.cs to content.
* Misc cleanup.
* Removed BoundKeyChangeEventArgs.
* Removed event IClickableComponent.OnClick.
* Nothing uses EntityEventArgs now.
* Input messages are now sent through the network as SystemMessages instead of ComponentMessages.
Fixed EntitySystemMessage namespace name colliding with the base class.
Removed some unused code from server.
* Ignored KeyBindingInputComponent in the client prototype system.
Removed useless update code from client InputManager.
* Removed useless CLSComplientAttribute from math structs.
Removed Obsolete functions from math structs.
Minor code cleanup.
* Merged Color into Color4, then renamed Color4 back to Color.
* Moved GameStateManager functions out of BaseServer.
* Moved PlayerManager NetMsgs out of BaseServer.
* Moved MapManager NetMsg out of BaseServer.
* Moved TryLoadAssembly from BaseServer to AssemblyLoader.
* Removed some service locator calls.
* Sealed Entity class.
Removed Entity.Update().
Code cleanup.
* Component.Update() is now obsolete.
* Added skeleton of new Component Message system.
* Converted everything to use new `SendMessage(owner, message)`.
* Removed more of the old system.
* Changes `IEntity.AddComponent(IComponent)` to `IEntity.AddComponent<T>`.
Removes some initialization functions from IEntity.
* Pulled ComponentManager registration out of Component into Entity.
Removed unused OnShutdown events from Entity and Component.
* Converted Component.ReceiveMessage() to Component.HandleMessage().
* Killed component message params.
* Remove EntityNetworkMessage params.
* YAML deserializer is coming along.
Nightly work.
* Should be pretty much working now.
* Converted most of the server components over.
* Entity loading/saving works.
* Grid saving/loading works.
* Cleans up old code.
* Saving and Loading of blueprints works.
* Improved map commands a bit.
* MapLoader fixes grid and map IDs in blueprint.
Can now load blueprints from the VFS.
* Removed Entity.LoadData(YamlMappingNode).
* Updated the nuget 'YamlDotNet' package to 4.3.0.
* Fixed Sandbox entry point.
Unit tests pass again.
* Fixes spawn entity bug
Now transform is called before initialize is, yay.
Call it shitcode but unless there is a better way that I cant find, this is the fix, and if there is please tell me
* Fixes incorrect AABB
* Prevents sprite exceptions
Even though setsprite has a default value that it gets set to, unless you give basesprite a non-null value and call setsprite it will cause the animatedsprite components to have an exception without fail. This happens if you don't include it in the prototype for whatever reason.
* Unnecessary
* Added math types from OpenTK project.
* Removed OpenTK from SS14.Server.
* Removed most references to OpenTK from SS14.Shared.
* Removed OpenTK from SS14.UnitTesting.
* Fixed errors in SS14.Client.Graphics.
* Removed more references.
* Remove OpenK from SS14.Client.
* Fised the last compile errors.
* Deleted opentk config file.
* Changed projects so that Sandbox content is built in its own folder, and then copied to ./Resources/Assemblies.
* Moved SS14.Sandbox.targets to the ./MSBuild/ folder.
* Location Getters 2
Oh my god I didn't even make them part of the interface last time
Fixed a bug with local coordinates not be converted to world coordinates before comparing to other entities world transform
Added some more getter overloads
* Changes entities getters more
Adds a get entities in range for entity and range overload
Changed getentitiesinrange to take into account the bounding boxes of objects instead of their absolute coordinates
* SQUARE
* Added a NetManager.DisconnectChannel so that server/shared can disconnect clients.
Added listplayers command to list all connected session on the server.
Added kick command to forcefully disconnect a connected session.
* Part 2, everything works now.
Changes way content loads instead of using config, attempts content then loads sandbox instead
Fixes some compiler warnings
Adds a field needed for content player mob
* Lidgren removed from Client.
ScreenBlocker control removed.
* Lidgren removed from server.
Lidgren removed from UnitTesting.
Lidgren only referenced in SS14.Shared.Network.
* Removed useless traffic debug printing.
Fix a bug with Keybinds being sent to server.
* NetMessages enum is finally gone :D
* Add warning for receiving NetMsgs without a registered callback.
* Moved some of the RegisterNetMessage calls out of BaseServer.
Added 'netaudit' concmd to list NetMsg callbacks on the server.
* Fixed exceptions, it works now.
LocalCoordinates.IsValidLocation() added.
* Moved all objects out of the SS14.Shared root namespace.
* Remove IoC self-referencing in MapManager.
* Added Circle to the math library.
Made LocalCoordinates equatable.
MapManager refactoring.
Light refactoring.
* Removed LightArea.
* GetEntities* functions now check mapIds.
PlacementManager does not place things in null space.
Prop Edit window "works" again.
* Lightmasks work.
* Adds skeleton Sandbox Content projects to the solution.
* Change BuildChecker output type to Class Library so that Resharper stops complaining about the project not having a Main() function.
* Added basic player event hooks to BaseServer.
Moved Server run level from PlayerManager to BaseServer.
Added concmds to switch between run levels on server.
* Forgot to commit project file.
* Entry points got changed a bit.
* You can now join a game without a map loaded on the server.
* Moved map loading to Content.
* Adds 'tp' command.
* Added 'addmap' command. Client crashes when used.
* Teleporting between maps works.
* Added GridId and MapId types.
Removed Test concmd, it was useless.
Misc formatting/cleanup.
* Tile placement kinda works.
* Added OnPlayerStatusChanged event.
* Server now auto starts the round.
* HandlePlayerStatusChanged works better now.
* Removed PlayerJoined* events from BaseServer, PlayerStatusChanged event does the same thing.
* Changed default platform of Sandbox from AnyCPU to x86.
Added "content.dllprefix" ConVar so that the config file can specify which content dll to load.
Changed LoadContentAssembly name argument to contain the entire name of the dll being searched for.
* SS14.Shared now copies Lidgren to the output directory.
More project configuration changes to remove the AnyCPU nonsense.
* Extracted the logic from DebugConsole into a new ClientConsole class.
* ClientConsole moved to IoC system.
Verb system replaced with concmds.
* Shared Cleanup
* ClientChatConsole skeleton.
* DebugConsole and LobbyChat are now both subscribed to ClientChatConsole.
* Removed server chat commands.
* cleaned up server command sysyem.
* More chat handling, and aliasing.
* Nightly work on Say command.
* Fixes a bug in Maths.Angle.
* Chat channel colors moved to ClientChatConsole.
* Now Server commands are sent without opening DebugConsole.
* Emotes work.
Clientside chat formatting works.
* Fixed angle unit test.
* Added BaseClient.
Moved connecting system into BaseClient.
* Added ConnectFailed event to ClientNetManager.
BaseClient properly handles failed connection attempts.
* Session Rework
* Client now knows about other clients that are connected to the server.
* Reconnecting with the client works now.
* Allow Dupe IP.
* Shared PlayerManager shell.
* More session work.
* TWO PEOPLE CAN ACTUALLY CONNECT.
* Added some event functions to BaseClient.
* Basic multiplayer works again.
* Fixed MsgPlayerList buffer overrun.
* Lobby Updates.
Simplified MsgPlayerList, and cleaned up some networking.
* Cleaned up misc dead code.
Added DocComments to IBaseClient and BaseClient.
* Fixes spelling issues and adds more Doc Comments.
* removed a bunch of vulnerabilities
* removed a bunch of vulnerabilities
* uncommented the code
* reverted .gitignore to its previous state
* fixed the compilation bug
* and again
* Switched to autoproperties everywhere where I could. There are still 3 unsolved vulnerabilities though.
Fixed some defaults not being set.
* Re-added the default value for BlendMode.
* Screen now controls children.
* Input works.
* Transitions work.
* Removed IState.cs.
* More MainMenu.cs cleanup.
* Cleaned up options menu code.
* Simple Image now aligns properly.
* Alignment on the main menu works.
* YOU'RE NOT PERFECT
* Oh Boy ListBoxes.
* Screens actually get laid out properly.
* Big Options.
* Done fixing for tonight.
* More Cleaning!
* More cleanup, documentation and moving things to the base Control class.
* Migrating everything to use parent class properties.
* Lobby menu is looking good!
* More State cleanup.
* Give namespaces proper names.
* More namespace work.
* The chatbox position struggle is finally finished!
* Windows kinda work now.
* Scrollable Container work.
* OH GOD the listbox finally works.
* Ingame MainWindow works.
* Move spawn panels into CustomControls.
* TileSpawnPanel pretty much lays out.
* EntitySpawnWindow layout works.
* DebugConsole shows up, but contents do not display.
* Minor cleanup.
* Scrollbars work.
* Focus system should be working now.
Removed old code.
* Focus system should work as you expect now.
GameScreen now controls KeyBindingManager, so you can block movement keys with the UI.
* Text alignment fixed.
OptionsMenu background fixed.
* Mouseover UI scrolling works again.
Listbox dropdown now shrinks to fit contents.
Minor text alignment issues in Textbox fixed.
* Chatbox input alignment fixed.
* ListPanel is a thing now.
* ChatBox work.
* RichTextPanel now wraps lines.
* RTP cleanup.
* Fixes DebugConsole, Tabs, and Chatbox.
All prototypes inside the engine are now clearly marked and prefixed with `__engine_`. Also renames all prototypes to be snake_case, and added [engine] to their name.
Also, the content repo can now select which prototype to spawn for humans.
* Fix UpdateIsHardCollidable.
Probably should've tested that beforehand.
Also optimized collidable removal extremely to not be O(n), by reworking the way they were stored inside the collision manager.
Seriously why would you use a dictionary as a dumb list of key/value pairs. WHY
* band-aid buggy client code
* better idea
* Apparently I forgot to remove this.
* Fix crash when disconnecting from server.
For some reason the game screen sets all sprites to have a null texture. This caused Sprite's Texture setter to nullref.
* Implement spritebatch.dispose, remove gaussianblur.dispose
* Improves debug mode perf & look
Debug mode no langer tanks FPS by caching the used rectangle and text shapes. The LINQ removal probably helped too.
Sprite AABB debug has been removed since sprite AABBs aren't used anymore.
Implemented text shadowing, which is now used by the debug text to make it more readable.
Implemented collidable debug color from prototypes.
* Remove stray comma.
* WiP of making SFML encapsulate by Client.Graphics.
* Up to like 40 files changed already!
* My hands are writing words.
* More work.
* Render states
* Client Graphics compiles
* More work
* C# compiler might be bugged
* C# compiler might be bugged
* Rust has ruined me
* It works!
* IServerTransformComponent improvements.
IServerTransformComponent now more closely represents the API in TransformComponent, which was lacking because ITransformComponent is client-side, and the client cannot move entities itself, for example.
* Fix compile error
* Refactor and clean up containers.
Containers are no longer arbitrarily bound to a single component, they use string IDs instead.
The API to interact with containers has been documented with doc comments.
Container creation now uses a static method.
Containers are sealed instead of abstract. Custom logic doesn't go on containers.
Theoretically fixed various bugs:
* Makes container manager creation work, previously it'd nullref.
* Containers being deleted now correctly detaches contained entities.
Still needs unit tests before being merged, because this code is still 100% untested.
* Lots of fixes, unit tests.
* Attempt to fix Python on Travis being too old.
* Fix RUN_THIS.py too.
* Fix CI builds blocking.
* Fix BuildChecker.csproj Python versioning in Travis.
* The million error march
This commit replaces many of the vector2's with their appropriate version of either LocalCoordinates, WorldCoordinates, or ScreenCoordinates
* Change transforms to send back worldcoordinates for position instead
* Adds coordinate class file
* What the fuck is going onnnnnn
* What the fuck is goign onnnnnnnnnnnn
* Changes some shit to use multiple maps instead
Fixes the compile errors in shared first
* Compile errors mostly fixed, about to rebase
* Merge branch 'master-wizfederation' into multiplemaps
# Conflicts:
# SS14.Client.Graphics/CluwneLib.cs
# SS14.Client/GameObjects/ClientEntityManager.cs
# SS14.Client/GameObjects/Components/Renderable/AnimatedSpriteComponent.cs
# SS14.Client/GameObjects/Components/Renderable/ItemSpriteComponent.cs
# SS14.Client/GameObjects/Components/Renderable/ParticleSystemComponent.cs
# SS14.Client/GameObjects/Components/Renderable/SpriteComponent.cs
# SS14.Client/GameObjects/Components/Transform/TransformComponent.cs
# SS14.Client/Interfaces/GameObjects/IClickTargetComponent.cs
# SS14.Client/Placement/Modes/AlignSimilar.cs
# SS14.Client/Placement/Modes/AlignSnapgridBorder.cs
# SS14.Client/Placement/Modes/AlignSnapgridCenter.cs
# SS14.Client/Placement/Modes/AlignTileAny.cs
# SS14.Client/Placement/Modes/AlignTileEmpty.cs
# SS14.Client/Placement/Modes/AlignTileNonSolid.cs
# SS14.Client/Placement/Modes/AlignTileSolid.cs
# SS14.Client/Placement/Modes/AlignWall.cs
# SS14.Client/Placement/PlacementManager.cs
# SS14.Server/GameObjects/ServerEntityManager.cs
# SS14.Server/Interfaces/Player/IPlayerManager.cs
# SS14.Server/Player/PlayerManager.cs
* Whops
* Compiles, loads somewhat, lights nonfunctional, many TODOs left
* serializes states, fixes incorrect spawn
* Fix map sending to the client
* Makes things only render on the correct zlevel
* Makes entity manager wait to intiialize shit after the maps arrive
* Fixes placement net messages
* Improves some of the placement managers, others need a bit of testing and tidying up again
* Transform fix
* Polishing, make coordinates into structs
* Remove resolved comments
* Last commit before master merge
* Fix the rest of the conflicts
* Fixes super spooky bug
* Fixes cross zlevel collisions
* Fix the rendering system to render the tile system regardless of grid location
* Fixed AnimatedSpriteComponent clicking, SpriteComponent is still bugged.
* Added Box2.Scale helper function.
Cleaned up the WasClicked function in AnimatedSpriteComponent.
* Renamed AABB to LocalAABB in ISpriteComponent and IRenderableComponent, so it is clearer what the property contains.
Fixed more bugs in AnimatedSpriteComponent.WasClicked(), and added exceptions.
* Fixed SpriteComponent.WasClicked().
Fixed unrelated bug in EntityManager, so entities can be properly deleted again.
* Fixed issue with sprite sorting using TextRect instead of LocalAABB.
* * CluwneLib.cs: Make _window a local variable
* BaseCollection.cs: Formatting issue
* BaseServer.cs: Removed unused parameter
* ChatManager.cs: Made public encapsulated fields
* BoundKeyEventArgs.cs: Public encapsulated parameters
* CVarFlags.cs: Explicit variable setting
* ComponentFactory.cs: unused variable
* * CluwneLib.cs: Make _window a local variable
* BaseCollection.cs: Formatting issue
* BaseServer.cs: Removed unused parameter
* ChatManager.cs: Made public encapsulated fields
* BoundKeyEventArgs.cs: Public encapsulated parameters
* CVarFlags.cs: Explicit variable setting
* ComponentFactory.cs: unused variable
* CVar fixes
* Edited the OSX error message to be a little more helpful. (You have to edit the .dylibs because they come broken).
* Fixing the sprite movement problem
* Reverted error message
* Revert Again
* Changed Cluwnelib.TileSize name to CluwneLib.PixelsPerMeter. I think its more descriptive of what the name is.
Removed the splash screen debug #ifdef's, and replaced with proper ConditionalAttributes.
* Window encapsulated.
* Add the RELEASE compilation symbol to Release builds of all SS14 projects.
* More CluwneLib cleanup.
* Fixes Bounding/Clicking Bugs
This fixes a number of bugs with the clicking system.
- Wearable animated components were fixed so that they properly report their AABB
- Wearable animated components were fixed so that they properly use their nonwornsprite or wornsprite for checkclicking
- Fixes the clicking system only choosing the player character
- Fixes the eraser only working within a 1.5 tile range
* Uses FloatMath.CloseTo()
* Creates a Snap Checking System
Creates a system that attempts to sanitize placement of objects when attempting to spawn them on snapping grids. This checks whether an object is trying to spawn specifically on a snap grid, and if it is checks against a snapflag of the type to see if other exclusive snappable objects are on that snap grid point.
Separates the spawnentityat into tryspawnentityat which checks for snappables, and forcespawnentityat which completely ignores that.
* Fixes the yaml placement
Fixes exemption from tryspawnentityat which didn't use the bool
Snap placement managers show when canspawnat is preventing them from spawning
* Improve snap placement managers again
Fix using prototype.name instead of prototype.ID
* Nope nope
* I need to unify these two types after the next refactor
* Move to strings for snap flags.
* Check
* 「s h i t c o d e」
* Gracias appveyor now I have seen the light
* Uses FloatMath.CloseTo() to check float equality
* "./Resources/" folder is now mounted instead of "./" in the ResourceManager.
Prototypes now use the ResourceManager.
Added FindFiles(string path) to recursively find files in the ResourceManager.
General FileHelper bug fixing and cleanup.
* Ran SS14.Shared/ContentPack* through the code cleanup again.
* Put PJB's comma back in.
* Makes walls into entities
* Fix the align tile empty placement mode, holy shit collision bounds is fucked
* Make shadowcasting from walls work again
* Fix lights on tiles
* Creates a helper function for making tile indices into tile refs, and a function to get a tileref one step in any particular direction of another tileref.
* Gottem
* k
* Remove some IComponent type bounds, component shutdown event.
Methods like GetComponent<T> don't require T to implement IComponent anymore.
Added an event to IComponent that is invoked whenever the component is shut down.
* Always at least compile your stuff kids.
* Remove SFML binaries in repo.
* Add SFML.NET submodule from our fork.
* Get build checker for submodule handling.
* Fix project references. Remove SFML from non-client.
* Make it work!
* Automatically fetch Windows CSFML natives.
* Fix project file now I'm done debugging.
* Fix project references.
* Fix CI
* Now if only I didn't typo...
* Fix Travis too
* Fix lighting.
* Move shaders over to new API.
* Fix some obsoletions.
* Improve SetUniformArray casts
2017-08-19 10:28:39 +02:00
2350 changed files with 188485 additions and 77107 deletions
<preclass="cl"> <spanclass="cb1">// Create a response and write some example data to it</span></pre>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<styletype="text/css">
body
{
font-family:Verdana,Geneva,Arial,sans-serif;
font-size:small;
margin-left:20px;
background-color:#dddddd;
}
td
{
font-family:Verdana,Geneva,Arial,sans-serif;
font-size:small;
}
.cf
{
font-family:CourierNew;
font-size:10pt;
color:black;
background:white;
padding:16px;
border:1pxsolidblack;
}
.cl
{
margin:0px;
}
.cb1
{
color:green;
}
.cb2
{
color:#2b91af;
}
.cb3
{
color:blue;
}
.cb4
{
color:#a31515;
}
</style>
<title>Lidgren tutorial</title>
</head>
<body>
<table>
<tr>
<tdwidth="700">
<h1>Simulating bad network conditions</h1>
<p>
On the internet, your packets are likely to run in to all kinds of trouble. They will be delayed and lost and they might even arrive multiple times at the destination. Lidgren has a few option to simulate how your application or game will react when this happens.<br/>
They are all configured using the NetPeerConfiguration class - these properties exists:</p>
<p>
<divclass="cf">
<table>
<tr>
<tdvalign="top">
<b>SimulatedLoss</b>
</td>
<td>
</td>
<tdvalign="top">
This is a float which simulates lost packets. A value of 0 will disable this feature, a value of 0.5f will make half of your sent packets disappear, chosen randomly. Note that packets may contain several messages - this is the amount of packets lost.
</td>
</tr>
<tr>
<tdcolspan="3">
</td>
</tr>
<tr>
<tdvalign="top">
<b>SimulatedDuplicatesChance</b>
</td>
<td>
</td>
<tdvalign="top">
This is a float which determines the chance that a packet will be duplicated at the destination. 0 means no packets will be duplicated, 0.5f means that on average, every other packet will be duplicated.
</td>
</tr>
<tr>
<tdcolspan="3">
</td>
</tr>
<tr>
<tdvalign="top">
<b>SimulatedMinimumLatency</b><br/>
<b>SimulatedRandomLatency</b>
</td>
<td>
</td>
<tdvalign="top">
These two properties control simulating delay of packets in seconds (not milliseconds, use 0.05 for 50 ms of lag). They work on top of the actual network delay and the total delay will be:<br/>
Actual one way latency + SimulatedMinimumLatency + [Randomly per packet 0 to SimulatedRandomLatency seconds]
</td>
</tr>
</table>
</div>
<p>It's recommended to assume symmetric condtions and configure server and client with the same simulation settings.</p>
<p>Simulating bad network conditions only works in DEBUG builds.</p>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<styletype="text/css">
body
{
font-family:Verdana,Geneva,Arial,sans-serif;
font-size:small;
margin-left:20px;
background-color:#dddddd;
}
td
{
font-family:Verdana,Geneva,Arial,sans-serif;
font-size:small;
}
.cf
{
font-family:CourierNew;
font-size:10pt;
color:black;
background:white;
padding:16px;
border:1pxsolidblack;
}
.cl
{
margin:0px;
}
.cb1
{
color:green;
}
.cb2
{
color:#2b91af;
}
.cb3
{
color:blue;
}
.cb4
{
color:#a31515;
}
</style>
<title>Lidgren basics tutorial</title>
</head>
<body>
<table>
<tr>
<tdwidth="700">
<h1>
Lidgren basics</h1>
<p>
Lidgren network library is all about messages. There are two types of messages:</p>
<li>Library messages telling you things like a peer has connected or diagnostics messages (warnings, errors) when unexpected things happen.</li>
<li>Data messages which is data sent from a remote (connected or unconnected) peer.</li>
<p>
The base class for establishing connections, receiving and sending message are the NetPeer class. Using it you can make a peer-to-peer network, but if you are creating a server/client topology there are special classes called NetServer and NetClient. They inherit NetPeer but sets some defaults and includes some helper methods/properties.</p>
<preclass="cl"><spanclass="cb2">NetServer</span> server = <spanclass="cb3">new</span><spanclass="cb2">NetServer</span>(config);</pre>
<preclass="cl">server.Start();</pre>
</div>
<p>
The code above first creates a configuration. It has lots of properties you can change, but the default values should be pretty good for most applications. The string you provide in the constructor (MyExampleName) is an identifier to distinquish it from other applications using the lidgren library. Just make sure you use the same string in both server and client - or you will be unable to communicate between them.</p>
<p>
Secondly we've set the local port the server should listen to. This is the port number we tell the client(s) what port number to connect to. The local port can be set for a client too, but it's not needed and not recommended.</p>
<p>
Thirdly we create our server object and fourth we Start() it. Starting the server will create a new network thread and bind to a socket and start listening for connections.</p>
<p>
Early on we spoke about messages; now is the time to start receiving and sending some. Here's a code snippet for receiving messages:</p>
So, lets dissect the above code. First we declare a NetIncomingMessage, which is the type of incoming messages. Then we read a message and handles it, looping back as long as there are messages to fetch. For each message we find, we switch on sometime called MessageType - it's a description what the message contains. In this code example we only catch messages of type VerboseDebugMessage, DebugMessage, WarningMessage and ErrorMessage. All those four types are emitted by the library to inform about various events. They all contains a single string, so we use the method ReadString() to extract a copy of that string and print it in the console.</p>
<p>
Reading data will increment the internal message pointer so you can read subsequent data using the Read*() methods.</p>
<p>
For all other message type we just print that it's currently unhandled.</p>
<p>
Finally, we recycle the message after we're done with it - this will enable the library to reuse the object and create less garbage.</p>
The above code first creates a new message, or uses a recycled message, which is why it's not possible to just create a message using new(). It then writes a string ("Hello") and an integer (System.Int32, 4 bytes in size) to the message.</p>
<p>
Then the message is sent using the SendMessage() method. The first argument is the message to send, the second argument is the recipient connection - which we'll not go into detail about just yet - and the third argument are HOW to deliver the message, or rather how to behave if network conditions are bad and a packet gets lost, duplicated or reordered.</p>
<p>
There are five delivery methods available:</p>
<divclass="cf">
<table>
<tr>
<tdvalign="top">
<b>Unreliable</b>
</td>
<td>
</td>
<tdvalign="top">
This is just UDP. Messages can be lost, received more than once and messages sent after other messages may be received before them.
</td>
</tr>
<tr>
<tdcolspan="3">
</td>
</tr>
<tr>
<tdvalign="top">
<b>UnreliableSequenced</b>
</td>
<td>
</td>
<tdvalign="top">
Using this delivery method messages can still be lost; but you're protected against duplicated messages and if a message arrives late; that is, if a message sent after this one has already been received - it will be dropped. This means you will never receive "older" data than what you already have received.
</td>
</tr>
<tr>
<tdcolspan="3">
</td>
</tr>
<tr>
<tdvalign="top">
<b>ReliableUnordered</b>
</td>
<td>
</td>
<tdvalign="top">
This delivery method ensures that every message sent will be received eventually. It does not however guarantee what order they will be received; late messages may be delivered before older ones.
</td>
</tr>
<tr>
<tdcolspan="3">
</td>
</tr>
<tr>
<tdvalign="top">
<b>ReliableSequenced</b>
</td>
<td>
</td>
<tdvalign="top">
This delivery method is similar to UnreliableSequenced; except that is guarantees that SOME messages will be received - if you only send one message - it will be received. If you sent two messages quickly, and they get reordered in transit, only the newest message will be received - but at least ONE of them will be received guaranteed.
</td>
</tr>
<tr>
<tdcolspan="3">
</td>
</tr>
<tr>
<tdvalign="top"><b>ReliableOrdered</b></td>
<td> </td>
<tdvalign="top">
This delivery method guarantees that messages will always be received in the exact order they were sent.
</td>
</tr>
</table>
</div>
<p>
Here's how to read and decode the message above:</p>
/// Gets or sets the length of the used portion of the buffer in bytes
/// </summary>
publicintLengthBytes
{
get{return((m_bitLength+7)>>3);}
set
{
m_bitLength=value*8;
InternalEnsureBufferSize(m_bitLength);
}
}
/// <summary>
/// Gets or sets the length of the used portion of the buffer in bits
/// </summary>
publicintLengthBits
{
get{returnm_bitLength;}
set
{
m_bitLength=value;
InternalEnsureBufferSize(m_bitLength);
}
}
/// <summary>
/// Gets or sets the read position in the buffer, in bits (not bytes)
/// </summary>
publiclongPosition
{
get{return(long)m_readPosition;}
set{m_readPosition=(int)value;}
}
/// <summary>
/// Gets the position in the buffer in bytes; note that the bits of the first returned byte may already have been read - check the Position property to make sure.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
usingSystem;
usingSystem.Net;
namespaceLidgren.Network
{
/// <summary>
/// Specialized version of NetPeer used for a "client" connection. It does not accept any incoming connections and maintains a ServerConnection property
/// </summary>
publicclassNetClient:NetPeer
{
/// <summary>
/// Gets the connection to the server, if any
/// </summary>
publicNetConnectionServerConnection
{
get
{
NetConnectionretval=null;
if(m_connections.Count>0)
{
try
{
retval=m_connections[0];
}
catch
{
// preempted!
returnnull;
}
}
returnretval;
}
}
/// <summary>
/// Gets the connection status of the server connection (or NetConnectionStatus.Disconnected if no connection)
/// </summary>
publicNetConnectionStatusConnectionStatus
{
get
{
varconn=ServerConnection;
if(conn==null)
returnNetConnectionStatus.Disconnected;
returnconn.Status;
}
}
/// <summary>
/// NetClient constructor
/// </summary>
/// <param name="config"></param>
publicNetClient(NetPeerConfigurationconfig)
:base(config)
{
config.AcceptIncomingConnections=false;
}
/// <summary>
/// Connect to a remote server
/// </summary>
/// <param name="remoteEndPoint">The remote endpoint to connect to</param>
/// <param name="hailMessage">The hail message to pass</param>
/// <returns>server connection, or null if already connected</returns>
m_peer.LogVerbose("Updated average roundtrip time to "+NetTime.ToReadable(m_averageRoundtripTime)+", remote time to "+(now+m_remoteTimeOffset)+" (ie. diff "+m_remoteTimeOffset+")");
}
// update resend delay for all channels
floatresendDelay=GetResendDelay();
foreach(varchaninm_sendChannels)
{
varrchan=chanasNetReliableSenderChannel;
if(rchan!=null)
rchan.m_resendDelay=resendDelay;
}
// notify the application that average rtt changed
/// Gets or sets the read position in the buffer, in bits (not bytes)
/// </summary>
publiclongPosition
{
get{return(long)m_readPosition;}
set{m_readPosition=(int)value;}
}
/// <summary>
/// Gets the position in the buffer in bytes; note that the bits of the first returned byte may already have been read - check the Position property to make sure.
thrownewNetException("Unconnected messages too long! Must be shorter than NetConfiguration.MaximumTransmissionUnit (currently "+m_configuration.MaximumTransmissionUnit+")");
thrownewNetException("Unconnected messages too long! Must be shorter than NetConfiguration.MaximumTransmissionUnit (currently "+m_configuration.MaximumTransmissionUnit+")");
thrownewNetException("Unconnected messages too long! Must be shorter than NetConfiguration.MaximumTransmissionUnit (currently "+m_configuration.MaximumTransmissionUnit+")");
/// Gets or sets the name of the library network thread. Cannot be changed once NetPeer is initialized.
/// </summary>
publicstringNetworkThreadName
{
get{returnm_networkThreadName;}
set
{
if(m_isLocked)
thrownewNetException("NetworkThreadName may not be set after the NetPeer which uses the configuration has been started");
m_networkThreadName=value;
}
}
/// <summary>
/// Gets or sets the maximum amount of connections this peer can hold. Cannot be changed once NetPeer is initialized.
/// </summary>
publicintMaximumConnections
{
get{returnm_maximumConnections;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
m_maximumConnections=value;
}
}
/// <summary>
/// Gets or sets the maximum amount of bytes to send in a single packet, excluding ip, udp and lidgren headers. Cannot be changed once NetPeer is initialized.
/// </summary>
publicintMaximumTransmissionUnit
{
get{returnm_maximumTransmissionUnit;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
if(value<1||value>=((ushort.MaxValue+1)/8))
thrownewNetException("MaximumTransmissionUnit must be between 1 and "+(((ushort.MaxValue+1)/8)-1)+" bytes");
m_maximumTransmissionUnit=value;
}
}
/// <summary>
/// Gets or sets the default capacity in bytes when NetPeer.CreateMessage() is called without argument
/// </summary>
publicintDefaultOutgoingMessageCapacity
{
get{returnm_defaultOutgoingMessageCapacity;}
set{m_defaultOutgoingMessageCapacity=value;}
}
/// <summary>
/// Gets or sets the time between latency calculating pings
/// </summary>
publicfloatPingInterval
{
get{returnm_pingInterval;}
set{m_pingInterval=value;}
}
/// <summary>
/// Gets or sets if the library should recycling messages to avoid excessive garbage collection. Cannot be changed once NetPeer is initialized.
/// </summary>
publicboolUseMessageRecycling
{
get{returnm_useMessageRecycling;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
m_useMessageRecycling=value;
}
}
/// <summary>
/// Gets or sets the number of seconds timeout will be postponed on a successful ping/pong
/// </summary>
publicfloatConnectionTimeout
{
get{returnm_connectionTimeout;}
set
{
if(value<m_pingInterval)
thrownewNetException("Connection timeout cannot be lower than ping interval!");
m_connectionTimeout=value;
}
}
/// <summary>
/// Enables UPnP support; enabling port forwarding and getting external ip
/// </summary>
publicboolEnableUPnP
{
get{returnm_enableUPnP;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
m_enableUPnP=value;
}
}
/// <summary>
/// Enables or disables automatic flushing of the send queue. If disabled, you must manully call NetPeer.FlushSendQueue() to flush sent messages to network.
/// </summary>
publicboolAutoFlushSendQueue
{
get{returnm_autoFlushSendQueue;}
set{m_autoFlushSendQueue=value;}
}
/// <summary>
/// Gets or sets the local ip address to bind to. Defaults to IPAddress.Any. Cannot be changed once NetPeer is initialized.
/// </summary>
publicIPAddressLocalAddress
{
get{returnm_localAddress;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
m_localAddress=value;
}
}
/// <summary>
/// Gets or sets the local broadcast address to use when broadcasting
/// </summary>
publicIPAddressBroadcastAddress
{
get{returnm_broadcastAddress;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
m_broadcastAddress=value;
}
}
/// <summary>
/// Gets or sets the local port to bind to. Defaults to 0. Cannot be changed once NetPeer is initialized.
/// </summary>
publicintPort
{
get{returnm_port;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
m_port=value;
}
}
/// <summary>
/// Gets or sets the size in bytes of the receiving buffer. Defaults to 131071 bytes. Cannot be changed once NetPeer is initialized.
/// </summary>
publicintReceiveBufferSize
{
get{returnm_receiveBufferSize;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
m_receiveBufferSize=value;
}
}
/// <summary>
/// Gets or sets the size in bytes of the sending buffer. Defaults to 131071 bytes. Cannot be changed once NetPeer is initialized.
/// </summary>
publicintSendBufferSize
{
get{returnm_sendBufferSize;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
m_sendBufferSize=value;
}
}
/// <summary>
/// Gets or sets if the NetPeer should accept incoming connections. This is automatically set to true in NetServer and false in NetClient.
/// </summary>
publicboolAcceptIncomingConnections
{
get{returnm_acceptIncomingConnections;}
set{m_acceptIncomingConnections=value;}
}
/// <summary>
/// Gets or sets the number of seconds between handshake attempts
/// </summary>
publicfloatResendHandshakeInterval
{
get{returnm_resendHandshakeInterval;}
set{m_resendHandshakeInterval=value;}
}
/// <summary>
/// Gets or sets the maximum number of handshake attempts before failing to connect
/// </summary>
publicintMaximumHandshakeAttempts
{
get{returnm_maximumHandshakeAttempts;}
set
{
if(value<1)
thrownewNetException("MaximumHandshakeAttempts must be at least 1");
m_maximumHandshakeAttempts=value;
}
}
/// <summary>
/// Gets or sets if the NetPeer should send large messages to try to expand the maximum transmission unit size
/// </summary>
publicboolAutoExpandMTU
{
get{returnm_autoExpandMTU;}
set
{
if(m_isLocked)
thrownewNetException(c_isLockedMessage);
m_autoExpandMTU=value;
}
}
/// <summary>
/// Gets or sets how often to send large messages to expand MTU if AutoExpandMTU is enabled
/// </summary>
publicfloatExpandMTUFrequency
{
get{returnm_expandMTUFrequency;}
set{m_expandMTUFrequency=value;}
}
/// <summary>
/// Gets or sets the number of failed expand mtu attempts to perform before setting final MTU
/// </summary>
publicintExpandMTUFailAttempts
{
get{returnm_expandMTUFailAttempts;}
set{m_expandMTUFailAttempts=value;}
}
#ifDEBUG
/// <summary>
/// Gets or sets the simulated amount of sent packets lost from 0.0f to 1.0f
/// </summary>
publicfloatSimulatedLoss
{
get{returnm_loss;}
set{m_loss=value;}
}
/// <summary>
/// Gets or sets the minimum simulated amount of one way latency for sent packets in seconds
/// </summary>
publicfloatSimulatedMinimumLatency
{
get{returnm_minimumOneWayLatency;}
set{m_minimumOneWayLatency=value;}
}
/// <summary>
/// Gets or sets the simulated added random amount of one way latency for sent packets in seconds
/// </summary>
publicfloatSimulatedRandomLatency
{
get{returnm_randomOneWayLatency;}
set{m_randomOneWayLatency=value;}
}
/// <summary>
/// Gets the average simulated one way latency in seconds
thrownewNetException("m_storedMessages["+storeIndex+"].Message is null; sent "+m_storedMessages[storeIndex].NumSent+" times, last time "+(NetTime.Now-m_storedMessages[storeIndex].LastSent)+" seconds ago");
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.