M crates/client/src/assets/venus.svg => crates/client/src/assets/venus.svg +166 -14
@@ 24,12 24,12 @@
inkscape:deskcolor="#505050"
inkscape:document-units="mm"
inkscape:zoom="0.046932044"
- inkscape:cx="4634.3603"
- inkscape:cy="5699.7305"
- inkscape:window-width="1272"
- inkscape:window-height="1414"
- inkscape:window-x="1281"
- inkscape:window-y="19"
+ inkscape:cx="639.22211"
+ inkscape:cy="5998.0341"
+ inkscape:window-width="1910"
+ inkscape:window-height="1046"
+ inkscape:window-x="4"
+ inkscape:window-y="28"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
@@ 114,13 114,165 @@
cy="1024"
r="1024" />
</clipPath>
+ <filter
+ style="color-interpolation-filters:sRGB;"
+ inkscape:label="Color Shift"
+ id="filter2751"
+ x="0"
+ y="0"
+ width="1"
+ height="1">
+ <feColorMatrix
+ type="hueRotate"
+ values="342"
+ result="color1"
+ id="feColorMatrix2750" />
+ <feColorMatrix
+ type="saturate"
+ values="0.6"
+ result="color2"
+ id="feColorMatrix2751" />
+ </filter>
+ <filter
+ style="color-interpolation-filters:sRGB;"
+ inkscape:label="Color Shift"
+ id="filter2753"
+ x="0"
+ y="0"
+ width="1"
+ height="1">
+ <feColorMatrix
+ type="hueRotate"
+ values="342"
+ result="color1"
+ id="feColorMatrix2752" />
+ <feColorMatrix
+ type="saturate"
+ values="0.6"
+ result="color2"
+ id="feColorMatrix2753" />
+ </filter>
+ <filter
+ style="color-interpolation-filters:sRGB;"
+ inkscape:label="Color Shift"
+ id="filter2755"
+ x="0"
+ y="0"
+ width="1"
+ height="1">
+ <feColorMatrix
+ type="hueRotate"
+ values="342"
+ result="color1"
+ id="feColorMatrix2754" />
+ <feColorMatrix
+ type="saturate"
+ values="0.6"
+ result="color2"
+ id="feColorMatrix2755" />
+ </filter>
+ <filter
+ style="color-interpolation-filters:sRGB;"
+ inkscape:label="Color Shift"
+ id="filter2757"
+ x="0"
+ y="0"
+ width="1"
+ height="1">
+ <feColorMatrix
+ type="hueRotate"
+ values="342"
+ result="color1"
+ id="feColorMatrix2756" />
+ <feColorMatrix
+ type="saturate"
+ values="0.6"
+ result="color2"
+ id="feColorMatrix2757" />
+ </filter>
+ <filter
+ style="color-interpolation-filters:sRGB;"
+ inkscape:label="Color Shift"
+ id="filter2759"
+ x="0"
+ y="0"
+ width="1"
+ height="1">
+ <feColorMatrix
+ type="hueRotate"
+ values="342"
+ result="color1"
+ id="feColorMatrix2758" />
+ <feColorMatrix
+ type="saturate"
+ values="0.6"
+ result="color2"
+ id="feColorMatrix2759" />
+ </filter>
+ <filter
+ style="color-interpolation-filters:sRGB;"
+ inkscape:label="Color Shift"
+ id="filter2761"
+ x="0"
+ y="0"
+ width="1"
+ height="1">
+ <feColorMatrix
+ type="hueRotate"
+ values="342"
+ result="color1"
+ id="feColorMatrix2760" />
+ <feColorMatrix
+ type="saturate"
+ values="0.6"
+ result="color2"
+ id="feColorMatrix2761" />
+ </filter>
+ <filter
+ style="color-interpolation-filters:sRGB;"
+ inkscape:label="Color Shift"
+ id="filter2763"
+ x="0"
+ y="0"
+ width="1"
+ height="1">
+ <feColorMatrix
+ type="hueRotate"
+ values="342"
+ result="color1"
+ id="feColorMatrix2762" />
+ <feColorMatrix
+ type="saturate"
+ values="0.6"
+ result="color2"
+ id="feColorMatrix2763" />
+ </filter>
+ <filter
+ style="color-interpolation-filters:sRGB;"
+ inkscape:label="Color Shift"
+ id="filter2765"
+ x="0"
+ y="0"
+ width="1"
+ height="1">
+ <feColorMatrix
+ type="hueRotate"
+ values="342"
+ result="color1"
+ id="feColorMatrix2764" />
+ <feColorMatrix
+ type="saturate"
+ values="0.6"
+ result="color2"
+ id="feColorMatrix2765" />
+ </filter>
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
- style="fill:#e2dba6;fill-opacity:1;stroke:none;stroke-width:16;stroke-linejoin:round"
+ style="fill:#e2dba6;fill-opacity:1;stroke:none;stroke-width:16;stroke-linejoin:round;filter:url(#filter2751)"
id="rect12"
width="2048"
height="2048"
@@ 128,40 280,40 @@
y="0"
clip-path="url(#clipPath47)" />
<path
- style="fill:#d5ce9d;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:#d5ce9d;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter2753)"
d="M -219.86577,1138.7919 C -90.654331,1108.3482 -347.48372,887.31563 -67.651007,928.16107 286.80655,979.89904 1101.1217,948.47825 1226.953,922.03111 c 363.4685,-76.39355 1800.4296,-76.39355 1800.4296,-76.39355 0,0 310.067,840.00004 -248.0538,676.51004 -558.1208,-163.4899 -1894.22813,-349.5302 -2976.64423,-78.9262 -1082.41607,270.6041 -22.55034,-304.4295 -22.55034,-304.4295 z"
id="path6"
sodipodi:nodetypes="csscssc"
clip-path="url(#clipPath46)" />
<path
- style="fill:#d5ce9d;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:#d5ce9d;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter2755)"
d="M -231.14094,541.20803 C 885.10066,270.60402 2948.4563,479.19462 2948.4563,479.19462 l -28.1879,202.95301 c 0,0 -2277.58386,-78.92616 -3173.95968,174.7651 -896.37582,253.69137 22.55034,-315.7047 22.55034,-315.7047 z"
id="path7"
clip-path="url(#clipPath45)" />
<path
- style="fill:#beb68a;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
+ style="fill:#beb68a;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1;filter:url(#filter2757)"
d="M 0,580.67114 C 1240.1601,402.83558 2226.8456,524.29528 2226.8456,524.29528 l 5.6376,50.73828 c 0,0 -902.0134,-157.85235 -2232.4832,56.37582 -1330.4698,214.22818 0,-50.73824 0,-50.73824 z"
id="path8"
clip-path="url(#clipPath44)" />
<path
- style="fill:#beb68a;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:#beb68a;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter2759)"
d="m -71.897721,1414.1138 c 100.11754,5.4377 -26.119617,94.3502 71.897721,88.6679 294.68809,-17.0839 744.74782,66.1641 927.76782,74.2972 1332.90328,59.2317 958.46728,205.3126 1834.64828,91.6459 1042.9528,-135.302 -281.8792,231.1409 -281.8792,231.1409 0,0 -583.2153,-129.6109 -1067.5708,-116.3441 C 893.01122,1797.7635 422.83717,1636.348 201.25447,1633.644 -276.24154,1627.8171 -71.897721,1414.1138 -71.897721,1414.1138 Z"
id="path9"
sodipodi:nodetypes="cssscssc"
clip-path="url(#clipPath43)" />
<path
- style="fill:#f5eab2;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:#f5ebb2;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter2761)"
d="m 202.95302,231.14094 c 247.90029,60.58441 562.7132,-7.63815 892.30368,-20.89922 391.8161,-15.76473 792.1334,16.49241 952.7433,20.89922 L 1815.302,-310.06711 236.77852,-281.8792 Z"
id="path10"
sodipodi:nodetypes="cscccc"
clip-path="url(#clipPath42)" />
<path
id="path11"
- style="fill:#f5eab2;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
+ style="fill:#f5eab2;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1;filter:url(#filter2763)"
d="M 1517.8397 1010.374 C 1394.897 1010.9397 1300.4388 1020.676 1193.8605 1035.8086 L 1193.7328 1035.7264 C 1121.2224 1046.4754 837.13845 1084.2935 538.16043 1084.2935 C 239.1824 1084.2935 -123.57747 1028.4845 -123.57747 1028.4845 L -123.57747 1092.2661 C -123.57747 1092.2661 190.70145 1118.6854 477.63648 1130.577 C 343.49959 1144.043 188.65274 1157.5973 0 1170.6639 L -276.24154 1330.4697 C -276.24154 1330.4697 428.4562 1274.0938 820.58144 1245.9059 C 1212.7067 1217.718 1381.2081 1099.3288 2048.0001 1183.8926 C 2246.7683 1209.1008 2358.707 1232.7406 2419.6761 1253.5989 C 2394.4774 1172.8571 2279.1723 1057.3193 1837.8522 1024 C 1706.7783 1014.1041 1605.0378 1009.9727 1517.8397 1010.374 z M 2419.6761 1253.5989 C 2434.3927 1300.7539 2418.5237 1336.1076 2418.5237 1336.1076 C 2418.5237 1336.1076 2563.235 1302.7124 2419.6761 1253.5989 z "
clip-path="url(#clipPath41)" />
<path
- style="fill:#f5eab2;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:#f5ebb2;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter2765)"
d="m 357.83524,1905.5033 c 586.30872,-45.1006 39.4631,-45.1006 811.81206,16.9128 772.349,62.0134 456.6443,338.255 456.6443,338.255 z"
id="path12"
clip-path="url(#clipPath40)" />
M crates/client/src/networking/mod.rs => crates/client/src/networking/mod.rs +38 -6
@@ 1,6 1,6 @@
use std::collections::HashMap;
-use bevy_ecs::{entity::Entity, event::Events, query::With, world::World};
+use bevy_ecs::{entity::Entity, event::Events, query::{QuerySingleError, With}, world::World};
use nalgebra::{Rotation2, Scale2, Scale3, Translation3};
use starkingdoms_common::{packet::Packet, PartType, PlanetType};
@@ 23,11 23,33 @@ pub fn process_packets(
let mut recv_cursor = recv_packet_events.get_cursor();
for recv in recv_cursor.read(&recv_packet_events) {
match &recv.0 {
- SpawnPlayer { id, username } => {
+ LoginResponse { id } => {
let mut player_query = world.query_filtered::<Entity, With<Player>>();
let entity = player_query.single(world);
world.entity_mut(entity).insert(ServerId(*id));
}
+ PlayerList { players } => { // existing players
+ // username sync, eventually
+ for player in players {
+ world.spawn((Transform {
+ translation: Translation3::new(0.0, 0.0, 0.0),
+ rotation: Rotation2::new(0.0),
+ scale: Scale3::new(25.0, 25.0, 1.0),
+ }, Texture {
+ name: "hearty.svg".to_string(),
+ }, ServerId(player.0), Part));
+ }
+ }
+ SpawnPlayer { id, username } => {
+ // username sync, eventually
+ world.spawn((Transform {
+ translation: Translation3::new(0.0, 0.0, 0.0),
+ rotation: Rotation2::new(0.0),
+ scale: Scale3::new(25.0, 25.0, 1.0),
+ }, Texture {
+ name: "hearty.svg".to_string(),
+ }, ServerId(*id), Part));
+ }
SpawnPart { id, part } => {
use PartType::*;
world.spawn((Transform {
@@ 49,7 71,17 @@ pub fn process_packets(
for (id, part) in parts {
if part.part_type == PartType::Hearty {
let mut player_query = world.query_filtered::<&ServerId, With<Player>>();
- let server_id = player_query.single(world);
+ let server_id = match player_query.get_single(world) {
+ Ok(player) => player,
+ Err(e) => match e {
+ QuerySingleError::NoEntities(s) => {
+ continue;
+ }
+ QuerySingleError::MultipleEntities(s) => {
+ panic!("There should never multiple players marked as players");
+ }
+ }
+ };
if server_id.0 == *id {
let mut camera = world.resource_mut::<Camera>();
camera.x = -part.transform.x;
@@ 91,13 123,13 @@ pub fn process_packets(
PlanetType::Pluto => "pluto.svg",*/
PlanetType::Sun => "sun.svg",
PlanetType::Mercury => "moon.svg",
- PlanetType::Venus => "mars.svg",
+ PlanetType::Venus => "venus.svg",
PlanetType::Earth => "earth.svg",
PlanetType::Moon => "moon.svg",
PlanetType::Mars => "mars.svg",
PlanetType::Jupiter => "sun.svg",
- PlanetType::Saturn => "moon.svg",
- PlanetType::Uranus => "sun.svg",
+ PlanetType::Saturn => "saturn.svg",
+ PlanetType::Uranus => "venus.svg",
PlanetType::Neptune => "mars.svg",
PlanetType::Pluto => "earth.svg",
}.to_string()
M crates/client/src/rendering/mod.rs => crates/client/src/rendering/mod.rs +1 -1
@@ 201,7 201,7 @@ impl ApplicationHandler for App {
gl.enable_vertex_attrib_array(1);
- gl.clear_color(0.7, 0.7, 0.7, 1.0);
+ gl.clear_color(0.1, 0.1, 0.1, 1.0);
gl.viewport(0, 0, window.inner_size().width as i32, window.inner_size().height as i32);
gl.enable(glow::BLEND);
gl.blend_func(glow::SRC_ALPHA, glow::ONE_MINUS_SRC_ALPHA);
M crates/common/src/packet.rs => crates/common/src/packet.rs +3 -0
@@ 106,6 106,9 @@ pub enum Packet {
},
_SpecialDisconnect {},
// clientbound
+ LoginResponse {
+ id: u32,
+ },
SpawnPlayer {
id: u32,
username: String,
M crates/server/src/player/client_login.rs => crates/server/src/player/client_login.rs +8 -0
@@ 230,6 230,14 @@ pub fn packet_stream(
>,
transform: Transform,
) {
+ // response in the handshake
+ let packet = Packet::LoginResponse {
+ id: index,
+ };
+ event_queue.push(WsEvent::Send {
+ to: *from,
+ message: packet.into_message(),
+ });
// tell this player the planets
let mut planets = Vec::new();
for (entity, planet_type, transform) in planet_query.iter() {