Git Product home page Git Product logo

cvars's People

Contributors

dependabot[bot] avatar martin-t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cvars's Issues

Feature: Nested structs

  • cvars_structs! {} to allow defining whole structs that contain each other
  • Useful for configuring multiple weapons/vehicles/items/etc that have the same fields - rec-wars does it manually atm.

Compare perf with alternatives

Compare normal access in gamecode and stringly-typed access when the user is accessing the config. Small and large amount of cvars.

Attribute for skipping a field?

I've got some structs with fields that must not be changed (would cause crashing and/or freezing), but would like to keep the remaining fields configurable...

Would it be possible to add something like a #[cvars(skip)] attribute, similar to #[serde(skip)]? Maybe check for the latter too?

Console features

  • Tab - autocompletion if unambiguous, print possibilities if ambiguous
  • Write text, up arrow -> search history only for items starting with the text
    • Pg up/down still walks history normally (like zsh)
  • cvarlist
  • find/search/apropos with multiple words - search for those words appearing in any order
  • If starting with space, don't save to history
  • History to file
  • CTRL+R - fuzzy search in history - possible to use fzf or alternative (atuin/skim)?

CI

Check for:

  • dead links
  • FIXMEs
  • typos?

Try it out link

When RecWars console works sanely or RustCycles supports WASM, add a heading "Try it out" right before usage that explains how to open the console and which cvars to try changing. Maybe reduce number of bots?

Compile times

Switch to a hashmap or trie for storing the strings, the generated match is huge:

cargo llvm-lines:

  Lines          Copies       Function name
  -----          ------       -------------
  119771 (100%)  4182 (100%)  (TOTAL)
   30067 (25.1%)    1 (0.0%)  rec_wars::cvars::Cvars::set_str
    5892 (4.9%)     1 (0.0%)  rec_wars::cvars::Cvars::get_string
    3083 (2.6%)     1 (0.0%)  rec_wars::rendering::render_viewport

and render_viewport is a huge 700 line function.

Maybe llvm lines are not the best metric but it absolutely does add a lot to compile times (test with SetGetDummy)

Integer ID's?

Would it be possible to have a pair of set_var and get_var-functions that use an integer-index (parallel to str), obtainable by some get_idx function? Maybe also have a macro that can resolve this at compile-time?

This could be implemented by wrapping the memory-offset (using https://crates.io/crates/memoffset ?) in a CvarHandle<T> {offset: u16} struct with an impl PartialEq, where T is the source-type... thus never exposing the actual offset to the library user.

Aliases

Aliases would allow users to save typing and one cvar could have multiple names for users coming from different engines used to different names.

Add support for `pub(crate)`

Currently we hardcode pub in the generated code, which means making the Cvars struct pub(crate) gives an error about leaking a less visible type in a public interface.

Feature: Commands

  • Built-in - help, cvarlist, search/find/apropos, cmdlist ...
  • User-defined - just call a hook function and that returns true if handled? Would be nice to be a bit more declarative so they can be listed in help/cmdlist. Avoid making it overcomplicated - define_command function that takes the help message and the hook?

no_std compatibility

There are almost no allocations, might be worth seeing if it's possible to make it no_std compatible.

Would have to conditionally remove get_string since String allocates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.