nim

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

cacheson, in Versions 2.0.2 and 1.6.18 released
cacheson avatar

Looks like this fix for nimsuggest didn't make it in though, so I'm still on devel for now.

insomniac_lemon, (edited ) in What are you working on?
insomniac_lemon avatar

Also on Kbin, I see all posts but the 2 oldest (older Nim version, sortplz).


Not a project (sorry) but installed Naylib (Nim bindings for Raylib) and am not sure what to do (especially for something that I will continue making content for) to have projects I am motivated to do. Some of the issue is that I want an editor for the boring stuff, though I've been thinking about procedural or external assets that might make it bearable. Though not sure if I'll get the type of setup I'm expecting.

I mostly want something not based on textures. So polygons, but I'm not sure if I would be better off making(pasting) a basic 2D polygon editor (or only using basic shapes) and possibly integrating it into a tilemap, or if I should go with basic 3D (possibly with some other 3D tilemap editor?) as I expect that to have better support for vertex/face colors. Also I want the game to be maximizable (particularly without bars, that seems more possible with tilemaps or 3D).

Note that I have lurked with programming for a while, the last thing I did was a simple (92 LoC) game book reader (custom format) with Nim(+Owlkettle) last may. That again was a problem of content.

EDIT: With Naylib I got a triangle that rotates with the mouse wheel (relevant for an idea I had) but now seeing polygons can't do collision like squares/circles(?) (which, not directly related but kind of generally not good).

insomniac_lemon, (edited )
insomniac_lemon avatar

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,
cacheson avatar

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, (edited )
insomniac_lemon avatar

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

cacheson,
cacheson avatar

Unfortunately I don't have much in the way of good advice to give here. My game development experience is mostly limited to the project I posted in this thread, plus a number of ideas that I failed to actually start working on.

insomniac_lemon, (edited )
insomniac_lemon avatar

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.

ICastFist, in Nim v2.0 released
@ICastFist@programming.dev avatar

I’m curious to the reasoning behind moving a bunch of standard library stuff to external packages, listed at the end of the blog post. Faster compiling? Smaller executables? Faster development for each now separate package?

grayrest,

I don’t know the specific motivation here but in general it’s for package development to not be tied to the language release. People also generally have different backwards compatibility expectations for the stdlib vs a regular library and that constrains the development of the package. In Python the meme is that stdlib is where packages go to die. Not all large stdlib languages feel that way. Clojure, for example, has a pretty sizeable stdlib while being code frozen without a lot of demand for change. In general, however, language developers prefer not having things in stdlib.

unquietwiki,

I saw that list, and figured that they were distancing themselves from obsolete encryption (MD5 & SHA-1), as well as remove database management from their scope (which seems like the right move, IMO).

itadakimasu, in Nim v2.0 released
@itadakimasu@programming.dev avatar

I want to love Nim but during my trial run with it. It was a pain in the ass to get set up on my Mac in a way that I could use it easily ie as a repl for quick and dirty prototyping and learning

jim_stark,

Doesn’t MacOS have homebrew that takes care of these things?

itadakimasu,
@itadakimasu@programming.dev avatar

No issue setting up Nim itself (and I realize my complaint is not fault to Nim itself) but it would be great if this complimentary jupyter kernel for Nim would work on MacOS… Hasn’t been maintained in a while: github.com/stisa/jupyternim/issues/38

Would be very useful for my workflow as someone who wants to explore Nim for data science-y type tasks.

Anyone know of an alternative Nim jupyter kernel?

insomniac_lemon,
insomniac_lemon avatar

Not sure about MacOS plus it's not REPL (sorry if that is key), but have you tried faster compilers for prototyping? Such as TCC (Bellard's Tiny C Compiler) as long as performance isn't critical and if you don't need multi-threading.

Clang is also pretty good (for a simple benchmark, the result I got was that Clang with opt:size gives similar performance to plain GCC but with half the compile time). (nlvm is also a thing but I have no idea how that'd compare even to Nim compiling code via Clang)

With some setup, maybe some form of hot code reloading?

itadakimasu,
@itadakimasu@programming.dev avatar

I definitely need to explore more options. Thanks for the suggestions!

sotolf,
@sotolf@programming.dev avatar

I don’t think the jupyter kernel is made by the core developers of nim, it’s kind of weird to call the language pain in the ass because of one weird niche usecase being hard to set up :)

itadakimasu,
@itadakimasu@programming.dev avatar

Agreed. Not fair to Nim for sure.

janAkali,

Try inim.

It’s not perfect, but closest thing to repl.
I use it all the time for very small experiments.
Installation should be as easy as:


<span style="color:#323232;">nimble install inim
</span>
cacheson, in Nim v2.0 released
cacheson avatar

It seems like maybe there are some new features that weren't in the previous release candidate? I don't remember default values for objects being a thing. Maybe just me though?

ICastFist,
@ICastFist@programming.dev avatar

That is a new and welcome change, in my opinion. I have a bit of experience with Nim and when you defined a type (object), you couldn’t define default values. The workaround was making or overloading a new() function with default values instead.

cacheson,
cacheson avatar

Oh, yeah, don't get me wrong, I like the change. I just figured the difference between a release candidate and the actual release would just be bug fixes and such.

potatoBoy, in What are you working on?

Spending a bit of time cleaning up my libraries and adding features before the new uni semester starts

Hoping to fix this big bug in my validation library and then publish it to nimble. Also working on a testing framework that has similar API to std/unittest but have better diff printing (since trying to read test failures is a pain at times)

cacheson, (edited ) in What are you working on?
cacheson avatar

Edit: Did you know that if a post or comment fails to propagate, editing it will force a retry?

Here's mine: https://github.com/chrisacheson/crnstc

It's intended to be a "traditional" (neotraditional?) roguelike with a cyberpunk setting. Both the world and the UI are in 3d, which isn't something I've really seen done before. Usually it's either one or the other, like CataclysmDDA having a 3d world rendered in 2d slices, or Jupiter Hell having a 2d world with 2.5d graphics. I figured for a cyberpunk setting, being able to visualize the cityscape is important for the feel of it.

So far it's very much just in an "early tech demo" state. I've implemented basic randomly generated terrain and player movement. I was working on adding line of sight (which gets a lot more complicated in 3d), but ended up getting distracted by the reddit protests and migration to the fediverse. I'll get back to it eventually.

If you want to compile it, you'll actually need Nim 2.0. The .nimble file doesn't currently reflect that.

Edit2: Images attached to comments on kbin don't seem to get copied over to lemmy. Trying this:

https://media.kbin.social/media/39/15/3915a060e227fd686cc11b5ba77d43d845b4fe904926f98001b751f08314e996.png

  • All
  • Subscribed
  • Moderated
  • Favorites
  • nim@programming.dev
  • Durango
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • khanakhh
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • JUstTest
  • cubers
  • GTA5RPClips
  • cisconetworking
  • ethstaker
  • osvaldo12
  • modclub
  • normalnudes
  • provamag3
  • tester
  • anitta
  • Leos
  • megavids
  • lostlight
  • All magazines