Skip to content

Commit f279f65

Browse files
authored
Merge pull request #146 from ferrumc-rs/fix/fixing-broken-shit
fix/fixing-broken-shit
2 parents 2d60101 + 615d5e0 commit f279f65

File tree

13 files changed

+374
-173
lines changed

13 files changed

+374
-173
lines changed

.etc/example-config.toml

+2
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ map_size = 1_000
3636
cache_ttl = 60
3737
# How big the cache can be in kb.
3838
cache_capacity = 20_000
39+
40+
whitelist = false

README.md

+20-7
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ our [Discord server](https://discord.gg/qT5J8EMjwk) for help or to discuss the p
7272
<h4>📝 Custom made network, NBT and Anvil encoding systems to allow for minimal I/O lag</h4>
7373
</li>
7474
<li>
75-
<h4>💾 Multiple database options to finetune the server to your needs</h4>
75+
<h4>💾 Crazy fast K/V database </h4>
7676
<i>32 render distance*</i>
7777
<img src="https://github.com/ferrumc-rs/ferrumc/blob/master/assets/README/chunk_loading.gif?raw=true" alt="Chunk Loading DEMO">
7878
</li>
@@ -94,7 +94,7 @@ our [Discord server](https://discord.gg/qT5J8EMjwk) for help or to discuss the p
9494
<h4>Optimizations</h4>
9595
</li>
9696
<li>
97-
<h4>Plugin support (JVM currently, other languages will be considered later)</h4>
97+
<h4>Plugin support (FFI currently, other languages will be considered later)</h4>
9898
</li>
9999
</ul>
100100

@@ -148,9 +148,23 @@ cargo build --release
148148

149149
## 🖥️ Usage
150150

151+
```plaintext
152+
Usage: ferrumc.exe [OPTIONS] [COMMAND]
153+
154+
Commands:
155+
setup Sets up the config
156+
import Import the world data
157+
run Start the server (default, if no command is given)
158+
help Print this message or the help of the given subcommand(s)
159+
160+
Options:
161+
--log <LOG> [default: debug] [possible values: trace, debug, info, warn, error]
162+
-h, --help Print help
163+
```
164+
151165
1. Move the FerrumC binary (`ferrumc.exe` or `ferrumc` depending on the OS) to your desired server directory
152166
2. Open a terminal in that directory
153-
3. (Optional) Generate a config file: `./ferrumc --setup`
167+
3. (Optional) Generate a config file: `./ferrumc setup`
154168
- Edit the generated `config.toml` file to customize your server settings
155169
4. Import an existing world: Either copy your world files to the server directory or specify the path to the world files
156170
in the `config.toml` file. This should be the root directory of your world files, containing the `region` directory
@@ -218,10 +232,9 @@ with the vanilla server, but we do plan on implementing some sort of terrain gen
218232
219233
### Will there be plugins? And how?
220234
221-
We do very much plan to have a plugin system and as of right now, our plan is to leverage the
222-
JVM to allow for plugins to be written in Kotlin, Java, or any other JVM language. We are also considering other
223-
languages
224-
such as Rust, JavaScript and possibly other native languages, but that is a fair way off for now.
235+
We do very much plan to have a plugin system and as of right now we are planning to use
236+
some kind of ffi (foreign function interface) to allow for plugins to be written in other languages.
237+
Not confirmed yet.
225238
226239
### What does 'FerrumC' mean?
227240

scripts/new_packet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ def to_camel_case(string) -> str:
6161
else:
6262
f.write(outgoing_template.replace("++name++", to_camel_case(packet_name)).replace("++id++", packet_id))
6363
with open(f"{packets_dir}/outgoing/mod.rs", "a") as modfile:
64-
modfile.write(f"\npub mod {to_snake_case(packet_name)};")
64+
modfile.write(f"\npub mod {to_snake_case(packet_name)};")

src/bin/src/systems/chunk_fetcher.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::collections::HashMap;
77
use std::sync::atomic::AtomicBool;
88
use std::sync::Arc;
99
use tokio::task::JoinSet;
10-
use tracing::{error, info, trace};
10+
use tracing::{debug, info, trace};
1111

1212
pub struct ChunkFetcher {
1313
stop: AtomicBool,
@@ -70,11 +70,11 @@ impl System for ChunkFetcher {
7070
match result {
7171
Ok(task_res) => {
7272
if let Err(e) = task_res {
73-
error!("Error fetching chunk: {:?}", e);
73+
debug!("Error fetching chunk: {:?}", e);
7474
}
7575
}
7676
Err(e) => {
77-
error!("Error fetching chunk: {:?}", e);
77+
debug!("Error fetching chunk: {:?}", e);
7878
}
7979
}
8080
}

src/bin/src/systems/ticking_system.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
77
use std::sync::Arc;
88
use std::time::Duration;
99
use tokio::time::Instant;
10-
use tracing::{debug, info};
10+
use tracing::{debug, info, trace};
1111
pub struct TickingSystem;
1212

1313
static KILLED: AtomicBool = AtomicBool::new(false);
@@ -19,12 +19,18 @@ impl System for TickingSystem {
1919
let mut tick = 0;
2020
while !KILLED.load(Ordering::Relaxed) {
2121
let required_end = Instant::now() + Duration::from_millis(50);
22-
// TODO handle error
23-
let res = TickEvent::trigger(TickEvent::new(tick), state.clone()).await;
22+
let res = {
23+
let start = Instant::now();
24+
let res = TickEvent::trigger(TickEvent::new(tick), state.clone()).await;
25+
trace!("Tick took {:?}", Instant::now() - start);
26+
27+
res
28+
};
2429
if res.is_err() {
2530
debug!("error handling tick event: {:?}", res);
2631
}
2732
let now = Instant::now();
33+
2834
if required_end > now {
2935
tokio::time::sleep(required_end - now).await;
3036
} else {

0 commit comments

Comments
 (0)