Skip to main content

Questions tagged [rust]

Rust is a multi-paradigm programming language designed for performance and safety, especially safe concurrency

Filter by
Sorted by
Tagged with
1 vote
0 answers
21 views

Pan orthographic non-axis-aligned camera

I'm trying to create a panning control for a camera in bevy, but I can't seem to get the panning logic right when the camera is rotated. It works fine if the camera transform is directly facing the XY ...
0 votes
1 answer
379 views

Black texture when manually creating from image

I am trying to create a ID3D11Texture2D from a RgbaImage loaded from a .jpg. The below code produces no errors. However, the texture is black when it is actually ...
1 vote
1 answer
140 views

How do I make the joints and weights skinned with the variables I'm using?

For some time now I have been trying to do skeleton animation using Rust and OpenGL(specifically the gl library), I loaded the animation information correctly(with the gltf library), the bone ids and ...
0 votes
0 answers
60 views

Efficient PRNG for WASM and x86_64?

For a game I am finishing, I need a random sequence that can be generated in Wasm and in the server, yielding the same result. This generated 64-bit(or more if supported by WASM) numbers sequence is ...
2 votes
0 answers
82 views

How to correctly rotate 2D orthographic projection around a central point?

I want to rotate a 2D orthographic projection around the centre point of my view. However, something is off (it looks like a translation) but I'm not sure what. To put some concrete values on the ...
1 vote
1 answer
652 views

Network mechanism for an RTS multiplayer game

I'm writing a real time strategy game in Rust. In this game each player controls one of two armies facing off on a battle zone. To better understand the gameplay, my project is an open source version ...
7 votes
1 answer
3k views

In Bevy ECS, what is a good way to have entities reference each other?

I am wondering if there is a better way than storing the entity ID. For the sake of example, let's assume I have a world with many entities who implement the component Name. Every x amount of time I ...
0 votes
1 answer
133 views

Why might performance of a Rust-sdl2 project be better while profiling?

I'm making a simple SDL2-based Rust game, on an OSX laptop. Graphics mostly involves drawing lots of colored squares to the screen. Performance is really slow for what I'm doing, so I decided to ...
1 vote
1 answer
459 views

How to rotate 2D image in 3D space using a quaternion

I am trying to rotate a flat 2D image around a 2D origin in 3D space. The problem I am having is that the image becomes stretched after the rotation. I am using the WGSL from this tutorial, but with ...
0 votes
1 answer
232 views

How to implement movement with move speed in a multiplayer game?

I'm developing a MMO RPG using Rust and bevy both in the client and the server, which means that I'm using ECS on both sides. My game is tile based, so each tile is a point in my map in the server, ...
1 vote
1 answer
457 views

How to fix texture atlas border bleeding?

I am having an issue with texture bleeding, I am getting these lines that border each tile: I have tried to solve the issue by rounding/flooring, but that does not work either. The texture atlas has ...
0 votes
1 answer
92 views

How can I implement the player being able to place tiles on a 1d array grid?

Tell me if I need to provide more info. My tile-based sandbox game needs to allow the Player to place tiles He has collected. But the problem is, I do not know how I can place the tile based on the ...
1 vote
1 answer
137 views

How to identify the visible tiles and select them for rendering?

I can render a 5000 x 5000 tile map, but it takes forever to load, and the performance is horrid. It takes around 30 seconds to Render all the tiles, So how can I render only the visible tiles? Here ...
1 vote
1 answer
58 views

Having a Logic Error in my tile rendering code

I am a novice programmer. In my program, I can render a 5000 x 500 map, but it renders incorrectly, instead of this : ,,~,,,,~,,,,,~,~,,,,,~~,,,~,,,~,,,~,,~~~,~~~,,,~,,,,~,~,,,~~,~,,~,~,~~,~,,,,,~,,~~,...
0 votes
1 answer
766 views

How to write Perlin Noise generated data to a vector in Rust?

Tell me if i need to be more specific. My program is advanced enough that it can read tile data from a .txt file and display a tile image for each tile ('~' = water), I am trying to make my game use a ...
0 votes
0 answers
214 views

How can I convert a raw pixel buffer (1D array) into a 2D array?

I have to deal with a raw buffer representing some pixels, specifically the pixels crate. So far I am able to do some magic from the examples, however it is terribly bad when it comes to readability ...
1 vote
1 answer
541 views

Rust lang and Cheaters

So I started to learn Rust for personal usage, i am Back-end Node.js dev originally. And I see that people often say Rust is a very secure solution because of memory management. In theory games/...
0 votes
0 answers
491 views

How can I render a texture in a specific x/y position on the screen? (OpenGL - glium)

I am in the process of writing a 2D game in Rust, and decided to use glium for the graphics part. So far I'm doing fine, able to render textures and shapes ...
0 votes
2 answers
199 views

Tile based collision detection errors if player is smaller than tiles

I have implemented a tilemap where each tile is at a non-negative x and y position. (So at the moment think like chess) At the moment a tile is 16, 16 pixels in ...
2 votes
1 answer
229 views

How to properly handle hundreds of layers of tiles

GOAL I am making a top-down tile-based sandbox game, and it will have 400 layers of destroyable terrain, It will not use chunks, it will store the map in memory like Terraria, but only render the ...
0 votes
2 answers
336 views

How would I go about preparing my skybox for a z-up world orientation?

**Solved!** Special thanks to comments from Maximus Minimus and Jherico. Scroll down for the solution made in the shader. I am working on a vulkan renderer in rust using the ash crate. I would like to ...
1 vote
1 answer
197 views

What could be causing my texture in ash Vulkan to render lighter?

I have just completed the Vulkan tutorial using rust and the ash crate. I've been following along with this repository. I am unable to determine what is causing my textures to render lighter. If ...
0 votes
1 answer
44 views

Ponderate dijkstra relative to previous position

I use dijkstra in my rust game to find path to a destination. My game is in a square grid like this: There is, for illustration, the Rust code which use dijkstra: ...
1 vote
1 answer
659 views

Unity ECS: Is it bad to use variable data within SystemBase?

I'm currently trying to port a flight dynamics model that I've implemented in Rust to Unity. The original FDM utilized the Hecs ECS, and I plan on implementing this same model in Unity using the ECS ...
0 votes
1 answer
248 views

Should a server run all maps in one loop, or a thread/game loop per map?

I'm working on a real time multiplayer browser-based game. The game is top down on variable size tile based maps. There is no central map where all players come together, the entire game plays out in ...
0 votes
0 answers
96 views

How do I colour a mesh in Kiss3d?

This is a question about the sebcrozet/kiss3d graphics engine for the Rust programming language. I have managed to create a mesh using group.add_mesh(). Now I want ...
1 vote
1 answer
336 views

SetFullscreenState not returning

When I call the IDXGISwapChain::SetFullscreenState method, it does not return. The window goes fullscreen, but accepts no further input. A ...
3 votes
1 answer
325 views

Render moveable entities into 3D isometric world?

I have a separate list of moveable entities, and then the regular 3D map, represented by a 2D array of stacks of tiles. My problem is that right now, I'm rendering my moveable entities after the map, ...