262 Commits

Author SHA1 Message Date
ca2014802a
Resolved a random deadlock that became way too frequent to ignore
There was a deadlock that sometimes occurred when passing PacketSetBlock
to client: PacketSetBlock first acquired monitor of the chunk it
modified, than attempted to lock the visible chunks set. In parallel, a
chunk update first acquires the visible chunks, than the individual
chunk. Turns out, markForUpdate() doesn't need to be synchronized, so
PacketSetBlock can now acquire the locks sequentially, avoiding the
deadlock.
2021-08-18 09:30:29 +03:00
539a61e854
Almost resolved feature generation issue, removed dead code
- SurfaceFeatures that change neighboring chunks no longer suffer from
tearing if world saving is enabled
  - World saving is still disabled by default
    - wontfix until we get a new, more optimized world IO system
  - See GitHub issue #13 for details
- Removed WorldAccessor getter from Server. This is an implementation
detail.
- Removed SurfaceWorld, SurfaceFeature.Request (see previous commit)
2021-08-18 00:26:45 +03:00
a3760d7425
Removed erroneous RelFace resolution by WorldAccessor 2021-08-17 19:21:57 +03:00
d33b48578d
Added SurfaceContexts to replace SurfaceWorld+Request. WIP
There is a problem with features when up != POS_Z
2021-08-17 16:05:44 +03:00
a6fd81ba1e
Contexts now only accept RelFace; fixed tile placement crash 2021-08-16 13:05:57 +03:00
82872c7cf3
Fixed RotatingServerContext
- RotatingServerContext now rotates coordinates, too
- Fixed a bug caused by the implementation of push methods by
TransformingServerContext
- Fixed unbounded recursion in WorldGenericRO.hasTile(Vec3i, BlockFace,
int)
2021-08-15 23:54:25 +03:00
54c66d28d6
Added TransformingServerContext and RotatingServerContext. WIP
There is a problem with faces in contexts when up != POS_Z, world
crashes soon after startup

- Added TransformingServerContext - a common basis for context wrappers
that alter the coordinate space
- Added RotatingServerContext - a context wrapper that rotates the
coordinate space
  - Used to ensure positive Z is up
- PacketAffectTile now checks the provided tile tag for validity
  - This causes a crash when the invalid action is requested, not
executed
- TickChunk task reuses contexts
2021-08-13 16:11:46 +03:00
78a1c25554
Grass tiles have regained the ability to disappear under blocks
- Test:Grass now (again) randomly disappears under opaque blocks
- Fixed a truly egregious bug in AbstractContextRO.pop()
- Fixed BlockContext.pushRelative(AbsRelation)
- Some changes in toString methods in contexts
2021-08-11 13:45:47 +03:00
a03c783fc9
Fixing bugs introduced in previous commit
- Fixed AbstractContextRO.isSubcontexting()
- Fixed push(...) overrides in FilterServerContext
- Fixed DefaultChunkLogic.tmp_generateTickLists()
- Debug screen now also lists visible and loaded chunks
- AbstractContextRO.Frame now has a toString()
2021-08-11 13:02:18 +03:00
0a45613e45
Began work on integrating the new Contexts. Compiles but does not work
- All TickContexts including TickContextMutable are deleted
- Previous occurrences of TickContexts are replaced by appropriate
ServerContexts
- Added Context.popAndReturn methods for convenience

Current known problems:
- World does not generate properly on startup
- No bulk methods in the new API (the likes of forEachTile, etc.)
- AbsFace/RelFace ambiguity in the new API (see
TestTileLogicGrass.java:68)
- TestTileLogicGrass.java:53 is disabled for some reason
2021-08-09 20:32:15 +03:00
5fb4c601ff
Added ReportingServerContext
- Added ReportingServerContext to listen for write events in contexts
- Fixed method WorldGenericContextWO.setBlock(Vec3i, B)
2021-08-08 14:07:07 +03:00
020802a89c
Added FilterServerContext and DefaultServerContextLogic
- Added DefaultServerContextLogic
  - A standard implementation of ServerTileContext.Logic that delegates
all methods to a ServerTileContext instance
  - Now used by DefaultServerContextImpl
- Added FilterServerContext
  - A base for creating context wrappers
2021-08-08 12:19:31 +03:00
0f909039fe
Renamed ReusableServerContext to DefaultServerContext 2021-08-06 11:02:43 +03:00
15f741bc04
Added subcontexting. Context#subcontexting. 2021-08-06 10:49:40 +03:00
80541eafc3
Renamed BlockFace contexts into TileStack contexts 2021-08-05 19:39:39 +03:00
0f60d45ffa
Contexts no longer expose to World, Chunks, TileStacks or TileReferences
The intention is to bottleneck all read queries and write requests
through context objects without the need to create practically useless
Chunk, TileStack and TileRef wrappers.

- WorldGenericContext{RO,WO} no longer extend WorldGeneric{RO,WO}
- Added tag access for tiles to contexts
- Documented almost all context methods
- Renamed isBlockLoaded() to isLocationLoaded()
- I found some inner peace
2021-08-05 16:42:21 +03:00
fbc803d6e2
Laid some groundwork for context implementation; rewrite incoming
- ReusableServerContext will be the default context implementation. It
is sort of implemented, but not really
- WorldLogic{,RO} now declare getData() method
- WorldGenericContextWO.removeEntity(EntityGeneric) received a default
implementation
- TileDataContext.getTag() received a default implementation
2021-08-04 18:42:16 +03:00
1ee9a55d19 Defined Data and Server context interfaces
Server read-write (not RO) interfaces do not extend the complimentary
*GenericContextWO interfaces by design. It makes no sense to set a
BlockLogic, but it makes plenty of sense to refer to a ChunkData rather
than a ChunkDataRO.
2021-07-31 20:47:23 +03:00
a338a00f1d
A change to the class hierarchy of WorldLogic similar to prev commit
- Renamed ChunkLogic -> DefaultChunkLogic, WorldLogic ->
DefaultWorldLogic
- Created/rewritten TileLogicReference{,RO}, TileLogicStack{,RO},
ChunkLogic{,RO}
- Drafted up something for ServerWorldContext & friends, WIP

(see commit 9a32660 for more details)
2021-07-31 16:01:25 +03:00
9a326603cd Still working on Contexts. Introduced a billion interfaces. WIP.
*takes a deep breath
- Renamed Generic world structure interfaces to the following scheme:

      {Block,Tile,Chunk,World}Generic{,Stack,Reference}{RO,WO}
      (e.g. GenericWritableChunk -> ChunkGenericWO)

    - RO is Read Only, WO is Write Only
- Generic writable interfaces no longer extend their read-only
counterparts (thus Write Only)
- TileGenericStack{RO,WO} are now interfaces; AbstractList is only
introduced by final implementations
- TileGenericReferenceRO now has a WO counterpart
- Fixed compilation issues with the previous commit
- Declared some additional functionality for Generic interfaces
- Old ChunkData and WorldData renamed to DefaultChunkData and
DefaultWorldData
  - Now considered to be an implementation detail; references will be
minimized
- Introduced TileDataStack{,RO}, TileDataReference{,RO}, ChunkData{,RO},
WorldData{,RO} interfaces
  - Suffix -RO indicates Read Only, no suffix means read-write
  - To be used in place of DefaultChunk and DefaultWorld
  - Designed to support wrappers and "fake" implementations
  - May need some refinement (fix return/parameter types, ...)
- Surface world generator is now implemented poorly (WIP)
- Should compile. May work fine. Unless Java inheritance rules have
screwed me over.
2021-07-23 22:46:49 +03:00
d7afe39f00
Added more generic Contexts. WIP. 2021-07-15 22:26:20 +03:00
0264e512ab
Merge branch 'master' into addPlanet
Conflicts:
	src/main/java/ru/windcorp/progressia/test/LayerTestGUI.java
	src/main/java/ru/windcorp/progressia/test/TestPlayerControls.java
2021-07-12 16:20:15 +03:00
e47fb3c4bd
Added surface features. Tree generation is currently broken!
- Added SurfaceFeature
  - Used to generate chunk features
- Added SurfaceTopLayerFeature
  - A superclass for features that are only concerned with editing the
surface
- Added grass, temporary bushes and temporary trees
  - Bushes and trees do not generate properly due to bugs
  - Added Test:TemporaryLeaves
- Added SurfaceWorld (a GenericWritableWorld wrapper)
- Added some unit tests for rotation utilities
- Fixed a whole lot of bugs
2021-07-07 17:37:08 +03:00
eace6733ce
Added Menus and cursor visibility management
- Layers now have a CursorPolicy
  - Used to enable/disable cursor based on top layer
- Added a default menu layer implementation
2021-06-28 17:45:49 +03:00
085f602427
Panel now has decorations; functionality moved to new superclass Group 2021-06-25 17:33:46 +03:00
opfromthestart
737b495fc4
Ported GUI improvements from opfromthestart/Progressia
These changes were originally implemented by opfromthestart. OLEGSHA
then patched a whole bunch of stuff

- Components can now be disabled
- Added BasicButton
- Added Button, Checkbox and RadioButton (with RadioButtonGroup)
- Added some new colors to Colors
- Pressing Esc in game pops up a menu (WIP)
- Fixed text z-ordering
- Fixed LayoutGrid Y-direction
2021-06-25 14:35:36 +03:00
531a8c99c3
Added CONTRIBUTING.md. Discussion is welcome. 2021-04-27 23:22:48 +03:00
6fb7e7fc04
Added SurfaceWorld to facilitate surface feature generation 2021-04-13 15:18:15 +03:00
20dccf3d12
Some more refactoring of generic world-related classes. May not compile.
- Added GenericWritableWorld
- Moved static methods from GenericChunk to GenericChunks
- GenericEntity now declares getEntityId()
- GenericWorld now declares getEntity(long)
- Added a lambda-based mapToFaces variations for AbsFace and RelFace
2021-04-09 23:16:08 +03:00
32851b8fb0
Added a serverside uptime tick counter 2021-04-09 20:34:47 +03:00
a95bdf1efe
Moved .setBlockRel(...) implementation to GenericWritableChunk 2021-04-09 20:15:07 +03:00
e0a03cad1d
More refactoring of GenericChunk and pals
- Genericized TileReference
- Unified template arguments
2021-04-06 00:36:38 +03:00
2532e80f6a
Moved some methods from ChunkData to GenericChunk
- Moved some method definitions from ChunkData to GenericChunk
- Moved some method definitions from ChunkData to GenericWritableChunk
- Refactored GenericChunk including changing some method signatures
- Added some documentation for GenericChunk
2021-04-05 17:30:37 +03:00
3c3f3816df
Fixed a generation issue and refactored some code around WorldGenerators
- ChunkRequestDaemon now attempts to generate requested loaded non-ready
chunks upon discovery
- The server is now only specified once for WorldGenerator
- WorldLogic now actively checks the generation contract
2021-04-02 21:51:52 +03:00
2d3d250f92
Renamed Scatter to Feature and added a generation feature interface
- Renamed SurfaceScatterGenerator to SurfaceFeatureGenerator
- Renamed PlanetScatterGenerator to PlanetFeatureGenerator
- Added a very basic interface for adding generation features
- Removed debug leftovers from PlayerManager and VisionManager
2021-04-02 21:29:09 +03:00
c49fdfa5ff
Added a crude music player and fixed a lot of OpenAL stuff
- Game will now play all Vorbis files in music/ directory (at runtime)
  - Random order with random pauses (15 to 60 sec)
  - Force start by pressing M
- Added AudioRegistry for performance
- Speakers now can change data correctly
- Added ResourceReaders
  - Classpath and Filesystem for now
- Added local controls. Use with ControlTriggers.localOf(...)

NB: No actual music files included (yet). Place them in music/ directory
of the game directory (e.g. in <project>/run/music).
2021-03-26 23:51:51 +03:00
9d7f69892b
Removed unused import and renamed VSYNC to VSync 2021-03-26 21:57:54 +03:00
7ecdfdfb4d
Added scatter generation logic to TestPlanetGenerator
- Scatter generation is now triggered properly in TestPlanetGenerator
- WorldGenerators are now required to call addChunk() themselves (again)
- ChunkManager now generates loaded chunks that are not ready
- Chunks scheduled for unloading no longer unload if they become
requested while in queue
2021-03-26 21:26:05 +03:00
4332a78221
Refactored ChunkManager and EntityManager, added server event bus 2021-03-26 20:26:12 +03:00
ef572c43c7
Updated documentation for GuavaEventBusHijacker and ReportingEventBus 2021-03-25 17:15:03 +03:00
f28c765e3f
Made Gravity Models configurable with packets 2021-03-15 21:02:33 +03:00
f4311fb27c
Created a bare-bones implementation of the final planet generator
- Added Planet generator
  - Uses temporary generation algorithms
- Added Surface generator
- Added FloatRangeMap
2021-03-15 18:54:53 +03:00
abd8d9eebb
Moved some functionality into WorldGenerator
- WorldGenerators now suggest a spawn location
- WorldGenerators are no longer responsible for adding chunks
2021-02-28 23:31:57 +03:00
a9a21ce664
Moved planet generation code to its own package 2021-02-28 23:03:23 +03:00
bd5a1fa04e
Added rotating AABBs through lots of pain and suffering
- Collision models now rotate to match entity's general up direction
- Extracted rotation logic from RelRelation into AxisRotations
- Test:PlanetGravityModel is now properly centered
- Fixed some small bugs
2021-02-28 22:55:51 +03:00
2d55d4db51
Added a cubic gravity model and fixed some stuff
- Added TestPlanetGenerator and a corresponding gravity model
- Fixed gravity-triggered camera rotation
2021-02-22 15:38:14 +03:00
d438d2aa14
Linked GravityModel to a WorldGenerator and added GM comms transfer
- WorldData no longer acquires a GravityModel automatically
- On the server, GravityModel is specified by WorldGenerator
- On the client, GravityModel is received from the server via a
PacketSetGravityModel
2021-02-07 01:01:37 +03:00
d3c5011063
Replaced AbsFace with RelFace or BlockFace where appropriate
- Added BlockFace - a *Face superclass
- Refactored and optimized Rel{Relation, Face}
- Replaced most AbsFace references with BlockFace or RelFace
- Chunks now have an up direction
  - Determined by GravityModel's discrete up
  - Static; cannot change unless chunk is reloaded
  - Chunk models are now rendered rotated accordingly
- Fixed some minor bugs that were somehow revealed by these changes
- Moved TileLogicGrass to .test, where it belongs
- Disabled grass despawn until a new worldgen is implemented
2021-02-07 00:45:43 +03:00
10d271059c
Added RelRelation and RelFace; added discrete up vector to GravityModel 2021-02-02 18:49:55 +03:00
acef9d32df
Changed packages for relations, renamed Face to ShapePart
- Added BlockRelation as an abstract superclass to existing relations
  - Must be given an absolute "up" direction before use
- Moved AbsFace, AbsRelation and BlockRelation to .world.rels
- Renamed Face to ShapePart to reduce confusion with AbsFace
2021-02-01 19:14:49 +03:00