I’ve finally managed to join this community from kbin, seems we were having federation problems with programming.dev.

So anyway, what sorts of projects are you all using Nim for?

Edit: Post isn’t propagating. Maybe this edit will help?

  • insomniac_lemon@kbin.social
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    Hey, I created something. It’s like XPM but instead it’s to define polygon vertices in the proper order. I have a text file (first line is number of verts, 0 is origin):

    11
    
           1        
    
    3             9
    
         2   A      
    
           0        
        4     8     
    
           6        
    
    5             7
    
    

    Code and result in attached screenshot.

    I’m not sure how practical it is (rotation, collision, resized-window-friendly placement etc.) or if I’d be better off with something else (that allows vertex colors too? Godot4 would be ideal if the bindings were there, here’s an animated eye I made with Godot4).

    For the format though it might be better if I could have it in the code file (can I have a 16x16-or-bigger matrix?) rather than reading line-by-line. And either way it’d look better with a truly square font (see also Square is a TTF font intended for roguelike games).

    @cacheson

    • cacheson@kbin.socialOP
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      Huh, that’s cool. My own experience with this stuff is pretty sparse. I learned a bit of OpenGL 2.0 about 20 years ago, and never quite got to the point of understanding model files. My “models” were just arrays of 3d vertices that I adjusted by hand.

      OpenGL 3.0 and onward are totally different from 2.0, so I had to basically relearn everything. Mostly I used these videos to get caught up, though I didn’t get all that far in. One of them covers Blender OBJ model files, though that may be too heavy for your purposes. Are you just doing 2D? I’m not aware of any formats for that… SVG maybe? Also likely overkill. You might be able to make 2D stuff in Blender, but I’ve never used it.

      • insomniac_lemon@kbin.social
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        7 months ago

        Hey, small update I did end up trying a 3D style with vertex colors (no textures needed).

        Office plant, right is decimated (only somewhat)
        (I have uploaded 2 other images as threads so far, banana+peel and a scene with cartoonish UFOs and a badger+mushroom… also my new avatar)

        I tried it with Naylib but vertex colors don’t render properly. It seems to me like there may have been a Raylib regression unless there’s something wrong or something I need to add to my own code. And that’s using OBJ.

        Godot 3.X could work, but there doesn’t seem to be a way of importing that gives everything a common material aside from manually assigning them to every instance (unless there’s a trick, perhaps mesh library that works without a gridmap, that I’m missing). Though I suspect multiple materials (say if I wanted matte+metal+glass) in one object that might be more difficult to have happen on import. With Naylib I should be able to export models without a material at all, at the very least.

        EDIT: Also if this doesn’t interest you (though it seems like it’s right in-line w/OpenGL) a small thing to add is that it’s neat how Kbin shows the other threads w/the same title as a crosspost. I’m not sure if I noticed it before, but it really works here.

      • insomniac_lemon@kbin.social
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        7 months ago

        I want something that’s: 1. easy-to-create (in-engine+GUI particularly) 2. High-fidelity (scalable+not-resolution-dependent) 3. Low-data
        Interactivity/dynamic stuff (also good aesthetic) is a good bonus. Godot4 has all that (though some of the editors+features could be better) but again, no Nim bindings just quite yet.

        I am not too good with Inkscape (compare my avatar–a quick attempt to mimic polygonal style–to the animated eye example) but the problem with SVG is that in most context it’s rasterized (so a lot more limits and considerations). If there was a tilemap system that live-rendered SVGs, that’d be perfect.

        I’m not chained to 2D, just simpler and thought it might be better to learn (and I do like polygon aesthetic). Not too versed with Blender either*, though I have thought about going that route (simple untextured models) or maybe even a different model program. Same for 2D via 3D models (planes) imported into a 2D engine (Godot allows that, but then you’re losing the benefits of in-engine polygons like animation etc). Godot also has a gridmap and decent+easy visual options (materials+lighting+SDFGI) that could help out with (mostly) textureless models. Though in fairness, I haven’t really looked at Raylib’s 3D capability/options yet.


        To be clear, when I said ‘something else’ I was wondering about other frameworks such as SFML or SDL etc (on Linux) and their (higher-level) polygon capability. OpenGL is way beyond me.

        Other frameworks particularly because what I’ve made isn’t actually specific to Raylib. I could put it in its own file and import+call it, so long as whatever else it is used in will accept a sequence (of vector2 values).

        I might be able to make an editor, too (at least one that functions within the constraints of my format), or at very least a library viewer**. Though I still haven’t made anything game-like yet (admittedly this format is a very similar concept to the gamebook format I mentioned, but a lot simpler “content”) so that puts it in perspective.


        *= have made a few models with it, though disliked the issues with modifiers and often preferred the Maya setup where everything was nodes (not that I can afford Maya, not used it in 10+ years)

        **= like 8 polygons on-screen and you choose what it’s loaded as, and a step up from that would be a tile-map