Skip to content

Commit

Permalink
Network thread fully working. Add korangar_networking crate.
Browse files Browse the repository at this point in the history
  • Loading branch information
vE5li committed Apr 25, 2024
1 parent 7a9aba9 commit cd73741
Show file tree
Hide file tree
Showing 9 changed files with 1,458 additions and 693 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ bitflags = "2.4.2"
cgmath = { version = "0.18", features = ["serde"] }
chrono = "0.4"
derive-new = "0.6.0"
korangar_interface = { path = "korangar_interface" }
korangar_debug = { path = "korangar_debug" }
korangar_interface = { path = "korangar_interface" }
korangar_networking = { path = "korangar_networking" }
num = "0.4.1"
ragnarok_bytes = { path = "ragnarok_bytes" }
ragnarok_networking = { path = "ragnarok_networking" }
Expand Down
1 change: 1 addition & 0 deletions korangar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ collision = { git = "https://github.com/rustgd/collision-rs.git" }
derive-new = { workspace = true }
image = "0.24.2"
korangar_interface = { workspace = true, features = ["serde", "cgmath"] }
korangar_networking = { workspace = true, features = ["debug"] }
lunify = "1.1.0"
mlua = { version = "0.8", features = ["lua51", "vendored"] }
num = { workspace = true }
Expand Down
6 changes: 6 additions & 0 deletions korangar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ use korangar_debug::profiling::Profiler;
use korangar_interface::application::{Application, FocusState, FontSizeTrait, FontSizeTraitExt, PositionTraitExt};
use korangar_interface::state::{PlainTrackedState, Remote, RemoteClone, TrackedState, TrackedStateVec};
use korangar_interface::Interface;
use korangar_networking::NetworkingSystem2;
use ragnarok_networking::{SkillId, SkillType, UnitId};
use vulkano::device::{Device, DeviceCreateInfo, QueueCreateInfo};
#[cfg(feature = "debug")]
Expand Down Expand Up @@ -388,6 +389,9 @@ fn main() {
let client_info = load_client_info(&mut game_file_loader);
let mut networking_system = NetworkingSystem::new();

let mut networking_system_2 = NetworkingSystem2::<network::PacketMetadata>::new();
networking_system_2.connect_to_login_server(std::net::SocketAddr::new([49, 12, 109, 207].into(), 6900), "lucas", "password");

interface.open_window(&application, &mut focus_state, &LoginWindow::new(&client_info));

#[cfg(feature = "debug")]
Expand Down Expand Up @@ -536,6 +540,8 @@ fn main() {

for event in network_events {
match event {
NetworkEvent::LoginServerDisconnected => {
},
NetworkEvent::AddEntity(entity_appeared_data) => {
// Sometimes (like after a job change) the server will tell the client
// that a new entity appeared, even though it was already on screen. So
Expand Down
1,375 changes: 692 additions & 683 deletions korangar/src/network/mod.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion korangar_interface/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Ragnarok Interface
# Korangar Interface

A crate that exposes a UI that can be used to display Ragnarok Online windows.
13 changes: 13 additions & 0 deletions korangar_networking/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "korangar_networking"
version = "0.1.0"
edition = "2021"

[dependencies]
ragnarok_bytes = { workspace = true }
ragnarok_networking = { workspace = true }
korangar_debug = { workspace = true, optional = true }
tokio = { version = "1.37", features = ["full"] }

[features]
debug = ["korangar_debug"]
4 changes: 4 additions & 0 deletions korangar_networking/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Korangar Networking

An opinionated wrapper around the `ragnarok_networking` crate.
This crate exposes a networking system that can run in a seperate thread and maintain connections to the login, character, and map servers.
Loading

0 comments on commit cd73741

Please sign in to comment.