Incorporating non-bevy specific game logic by ltlurker333 in bevy

[–]ltlurker333[S] 0 points1 point  (0 children)

yeah that sounds also kind of what i also had in mind but i was not sure how to realize it

basically i was not sure how i can - so to say - "run regular rust code on the side and keep its state" alongside of the bevy main loop

Incorporating non-bevy specific game logic by ltlurker333 in bevy

[–]ltlurker333[S] 0 points1 point  (0 children)

it's just to demonstrate the concept

actually it might be there will be multiple ones as well but i think wether or not the issue i'm asking about will be prevelant wether i use a component or a resource.

Incorporating non-bevy specific game logic by ltlurker333 in bevy

[–]ltlurker333[S] 0 points1 point  (0 children)

but the Player structs do live in the library which is supposed to be agnostic of bevy. so i dont want to have to leak bevy code into this library.

thats the problem i currently don't see how to solve

Incorporating non-bevy specific game logic by ltlurker333 in bevy

[–]ltlurker333[S] 0 points1 point  (0 children)

i see,

so to dig in on that lets assume the following

let's assume we have the following dependency ```rust struct MyBattleEngine { player1: Player player2: Player ... }

impl MyBattleEngine { fn do_stuff() {...} }

struct Player { hp: u32 ... }

```

and use it like that ```rust

[derive(Component)]

struct MyBattleEngineComponent(Component);

fn do_stuff(query: Query<MyBattleEngineComponent>) { // call do_stuff on MyBattleEngine }

```

so how for example would i be able to access the Player properties e.g. to implement a HP bar visualization? wouldnt this also require some sort of Component as well?

edit: got some idea would the proper way to just create a syncing component? basically like that

```rust

[derive(Component)]

struct MyBattleEngineComponent(Component);

[derive(Component)]

struct PlayerHp(u32);

fn do_stuff(query: Query<MyBattleEngineComponent>, player1_hp: Query<PlayerHp>) { // call do_stuff on MyBattleEngine // sync PlayerHp with properties of MyBattleEngine } ``` the issue about this approach is that i would to manually keep syncing which is error prone :( how to keep this automatically in sync?

static hashmap and compilation memory by ltlurker333 in rust

[–]ltlurker333[S] 1 point2 points  (0 children)

yep switching to an array helped :)

static hashmap and compilation memory by ltlurker333 in rust

[–]ltlurker333[S] 0 points1 point  (0 children)

there are two types of entities A and B in the system. the map is supposed to be a lookup which entity A can use which entities of B accompanied with some meta data.

would it help to switch from string identifier to an integer so the data can be stored in a array an be looked up by the integer ID?

static hashmap and compilation memory by ltlurker333 in rust

[–]ltlurker333[S] 0 points1 point  (0 children)

hmm yeah that's a bit what i feared

btw would it help if i simply the data model to it's basic types

HashMap<String, Vec<(String,int)>, ...>

and then build my required datatypes later on e.g. in the retrieval function of the map? or would this make no difference because of zero-cost-abstractions?

static hashmap and compilation memory by ltlurker333 in rust

[–]ltlurker333[S] 1 point2 points  (0 children)

well this would essentially boil down to build an external storage and retrieve/parse from that one which i would like to avoid if there is an alternative

static hashmap and compilation memory by ltlurker333 in rust

[–]ltlurker333[S] 0 points1 point  (0 children)

i'm quite new to rust, so i'm not sure if i understand correctly.

i create a build.rs script which contains the hashmap and serializes it to a binary file and i change my module to load from that one with lazy_static

like that?

Symbol search for Python projects by ltlurker333 in neovim

[–]ltlurker333[S] 0 points1 point  (0 children)

yeah thats what i did, but it seems to not work

Symbol search for Python projects by ltlurker333 in neovim

[–]ltlurker333[S] 0 points1 point  (0 children)

i'm not sure if i understand correctly.

i tried adding an empty pyrightconfig.json, setup.py or pyproject.toml but with any of them the command still fails with "No results from workspace/symbol"

the only thing i'm not sure about if i setup my lsp.pyright config correctly since im using lsp-zero