Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Feature/expanse 2 #34

Open
wants to merge 58 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e8f7981
Add external launch config for ChunkWorker
Bluexin Jan 24, 2019
fbe5e08
Revamp chunk schema
Bluexin Jan 24, 2019
614025d
Use updated reservation api
Jan 24, 2019
dd67e1d
Fix gradle fatjar and ChunkWorker executable path
Bluexin Jan 24, 2019
ebcd760
Abstract away the connection manager
Bluexin Jan 24, 2019
c97adb9
Add worker manager
Jan 24, 2019
10353ea
Fix mistake in worker manager
Jan 24, 2019
b531e29
Move service definition
Jan 24, 2019
1c20f80
Run the WorkerManager trough LaunchWrapper
Bluexin Jan 25, 2019
cf47f6f
Connect the Chunk Worker
Bluexin Jan 25, 2019
fcad5ca
Add a connection callback to the ConnectionManager
Bluexin Jan 25, 2019
d450926
Add support for View Mode in ConnectionManager
Bluexin Jan 25, 2019
a1fb38b
Update entity db
Bluexin Jan 25, 2019
0970cac
Add dummy chunk generation ability to the chunk worker
Bluexin Jan 26, 2019
8da1413
Let the client (dis)connect to/from the server
Bluexin Jan 26, 2019
b29b96d
Fix ConnectionManager to act as keep-alive again
Bluexin Jan 26, 2019
d13a4dd
Fix chunk creation after database upgrade
Bluexin Jan 26, 2019
5c4fde1
Let consumers give their own Dispatcher implementation
Bluexin Jan 26, 2019
68e24c0
Read chunk data from client (almost)
Bluexin Jan 26, 2019
3eca72c
add worker-sdk build.gradle
Jan 24, 2019
2f1445f
Package mc & forge in the workers builds
Bluexin Jan 26, 2019
8cb5969
Fix manifests
Bluexin Jan 26, 2019
5c6fd95
Fix worker types and implement base worker + doc
Bluexin Jan 27, 2019
1a0560a
Let chunk workers & clients get entities data
Bluexin Jan 27, 2019
f3461b9
Render the world
Jan 27, 2019
09cb661
Update branding
Jan 29, 2019
739ae33
Wah?
Jan 29, 2019
f375cbe
Merge branch 'develop' into feature/Spatial-14
Jan 31, 2019
71cb04b
Disable brand mixin
Feb 2, 2019
536f6d2
Implement world converter
Feb 2, 2019
ba05ffe
Update entity schema
Feb 2, 2019
148c7b6
Update chunk provider y level
Feb 2, 2019
a85879b
Fix some issues with chunk loading
Bluexin Feb 4, 2019
495f695
Update player id on client worker
Feb 4, 2019
926bcc7
Add default snapshot to test with
Feb 4, 2019
3434ab8
Work on entity syncing
Feb 4, 2019
4bc47bf
Fix chunk loading for real and update snapshot
Bluexin Feb 4, 2019
bb8606e
Update spatial launch config
Bluexin Feb 4, 2019
39c4795
Merge remote-tracking branch 'origin/feature/Spatial-14' into feature…
Feb 4, 2019
f6b706f
Update spatial launch config (fix derp)
Bluexin Feb 4, 2019
0b8a57a
Merge remote-tracking branch 'origin/feature/Spatial-14' into feature…
Feb 4, 2019
da82240
[WIP] World loading and syncing to clients (#14 #15) (#19)
Bluexin Feb 4, 2019
9e742f1
Merge branch 'develop' into feature/Expanse-2
Feb 5, 2019
916bd2d
Fix some issue with chunks
Feb 6, 2019
adfea00
Improve component requirements
Feb 7, 2019
616c340
Fix world converter formatting
Feb 7, 2019
109aef7
Fix worker service
Feb 8, 2019
d6d4c14
Add attributes to client worker
Feb 8, 2019
3c78d8f
Implement entity worker and client disconnection
Feb 8, 2019
a341bf5
Prevent player from directly updating position
Feb 12, 2019
9eb5f9c
Player syncing
Feb 12, 2019
9347eb3
Bootstrapper
Feb 25, 2019
9eea4ab
Customize main menu
Feb 25, 2019
95d40e9
Reduce timeout time to 5 seconds
Feb 25, 2019
aba5c3e
Remove used entities from the requirement callback
Feb 25, 2019
e701126
Fix *some* worker issues, update to SpatialOS 13.6.1
Bluexin Feb 27, 2019
b2456bf
Do a bit more on player syncing
Feb 28, 2019
b218f7e
Send right click with item
Feb 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions default_launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
"options": {
"manual_worker_connection_only": true
}
},
{
"layer": "entity_worker",
"hex_grid": {
"num_workers": 1
},
"options": {
"manual_worker_connection_only": true
}
}
]
},
Expand Down Expand Up @@ -47,6 +56,14 @@
"all": {}
}
]
},
{
"worker_type": "EntityWorker",
"permissions": [
{
"all": {}
}
]
}
]
}
18 changes: 18 additions & 0 deletions schema/components/bootstrap.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package minecraft.boostrap;

import "components/player.schema";

// Reserves 1400-1449

type Message {
string message = 1;
}

/**
* A single chunk holds 16x16x16 states.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copypasta doc comment should be fixed

*/
component Bootstrap {
id = 1400;
map<string, minecraft.player.GameProfile> online_players = 1;
command Message on_chat(Message);
TheCodedOne marked this conversation as resolved.
Show resolved Hide resolved
}
14 changes: 4 additions & 10 deletions schema/components/entity.schema
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package minecraft.entity;
import "improbable/standard_library.schema";
import "improbable/vector3.schema";

// Reserves 1000-1099

Expand Down Expand Up @@ -28,18 +29,11 @@ component Rotation {

component Motion {
id = 1005;
improbable.Coordinates coords = 1;
improbable.Vector3f motion = 1;
}

type GameProfile {
string uuid = 1;
}

component Player {
id = 1006;
GameProfile profile = 1;
bool sneaking = 2;
bool sprinting = 3;
component WorldEntity {
id= 1010;
}

component ChatAbility {
Expand Down
36 changes: 36 additions & 0 deletions schema/components/player.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package minecraft.player;

import "improbable/vector3.schema";

// Reserves 1450-1499

type GameProfile {
string uuid = 1;
string name = 2;
}

component PlayerInfo {
id = 1450;
GameProfile profile = 1;
}

component MapRepresentation {
id = 1453;
uint32 colour = 1;
string icon = 2;
}

component PlayerInput {
id = 1451;
improbable.Vector3f move_position = 1;
bool sprinting = 2;
bool sneaking = 3;
}

type Heartbeat {
}

component PlayerConnection {
id = 1452;
event Heartbeat heartbeat;
}
54 changes: 54 additions & 0 deletions workers/java/spatialos.Bootstrapper.worker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"build": {
"tasks_filename": "spatialos.java.build.json"
},
"bridge": {
"worker_attribute_set": {
"attributes": [
"bootstrap"
]
},
"entity_interest": {
"range_entity_interest": {
"radius": 0
}
},
"streaming_query": [],
"component_delivery": {
"default": "RELIABLE_ORDERED",
"checkout_all_initially": true
}
},
"external": {
"default": {
"run_type": "EXECUTABLE_ZIP",
"linux": {
"artifact_name": "[email protected]",
"command": "java",
"arguments": [
"-jar",
"HorizonJavaWorker.jar",
"Bootstrapper"
]
},
"windows": {
"artifact_name": "[email protected]",
"command": "java",
"arguments": [
"-jar",
"HorizonJavaWorker.jar",
"Bootstrapper"
]
},
"macos": {
"artifact_name": "[email protected]",
"command": "java",
"arguments": [
"-jar",
"HorizonJavaWorker.jar",
"Bootstrapper"
]
}
}
}
}
54 changes: 54 additions & 0 deletions workers/java/spatialos.EntityWorker.worker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"build": {
"tasks_filename": "spatialos.java.build.json"
},
"bridge": {
"worker_attribute_set": {
"attributes": [
"entity_worker"
]
},
"entity_interest": {
"range_entity_interest": {
"radius": 0
}
},
"streaming_query": [],
"component_delivery": {
"default": "RELIABLE_ORDERED",
"checkout_all_initially": true
}
},
"external": {
"default": {
"run_type": "EXECUTABLE_ZIP",
"linux": {
"artifact_name": "[email protected]",
"command": "java",
"arguments": [
"-jar",
"HorizonJavaWorker.jar",
"EntityWorker"
]
},
"windows": {
"artifact_name": "[email protected]",
"command": "java",
"arguments": [
"-jar",
"HorizonJavaWorker.jar",
"EntityWorker"
]
},
"macos": {
"artifact_name": "[email protected]",
"command": "java",
"arguments": [
"-jar",
"HorizonJavaWorker.jar",
"EntityWorker"
]
}
}
}
}
6 changes: 4 additions & 2 deletions workers/java/spatialos.HorizonClientWorker.worker.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
},
"bridge": {
"worker_attribute_set": {
"attributes": []
"attributes": [
"horizon_client"
]
},
"entity_interest": {
"range_entity_interest": {
"radius": 10
"radius": 128
}
},
"streaming_query": [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.hrznstudio.spatial;

import net.minecraft.launchwrapper.Launch;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.event.ServerChatEvent;
import org.apache.commons.lang3.ArrayUtils;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@

import com.hrznstudio.spatial.client.GuiConnecting;
import com.hrznstudio.spatial.client.HorizonClientWorker;
import com.hrznstudio.spatial.util.CommonWorkerRequirements;
import com.hrznstudio.spatial.util.EntityBuilder;
import com.hrznstudio.spatial.util.Util;
import com.mojang.authlib.GameProfile;
import improbable.Coordinates;
import improbable.Position;
import improbable.PositionData;
import improbable.worker.Entity;
import minecraft.entity.*;
import minecraft.inventory.Inventory;
import minecraft.inventory.InventoryData;
import minecraft.entity.PlayerInfo;
import minecraft.entity.PlayerInfoData;
import minecraft.entity.Rotation;
import minecraft.entity.RotationData;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityOtherPlayerMP;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.EntityTracker;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.Collections;
import java.util.ArrayList;
import java.util.UUID;

@Mod(modid = "spatial", name = "Spatial", version = "0.0.1")
@Mod(modid = "expanse", name = "Expanse", version = "0.0.1")
@Mod.EventBusSubscriber
public class SpatialMod {

Expand All @@ -44,44 +48,4 @@ public static void actionEvent(GuiScreenEvent.ActionPerformedEvent.Pre event) {
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event) {
}

public static Entity createPlayerEntity() {
EntityBuilder builder = new EntityBuilder("Player");
builder.addComponent(
Position.COMPONENT,
new PositionData(new Coordinates(0, 0, 0)),
CommonWorkerRequirements.getEntityWorkers()
);
builder.addComponent(
Player.COMPONENT,
new PlayerData(new GameProfile(UUID.randomUUID().toString()), false, false),
CommonWorkerRequirements.getEntityWorkers()
);
builder.addComponent(
Health.COMPONENT,
new HealthData(20, 20),
CommonWorkerRequirements.getEntityWorkers()
);
builder.addComponent(
Food.COMPONENT,
new FoodData(20, 20),
CommonWorkerRequirements.getEntityWorkers()
);
builder.addComponent(
Experience.COMPONENT,
new ExperienceData(0),
CommonWorkerRequirements.getEntityWorkers()
);
builder.addComponent(
Inventory.COMPONENT,
new InventoryData(Collections.emptyMap()),
CommonWorkerRequirements.getEntityWorkers()
);
builder.addComponent(
Flammable.COMPONENT,
new FlammableData(false),
CommonWorkerRequirements.getEntityWorkers()
);
return builder.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.hrznstudio.spatial;

import com.hrznstudio.spatial.worker.WorkerService;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import picocli.CommandLine;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
@CommandLine.Command(name = "worker", sortOptions = false,
Expand Down Expand Up @@ -39,7 +39,7 @@ public static void main(String... args) {
} else
logger.warn("Running the WorkerManager directly is not recommended. Please use SpatialLaunchWrapper instead.");
ServiceLoader<WorkerService> workerService = ServiceLoader.load(WorkerService.class);
workerService.forEach(service -> workerMap.put(service.getWorkerID(), service));
workerService.forEach(service -> workerMap.put(service.getWorkerType(), service));

CommandLine.run(new WorkerManager(), System.out, args);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.hrznstudio.spatial.api;

public interface IDispatcherLoop {
void onLoop();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.hrznstudio.spatial.api;

import improbable.worker.EntityId;

public interface ISpatialEntity {
EntityId getSpatialId();
void setSpatialId(EntityId id);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.hrznstudio.spatial.api;

import improbable.worker.EntityId;
import net.minecraft.entity.Entity;

public interface ISpatialWorld {
Entity getEntityById(EntityId id);
void addSpatial(Entity entity);
void removeSpatial(Entity entity);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO one shouldn't need documentation in code, but interfaces can use it.
It might help me understand these methods, as they're not very clear to me (spatial but then they take n.m.e.Entity ??)

}
Loading