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

Client crashes when unfocused #581

Open
terrarier2111 opened this issue Aug 1, 2021 · 4 comments
Open

Client crashes when unfocused #581

terrarier2111 opened this issue Aug 1, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@terrarier2111
Copy link
Contributor

When the client is unfocused (by making it non fullscreen and then clicking on some other application on the same monitor)
the client sends no keep alive packets more (it seems like it freezes somehow, which is good in theory but in practice it doesn't respond to any packets sent to it anymore, like for example keep alive packets... which causes it to crash after a timing out from the server. This can be fixed by handling some specific packets in the reader thread, and not sending them to the main thread via the channel. (I already fixed it in my custom version of this client, which I can't merge into this one, cuz I removed web support and I am about to switch to vulkano as a rendering engine)

@iceiix iceiix added the bug Something isn't working label Aug 5, 2021
@iceiix
Copy link
Owner

iceiix commented Aug 5, 2021

Was going to say this sounds vaguely familiar, there are/were platform-specific conditions where window events are not delivered, at least: rust-windowing/winit#219 - but if you've solved it... handling packets on a separate thread I agree does seem like a good solution to me (maybe all/most packets?).

I already fixed it in my custom version of this client, which I can't merge into this one, cuz I removed web support and I am about to switch to vulkano as a rendering engine

In this fork? https://github.com/terrarier2111/stevenarella

Web support (#446 🕸️) is very incomplete, wouldn't be too much of a loss to break or disable it, may be worth the rendering backend upgrade. Looked into alternatives in #34 Investigate rendering backends, and I switched from a custom OpenGL wrapper from Steven, to glow in #262 - abstracting OpenGL/ES and WebGL. But now, there's newer tech like WebGPU on the horizon, which more closely resembles vulkan, and vulkano does look to be a very nice library (safe Rust wrapper around Vulkan API). And the industry appears to be moving away from OpenGL to newer graphics APIs, so I wouldn't mind moving this project, either. Just saw this recent gfx-rs update: https://gfx-rs.github.io/2021/07/16/release-0.9-future.html "a single Vulkan-like Rust API with multiple backends that implement it: Direct3D 12/11, Metal, Vulkan, and even OpenGL ES". And then there are implementations of Vulkan which bridge to other platform APIs. It is all quite confusing, many options, no clear best winner...

I suppose what I'm saying is, I'm all for your porting to use the vulkano graphics backend (if not necessarily to merge into this repo - at least it will be a worthwhile alternative for some usages - a step forward beyond the OpenGL/WebGL hegemony). The ideal scenario I see is full support for all native modern rendering backends for each platform (Vulkano? Metal? Direct3D? WebGPU?), ideally abstracted away, but, that's a long way off (if ever), not easy...

@terrarier2111
Copy link
Contributor Author

In this fork? https://github.com/terrarier2111/stevenarella

No its not a fork in the traditional sense, I just uploaded the modified files to a private repo on github, as i don't think anyone except me would work on this project, if published, so I decided, I'd loose nothing when making it private (and probably open sourcing it later on down the line).

@terrarier2111
Copy link
Contributor Author

terrarier2111 commented Aug 10, 2021

Was going to say this sounds vaguely familiar, there are/were platform-specific conditions where window events are not delivered, at least: rust-windowing/winit#219 - but if you've solved it... handling packets on a separate thread I agree does seem like a good solution to me (maybe all/most packets?).

I handle all packets on a seperate thread which also boosts perf dramatically. (for this i had to restructure many parts of this project to use Arc/Arc->RwLock ie. the Server has no mutable stuff in it anymore (the same is true for the World) as they are both only passed in Arcs which allows me to use way more multithreading in order to improve the performance. (i think i was able to improve the perf by at least 3 to 4 times the original perf, thus I get an average of 100 frames, when standing still and 20-40 fps when moving and loading the world initially, and all of this in an unoptimized build)

@terrarier2111
Copy link
Contributor Author

terrarier2111 commented Aug 10, 2021

Also i added an hud to the game, idk
Bildschirmfoto vom 2021-08-14 13-22-03

@PureTryOut PureTryOut mentioned this issue Aug 24, 2021
29 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants