• 9 Posts
  • 120 Comments
Joined 1 year ago
cake
Cake day: July 2nd, 2023

help-circle


  • If you only need it for the interface, a shit workaround would be to prefix all text with an RLM (RIGHT-TO-LEFT Mark).

    Unfortunately no, I expect users to enter Arabic text as well.

    Fast iteration is already fixed by using cranelift in your release-dev profile (or whatever you want to call it), and mold as a linker.

    Maybe, I didn’t try that before, but I don’t expect Cranelift to match the speeds gtk-rs is currently giving me; Cranelift also doesn’t solve the problem of rust-analyzer acting crazy.

    Okay, something helpful instead: Did you try asking in the rust:gnome.org matrix room mentioned in the project page?

    No, I prefer public posts to prevent effort duplication, so much so that my mind started filtering out such things on project pages, but thanks for reminding me.


  • Before anyone suggests another library:

    • Iced and Egui both can’t handle Arabic, which is a deal breaker.
    • Iced takes forever to compile and iterate, maybe that’ll be fixed with dynamic linking.
    • Relm: I didn’t know it existed before I started this project.
    • Qt bindings: IDK I forgot Qt existed, I was always more of GNOME* guy.
    • I am already pretty deep into this project, and don’t want to learn something else for now.

    * GNU Network Object something Environment








  • Doods@infosec.pubOPtoBevy@programming.devOpenGL 1.5 support?
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    3 months ago

    Google says you have a Core i7-620M,

    No, I have an I5, it even has a sticker, but my I5-7500 desktop has an I7 sticker, so stickers aren’t reliable. (I have better evidence than the sticker, trust me)

    that’s a Westmere, first-generation Intel HD Graphics, provided everything is configured correctly you should have OpenGL 2.1.

    I rechecked 1-2 days after making the post, and Mesa reported 2.1 & 2.0 ES, which is consistent with techpowerup, that website never failed me even when I failed myself.

    …and, no, you probably really, really don’t want to use OpenGL 1.x. If your implementation supports shaders at all then it’s going to be some vendor-specific non-standard thing. If you want to do anything 3D then 2.0 or 2.1 is the bare reasonable minimum (2.1 gets you PBOs).

    I think shaders are a 3D-only thing? which shouldn’t be useful for an isometric game. My favorite game runs on DirectX 3.0a, so I 1.x should work, I guess?

    Also I will look up PBOs, that acronym looks cool!

    If you’re doing 2D well I don’t think it would be wrong for bevy to have a 2.5D engine that…tightly-timed assembly at that, once upon a time it was considered impossible to get smooth side-scrolling on VGA cards – until Carmack came along…

    about 1-1.5 weeks ago I watched some Johnathan Blow hating on programming paradigms and game engines, and to be honest, I had already been viewing pre-built engines as things that produce games that are… familiar… they lack souls, integer/buffer_overflows, and their physics are too well-made. I understand the benefits of a prebuilt 3D engine; I played a 3D game on DOSBox and saved before every jump - except the ones that got me stuck in a wall, in addition to an indie 3D C++ mess on Itch (it’s the only game I am excited for its release at the moment, as it’s still in beta).

    I also saw an attempt at using SDL as a Bevy renderer-backend on Github, and there were problems according to the README.md, but I had lost interest by then, because…

    After watching much JBlow, I came away with 3 things:

    1- OpenGL isn’t worth learning anymore, but don’t use SDL to abstract yourself from it, use raylib. That’s his opinion, so I decided to build my engine on Macroquad, a raylib-like thing, as using rust-bindgen feels un-ergonomic.

    2- ECSes and other pre-forced paradigms are meaningless, just write the game.

    3- He doesn’t like Rust, which I ignored.

    You might think Rust is a bad choice if I like overflowing things, as Rust is safe, but before you is something I wrote semi-seriously (I say “semi-” so I don’t get laughed at) a day or two ago:

    let mut key = Key::new(500.0, 500.0, 50.0, PINK, unsafe {
            let x = &entities[9] as *const Box<dyn Entity> as *mut Box<dyn Entity>;
            // SAFETY: This is straight up undefined behaviour, I have a solution
            // that is better, simpler and safe, which is seperating the entity list
            // and `GameContext`, but I wanted this to exist in the git history.
            //
            // And before I sleep and forget, the way is passing `&mut door` to
            // `update()` manually, and passing `entities` to `walk`.
            //
            // A `RefCell` wouldn't have complained at runtime anyway.
            #[allow(invalid_reference_casting)]
            &mut *x
        });
    

    As you can see, using anything remotely similar to Arc<Mutex<T>> would get me accused of having skill issues, which is extremely bad considering I am one of those ‘I use NeoVim/Colmack-DH/Rust/Linux BTW’ people, so I prefer extreme measures, AKA just regular-C-code style of writing, so it won’t be long before I meet some REAL undefined behavior.

    If you’re interested in my little project, it’s about a yellow square in rooms of yellow walls, which I planned to write in 3 days, which I finished today, a few hours after Fajr prayer, one week after I set the deadline to 3 days.

    Time to add a 3D turn-based combat system to it for reason, I first need a flat yellow cube, and some doom-like fake-3D enemies.

    In case you’re into the arcane craft of the elders, here’s a book.

    Thanks, I wish to write assembly sometime down the road, and discover these treasures of knowledge.

    Edit: in case you’re wondering how I solved the code problem, I started thinking and realized that I wanted to pass a &mut T to Key.Update(), but I was also holding a &T inside of GameContext, which is impossible in safe Rust, so I changed it hold a &mut T instead.

    They say: “Make it work, then make it right, then make it fast”, but maybe they didn’t mean jumping to unsafe when they said “work”.

    Edit2: I forgot to say something about prebuilt engines. In addition to creating an inconsistency between quality of the engine (physics and UI interactions), and the quality of the game-specific code, they are also very bloated and that’s reflected in binary sizes and the performance penalty of being a general-purpose engine.

    Macroquad is also an offender of this, as a mere cargo add bloats the release binary up to 70 whole Mibs, but I managed to shave off 10 Mibs in a few hours by cloning the repo and “forking” Macroquad and it’s huge math library, grim, and “de-bloating” them, and my game would still compile fine, so there’s much room for optimizing the binary size, as well as performance, since I am low-level enough to implement my own delta time.

    Also I am crazy about performance, which can be traced back to trying to run games on an HP compaq DC 5800 for 4 painful years, whose GPU is even worse than the laptop’s.

    PBO








  • Doods@infosec.pubtoProgrammer Humor@lemmy.mlgot him
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    6 months ago

    I just got some idea yesterday regarding impl blocks, ready to be my respondent?

    I had a big impl block with 4 levels of indentation, so I cut the block, and replaced

    impl InputList {
        //snip
    }
    

    with mod impl_inputlist; and moved the impl block to a new file, and did not indent anything inside that block.

    The advantage this has over just not indenting the impl block in place, is that people will have difficulty distinguishing between what’s in the block and what’s outside, and that’s why the impl was moved to its own exclusive file, impl_inputlist.rs

    Maybe I am overstressing indentation. Ss there something wrong with my setup that prevents me from accepting 4-space indentation?

    I use:

    Editor: Neovide

    Font: “FiraCode Nerd Font Mono:h16” (16px fonts are addicintg)

    Monitor: 1366x768, 18.5 inch, 10+ years old, frankenstein-ly repaired Samsung monitor.

    Distance: I sit at about 40-60 Cm from my monitor.

    That leaves me with a 32x99 view of code excluding line numbers and such.


  • Inaccurate report,

    I just ran Neovim in terminal and was used to Neovide, so I thought it was choppy.

    Intel HD 630.

    There is, however, a 2D game - which I am not going to disclose the name of - that’s pretty broken. (It uses Adobe Flash as an engine)

    Also the steam client doesn’t maximize properly with tiling but I am sure that’s reported.

    I have been daily driving Cosmic for a week now; it caused me Arch-syndrome, everyday I run sudo apt update hoping to get some polish to the desktop.

    Edit: there’s more…

    Neovide’s transparency is completely broken, and shows a blank, though not a pitch black, color and screenshotting it results in seeing the text with a checkered background. (In the resulting screenshot only) (Running on Proton 8.0-5)

    clipboard=unnamed plus, the setting supposed to unify Neovim’s clipboard and system’s, doesn’t work. clipboard: error : Error: target STRING not available

    I also was unable to transfer a file to my phone using Cosmic Files, but Nemo worked, though I read that’s fixed in some Blog.

    Edit II: I just discovered popdev:master it seems to be a general unstable branch instead of just Cosmic things, but I took the risk and added it, I just have to remember to remove it once 24.04’s released


  • Doods@infosec.pubtoProgrammer Humor@lemmy.mlgot him
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    6 months ago

    Formatters are off-topic for this, styles come first, formatters are developed later.

    My other reply:

    How about this one? it more closely mirrors the switch example:

    match suffix {
    'G' | 'g' => mem -= 30,
    'M' | 'm' => mem -= 20,
    'K' | 'k' => mem -= 10,
    _ => {},
    }
    

    How about this other one? it goes as far as cloning the switch example’s indentation:

    match suffix {
    'G' | 'g' => {
    	mem -= 30;
           }
    'M' | 'm' => {
    	mem -= 20;
           }
    'K' | 'k' => {
    	mem -= 10;
           }
    _ => {},
    }
    

  • Doods@infosec.pubtoProgrammer Humor@lemmy.mlgot him
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    6 months ago

    How about this one? it more closely mirrors the switch example:

    match suffix {
    'G' | 'g' => mem -= 30,
    'M' | 'm' => mem -= 20,
    'K' | 'k' => mem -= 10,
    _ => {},
    }
    

    How about this other one? it goes as far as cloning the switch example’s indentation:

    match suffix {
    'G' | 'g' => {
    	mem -= 30;
            }
    'M' | 'm' => {
    	mem -= 20;
            }
    'K' | 'k' => {
    	mem -= 10;
            }
    _ => {},
    }
    


  • Doods@infosec.pubtoProgrammer Humor@lemmy.mlgot him
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    6 months ago

    A single match statement inside a function inside an impl is already 4 levels of indentation.

    How about this?

    The preferred way to ease multiple indentation levels in a switch statement is to align the switch and its subordinate case labels in the same column instead of double-indenting the case labels. E.g.:

    switch (suffix) {
    case 'G':
    case 'g':
            mem <<= 30;
            break;
    case 'M':
    case 'm':
            mem <<= 20;
            break;
    case 'K':
    case 'k':
            mem <<= 10;
            /* fall through */
    default:
            break;
    }
    

    I had some luck applying this to match statements. My example:

    
    let x = 5;
    
    match x {
    5 => foo(),
    3 => bar(),
    1 => match baz(x) {
    	Ok(_) => foo2(),
    	Err(e) => match maybe(e) {
    		Ok(_) => bar2(),
    		_ => panic!(),
    		}
    	}
    _ => panic!(),
    }
    
    

    Is this acceptable, at least compared to the original switch statement idea?


  • Well, what I meant was just rustfmt’s default with:

    • 80 character line
    • 8-space hard tabs

    In addition to naming local variables short names, and soft-limiting functions to 48 lines long & their local variables to 5-10 (you know, normal reasonable things)

    The part about switch statements doesn’t apply as Rust replaced them with match.*

    The part about function brackets on new lines doesn’t apply because Rust does have nested functions.

    The bad part about bracket-less if statements doesn’t apply as Rust doesn’t support such anti-features.

    The part about editor cruft is probably solved in this day & age.

    The rest are either forced by the borrow checker, made obsolete by the great type system, or are just C exclusive issues that are unique to C.

    I left out some parts of the standard that I do not understand.

    I just skimmed through the Rust style guide, and realized the only real difference between the 2 standards is indentation, and line length. Embarrassing.

    *: I experimented with not-indenting the arms of the root match expression, it’s surprisingly very good for simple match expressions, and feels very much like a switch, though I am not confident in recommending to people.

    Edit: How did I forget?! Indentation is limited to 3, increasing code readability.