chemistry engine, biome notes
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-10-23 16:05:33 -04:00
parent 70f7a78626
commit 634e88942b
14 changed files with 203 additions and 28 deletions

View File

@ -20,6 +20,7 @@
- @subpage indexrendering
- @subpage entitytypesindex
- @subpage worldgenerationindex
- @subpage chemistryindex
# What is this section

View File

@ -0,0 +1,3 @@
@page chemistryindex Chemistry System
The chemistry system

View File

@ -0,0 +1,13 @@
@page biomegenerationproblems Biome Generation Problems
Different cases to consider when working on a biome generation system
- Floating islands
- "Bowls" where the perimeter of an area has one style, and the center has another
- Blending between biomes
- Mountains
- Cliffs
- Biomes with tall structures (ie trees generated with voxels, rock spires, plateaus, etc)
- Superstructure biomes (World tree, massive mountains, etc)
- Oceans
- Lakes
- Rivers

View File

@ -17,3 +17,5 @@ Once the biome is selected, a fine grain surface value is calculated
All other generation proceeds based on the specific biome selected from the pool via noise
This biome selection should be supercede-able in certain situations
- Rivers

View File

@ -1,4 +1,5 @@
@page worldgenerationindex World Generation
[TOC]
- @subpage biomeselection
- @subpage biomeselection
- @subpage biomegenerationproblems

View File

@ -898,6 +898,10 @@ Initial implementation of tooltips
(10/23/2024)
Tooltip improvements
Terrain generation testing realm
Biome data definition
Notes on biomes
OpenSimplex util class
Chemistry system collision engine instance on server and client
@ -907,28 +911,28 @@ Terrain generation testing realm
Implement gadgets
- Chemistry System
- Emitters
- Subscribers
- Dedicated collision engine on server
- Trap
- Bear
- Freeze
- Flame
- Bomb (to be thrown)
- Regular (Deals damage, ignites)
- Air (high push coeff)
- Flash (dazes)
- Sleep (puts enemies to sleep)
- Smoke (creates LOS blockers)
- Decoy (creates a decoy)
- Torch
- Throwable potions
- Chemistry System
- Emitters
- Subscribers
- Dedicated collision engine on server
- Trap
- Bear
- Freeze
- Flame
- Bomb (to be thrown)
- Regular (Deals damage, ignites)
- Air (high push coeff)
- Flash (dazes)
- Sleep (puts enemies to sleep)
- Smoke (creates LOS blockers)
- Decoy (creates a decoy)
- Torch
- Throwable potions
Crafting
- Crafting Menu
- Recipe definitions
- Reagent items
- Hover-over Tooltip for items in inventory
- Crafting Menu
- Recipe definitions
- Reagent items
- Hover-over Tooltip for items in inventory
Ability to fully reload game engine state without exiting client

View File

@ -0,0 +1,39 @@
package electrosphere.client.chemistry;
import org.joml.Vector3d;
import org.ode4j.ode.DContactGeom;
import org.ode4j.ode.DGeom;
import electrosphere.collision.CollisionEngine.CollisionResolutionCallback;
import electrosphere.collision.collidable.Collidable;
import electrosphere.entity.Entity;
public class ClientChemistryCollisionCallback implements CollisionResolutionCallback {
@Override
public void resolve(
DContactGeom contactGeom,
DGeom geom1,
DGeom geom2,
Collidable impactor,
Collidable receiver,
Vector3d normal,
Vector3d localPosition,
Vector3d worldPos,
float magnitude
) {
Entity impactorEntity = impactor.getParent();
Entity receiverEntity = receiver.getParent();
//basic error checking
if(impactorEntity == null){
throw new IllegalStateException("Impactor's entity is null");
}
if(receiverEntity == null){
throw new IllegalStateException("Receiver's entity is null");
}
}
}

View File

@ -36,6 +36,11 @@ public class ClientSceneWrapper {
//The engine used to back physics collision checks in client
CollisionEngine collisionEngine;
/**
* The chemistry engine
*/
CollisionEngine chemistryEngine;
//The hitbox manager
HitboxManager hitboxManager;
@ -43,10 +48,12 @@ public class ClientSceneWrapper {
* Constructor
* @param scene The scene
* @param collisionEngine The collision engine
* @param chemistryEngine the chemsitry engine
*/
public ClientSceneWrapper(Scene scene, CollisionEngine collisionEngine){
public ClientSceneWrapper(Scene scene, CollisionEngine collisionEngine, CollisionEngine chemistryEngine){
this.scene = scene;
this.collisionEngine = collisionEngine;
this.chemistryEngine = chemistryEngine;
this.hitboxManager = new HitboxManager(resolutionCallback);
}
@ -191,6 +198,14 @@ public class ClientSceneWrapper {
return collisionEngine;
}
/**
* Gets the chemistry engine backing the wrapper
* @return
*/
public CollisionEngine getChemistryEngine(){
return collisionEngine;
}
/**
* Gets the hitbox manager for the client
* @return The hitbox manager

View File

@ -57,6 +57,7 @@ public class ClientSimulation {
if(Globals.RUN_PHYSICS){
Globals.clientSceneWrapper.getCollisionEngine().simulatePhysics((float)Globals.timekeeper.getSimFrameTime());
Globals.clientSceneWrapper.getCollisionEngine().updateDynamicObjectTransforms();
Globals.clientSceneWrapper.getChemistryEngine().collide();
}
//update actor animations
@ -107,6 +108,7 @@ public class ClientSimulation {
//
//clear collidable impulse lists
Globals.clientSceneWrapper.getCollisionEngine().clearCollidableImpulseLists();
Globals.clientSceneWrapper.getChemistryEngine().clearCollidableImpulseLists();
Globals.profiler.endCpuSample();
//

View File

@ -150,6 +150,15 @@ public class CollisionEngine {
};
}
/**
* Creates a collision engine with a specified callback
*/
public static CollisionEngine create(CollisionResolutionCallback callback){
CollisionEngine rVal = new CollisionEngine();
rVal.setCollisionResolutionCallback(callback);
return rVal;
}
/**
* Resolves collisions in the engine

View File

@ -12,6 +12,7 @@ import electrosphere.audio.VirtualAudioSourceManager;
import electrosphere.audio.collision.HitboxAudioService;
import electrosphere.audio.movement.MovementAudioService;
import electrosphere.auth.AuthenticationManager;
import electrosphere.client.chemistry.ClientChemistryCollisionCallback;
import electrosphere.client.entity.particle.ParticleService;
import electrosphere.client.fluid.cells.FluidCellManager;
import electrosphere.client.fluid.manager.ClientFluidManager;
@ -474,7 +475,7 @@ public class Globals {
shaderOptionMap.debug();
//client scene wrapper
clientScene = new Scene();
clientSceneWrapper = new ClientSceneWrapper(clientScene, new CollisionEngine());
clientSceneWrapper = new ClientSceneWrapper(clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()));
//temporary hold for skybox colors
skyboxColors = new ArrayList<Vector3f>();
//load asset manager
@ -674,7 +675,7 @@ public class Globals {
Globals.clientPlayer = null;
Globals.playerManager = new PlayerManager();
Globals.clientScene = new Scene();
Globals.clientSceneWrapper = new ClientSceneWrapper(Globals.clientScene, new CollisionEngine());
Globals.clientSceneWrapper = new ClientSceneWrapper(Globals.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()));
Globals.clientSynchronizationManager = new ClientSynchronizationManager();
Globals.server = null;
Globals.serverSynchronizationManager = new ServerSynchronizationManager();

View File

@ -0,0 +1,42 @@
package electrosphere.server.chemistry;
import org.joml.Vector3d;
import org.ode4j.ode.DContactGeom;
import org.ode4j.ode.DGeom;
import electrosphere.collision.CollisionEngine.CollisionResolutionCallback;
import electrosphere.collision.collidable.Collidable;
import electrosphere.entity.Entity;
/**
* The collision callback for the chemistry system
*/
public class ServerChemistryCollisionCallback implements CollisionResolutionCallback {
@Override
public void resolve(
DContactGeom contactGeom,
DGeom geom1,
DGeom geom2,
Collidable impactor,
Collidable receiver,
Vector3d normal,
Vector3d localPosition,
Vector3d worldPos,
float magnitude
) {
Entity impactorEntity = impactor.getParent();
Entity receiverEntity = receiver.getParent();
//basic error checking
if(impactorEntity == null){
throw new IllegalStateException("Impactor's entity is null");
}
if(receiverEntity == null){
throw new IllegalStateException("Receiver's entity is null");
}
}
}

View File

@ -44,6 +44,11 @@ public class Realm {
//Main entity physics collision checking engine
CollisionEngine collisionEngine;
/**
* The chemistry collision engine
*/
CollisionEngine chemistryEngine;
//Hitbox manager for the realm
HitboxManager hitboxManager;
@ -69,17 +74,22 @@ public class Realm {
/**
* Realm constructor
* @param serverWorldData The world data for the realm
* @param collisionEngine The collision engine for the realm
* @param chemistryEngine The chemistry system collision engine for the realm
* @param hitboxManager The hitbox manager for the realm
* @param serverContentManager The content manager for the realm
*/
protected Realm(
ServerWorldData serverWorldData,
CollisionEngine collisionEngine,
CollisionEngine chemistryEngine,
HitboxManager hitboxManager,
ServerContentManager serverContentManager
){
this.serverWorldData = serverWorldData;
this.collisionEngine = collisionEngine;
this.chemistryEngine = chemistryEngine;
this.hitboxManager = hitboxManager;
this.serverContentManager = serverContentManager;
}
@ -198,6 +208,7 @@ public class Realm {
if(Globals.RUN_PHYSICS){
collisionEngine.simulatePhysics((float)Globals.timekeeper.getSimFrameTime());
collisionEngine.updateDynamicObjectTransforms();
chemistryEngine.collide();
}
//
//hitbox sim
@ -213,6 +224,7 @@ public class Realm {
//
//clear collidable impulse lists
collisionEngine.clearCollidableImpulseLists();
chemistryEngine.clearCollidableImpulseLists();
}
/**

View File

@ -13,6 +13,7 @@ import electrosphere.collision.hitbox.HitboxManager;
import electrosphere.entity.Entity;
import electrosphere.game.server.world.ServerWorldData;
import electrosphere.net.server.player.Player;
import electrosphere.server.chemistry.ServerChemistryCollisionCallback;
import electrosphere.server.collision.ServerHitboxResolutionCallback;
import electrosphere.server.content.ServerContentManager;
@ -41,7 +42,16 @@ public class RealmManager {
* @return The realm
*/
public Realm createRealm(){
return new Realm(new ServerWorldData(), new CollisionEngine(), new HitboxManager(new ServerHitboxResolutionCallback()), ServerContentManager.createServerContentManager(false));
//create chemistry engine
CollisionEngine chemistryEngine = new CollisionEngine();
chemistryEngine.setCollisionResolutionCallback(new ServerChemistryCollisionCallback());
return new Realm(
new ServerWorldData(),
new CollisionEngine(),
chemistryEngine,
new HitboxManager(new ServerHitboxResolutionCallback()),
ServerContentManager.createServerContentManager(false)
);
}
/**
@ -52,8 +62,18 @@ public class RealmManager {
//create collision engine
CollisionEngine collisionEngine = new CollisionEngine();
collisionEngine.setCollisionWorldData(new CollisionWorldData(serverWorldData));
//create chemistry engine
CollisionEngine chemistryEngine = new CollisionEngine();
chemistryEngine.setCollisionWorldData(new CollisionWorldData(serverWorldData));
chemistryEngine.setCollisionResolutionCallback(new ServerChemistryCollisionCallback());
//create realm
Realm realm = new Realm(serverWorldData, collisionEngine, new HitboxManager(new ServerHitboxResolutionCallback()), serverContentManager);
Realm realm = new Realm(
serverWorldData,
collisionEngine,
chemistryEngine,
new HitboxManager(new ServerHitboxResolutionCallback()),
serverContentManager
);
//create function classes
GriddedDataCellManager griddedDataCellManager = new GriddedDataCellManager(realm);
EntityDataCellMapper entityDataCellMapper = new EntityDataCellMapper();
@ -77,8 +97,19 @@ public class RealmManager {
CollisionEngine collisionEngine = new CollisionEngine();
collisionEngine.setCollisionWorldData(new CollisionWorldData(serverWorldData));
//create chemistry engine
CollisionEngine chemistryEngine = new CollisionEngine();
chemistryEngine.setCollisionWorldData(new CollisionWorldData(serverWorldData));
chemistryEngine.setCollisionResolutionCallback(new ServerChemistryCollisionCallback());
//create realm
Realm realm = new Realm(serverWorldData, collisionEngine, new HitboxManager(new ServerHitboxResolutionCallback()), ServerContentManager.createServerContentManager(false));
Realm realm = new Realm(
serverWorldData,
collisionEngine,
chemistryEngine,
new HitboxManager(new ServerHitboxResolutionCallback()),
ServerContentManager.createServerContentManager(false)
);
//add function classes to realm
realm.setDataCellManager(ViewportDataCellManager.create(realm));