Programming thread

  • Want to keep track of this thread?
    Accounts can bookmark posts, watch threads for updates, and jump back to where you stopped reading.
    Create account
Almost everything I write for personal use is a "Microservice". I have a Pi with an AI hat doing YOLO object detection. There's one process per camera that monitors the camera's upload directory. Each of those dispatches the path to any new files to the main YOLO process that does the object detection and reports back. My Z-Wave stuff is now one instance of ZwaveJS writing to MQTT and a locally grown process monitoring that and throwing it into Mysql then Munin coming along and graphing. The MATI transcription stuff is likewise a bunch of random "microservices" aka, shell and Python scripts.
It's the classic unix philosophy, it works well
 
Maybe for you, I can strip the post down to read SWEBOK.
looked this up and it looks like a very arcane buzzword for "common sense any good programmer should know + typical overhead that corporations have to impedance match the programmers with their computer illiterate bosses"
have you read sicp?
 
looked this up and it looks like a very arcane buzzword for "common sense any good programmer should know + typical overhead that corporations have to impedance match the programmers with their computer illiterate bosses"
have you read sicp?

Looks like some childs toy to add to the pile of random ass books that goes over basic programming. Would not even be a reference under the construction chapter.

"modularity and abstraction" fucking lol, and?
 
using actual code. it saves a lot of time, you see: people just have to write it once instead of writing it in a too-high-level-to-be-compiled language and then writing it again as something a computer understands
Or work out the quirks in Ruby then implement more cleanly and low level in C. That's how my favorite personal project emerged.
 
Premature optimization is a pajeet cop-out
getting back on topic, i disagree with this
most code runs in 0.002s (0.001s optimized) so you should never hurt its readability to get the imperceptible difference
this doesn't mean you should write n^2 shitty algorithms that make the computer choke though
and if you have a really tight loop that you can't loosen by improving the algorithm, you should absolutely rewrite it in simd assembly to milk every last bit of performance humanly possible

generally you should shoot for clarity first (easy-to-understand code actually often runs faster*) and then start milking for performance only if you really need it
hopefully you won't need it and if you do you should get a profiler and find out exactly what needs to be optimized
* when you understand what's going on it's easier to improve things
Or work out the quirks in Ruby then implement more cleanly and low level in C. That's how my favorite personal project emerged.
the classic technique of blocking it out in one language and then moving to a different language
a good alternative is actually to keep it written in ruby, but rewrite just the slow parts in c and then prototype some other feature in ruby
 
Looks like some childs toy to add to the pile of random ass books that goes over basic programming. Would not even be a reference under the construction chapter.
Even John Carmack had a hard time with SICP and he came up with this

Of course I disagree with the notion that not getting SICP should be an automatic weed-out criterion but calling it a "child's toy" is an enormous stretch
 
Been job hunting, dealing with jeets, attended my carry class with my sister for her permit renewal. Oh, and state fair.

Anyway, found some time and got the polygon depth sorting working.

Then I cleaned the code up, packaged it into modules, and I have a shitty little repo and demo of it. Most of the interesting part of my work was the (egggame tile-collection) module.

So the basic structure/design is that there's a top level tile-collection structure. A tile-collection contains multiple tilesets. A tileset is just an image that might contain some tiles/sprites you want to render. One unique aspect of this is that a lot of other game libraries will overlay a fixed grid over your spritesheet, whereas in your client code using this module, you need to loop over your grid and pick out each possible sprite separately. This is more tedious if you have sprites in a traditional grid, but it's more flexible in case you have some one-off graphics in the corner you want to grab. When you pick out a sprite, you are creating a tile-spec (basically saying which tileset you're picking from, and the start position and the dimensions).

And then finally you can create tiles from those tile-specs and they'll be rendered by the toplevel tile-collection.

So that's four levels of abstraction:
1. tile-collection
2. tileset
3. tile-spec
4. tile

Using them would look sorta like this:
Code:
(define *tile-coll* (make-tile-collection screen-dimensions: '(640 480)))

(define *tilesets* (tile-collection-add-tilesets!
                    *tile-coll*
                    '((outdoors-1 . "outdoors1.png")
                      (outdoors-2 . "outdoors2.png")
                      (indoors . "indoors.png")
                      (people . "people.png")
                      )))

(define *outdoors-1* (alist-ref 'outdoors-1 *tilesets*))
(define *outdoors-2* (alist-ref 'outdoors-2 *tilesets*))
(define *indoors* (alist-ref 'indoors *tilesets*))
(define *people* (alist-ref 'people *tilesets*))

(define *person-left-spec* (tileset-add-tile-spec!
                            *people*
                            start: '(0 0)
                            dimensions: '(32 32))

(define *tile-1* (create-tile! *person-left-spec*))

;; position it on the screen somewhere
(set! (tile-position *tile-1*) '(200 150))
BTW, there's a technical reason for why you have to add the tilesets all in one go.

So I am implementing the multiple textures in OpenGL as an array texture. Basically, it's a collection of textures, say X by Y and there's Z layers, allocated in one single texture object. This way I'm not hard coding say, 5 textures and hitting that limit at some point. But in order to do this, you need to know what the biggest texture in the stack will be and allocate the array texture to accommodate that up front. It's OK if smaller layers don't use up all the layer, but you need to be able to handle the biggest one.

I'm not sure of a way to dynamically resize an array texture. It's not a huge deal, but it does make the client API a little funky.

As a demonstration of this module, I created a little script that will render files created by the freeware Tiled map editor.

1756525541055.webp

Nothing particularly profound. I wrote bindings for SDL3, glew, DevIL that would need to be compiled. The makefile is pretty basic, and btw it uses the script names for the chicken tools on Arch (chicken-csc or chicken-csi), because that's what I use.

I used a few external chicken libraries I'm used to. Off the top of my head, defstruct, ssax, and filepath.

SSAX is nice, and I think it exists for other schemes too. It's an xml parser and it just parses everything to very easy-to-understand sexprs, and with Tiled's XML format, parsing the level data was very straightforward.

Oh, and I wrote a very simple little 3d matrix math module. The tile-collection has a camera matrix that gets used in its shaders, so moving the camera is just a matter of updating a few entries in its matrix.

The shaders are pretty simple. Just writing out their inputs, and their inputs are just four verts (and associated texture data) for each rect (which is ultimately made up of two triangles).
 
that enterprise java uml software engineering diagram brainrot mongoloid nocoder nigger monkey has been sperging on my profile
he also just followed me
Of course I disagree with the notion that not getting SICP should be an automatic weed-out criterion but calling it a "child's toy" is an enormous stretch
of course it's not an automatic weed-out criterion, i'm not really taking this guy completely seriously lol. i could have used k&r or something instead
the most important part of a "have you read your sicp" test is not whether the subject has read their sicp, it's their response to the question itself

So I am implementing the multiple textures in OpenGL as an array texture. Basically, it's a collection of textures, say X by Y and there's Z layers, allocated in one single texture object. This way I'm not hard coding say, 5 textures and hitting that limit at some point. But in order to do this, you need to know what the biggest texture in the stack will be and allocate the array texture to accommodate that up front. It's OK if smaller layers don't use up all the layer, but you need to be able to handle the biggest one.
i hear good things about atlases but you also need to know about all the textures up front for them too
a bit more complicated too
SSAX is nice
last time i tried to use it it just blew up in my face
my fault though because i was trying to use it on html
I think it exists for other schemes too.
it's designed to be easy to port which is why pretty much every scheme has it
It's an xml parser and it just parses everything to very easy-to-understand sexprs
that's just the xml->sxml default ssax parser, iiuc you can set up your own special parsers that skip the conversion to sxml entirely
and that's why it's called ssax, because it's a sax parser for scheme
 
a good alternative is actually to keep it written in ruby, but rewrite just the slow parts in c and then prototype some other feature in ruby
I'm not a programmer. I once was working on a project to query data from a database, the db field was like 0-100, but we wanted the user to be able to say "0-17 are color 1, 18-33 are color 2...." Doing this in SQL was painfully slow. The DB was directly connected to the output code which was a product we were using so we couldn't easily change it there. The DB we were using allowed embedded C and it would load the library file into the DB and you could call it like any other function(). So I did that, the query became function('13|33|47|55|100',fieldname) with the ranges provided by the user and the C would cache the computed range information to avoid parsing the ascii each time and output the proper color number for each row. It was fast as hell and a bunch of fun to write.

And this is why I'm no longer allowed to program.
 
that's just the xml->sxml default ssax parser, iiuc you can set up your own special parsers that skip the conversion to sxml entirely
and that's why it's called ssax, because it's a sax parser for scheme
Yeah I'm aware there's a lot of elaborate theory to xml and related tools and you're supposed to be able to do a lot of neat shit with. Again, in theory. I never bothered with learning all the theory because at times it gets so verbose it makes my teeth itch.

But as is, just the basic xml->sxml parser is really nice to work with.
 
Yeah I'm aware there's a lot of elaborate theory to xml
xml is just a retarded form of s-expressions and many of the neat tools are just other bits of lisp
sax feels like read, turned inside out
But as is, just the basic xml->sxml parser is really nice to work with.
it's probably not as efficient as a custom ssax parser and can't stream process 400gb of xml, but it doesn't matter because this is gay initialization code that will run once every 30 minutes and process a grand total of 400kb worth of xml files over the entire program run time
 
I think a sign that I'm getting old is that I seem to be moving back towards physical stuff. I can't seem to stop buying whiteboards. I buy another whiteboard, telling myself that I'll erase the stuff on it as soon as I finish the thing I'm working on, but in order to finish that thing, I have to code another thing it's dependent on, and I don't have enough space on my whiteboards, so I buy another whiteboard. I'm up to four whiteboards and am trying not to buy a fifth.

Having a physical calendar is also a cool way to shame yourself into getting stuff done.

Also yeah I don't know what that dude was huffing, who comes into a programming thread to tell the programmers in the programming thread that they should try to set a life trajectory to stop programming as soon as they can? I don't think someone who thinks like that has ever been truly passionate about something.
 
Last edited:
Also yeah I don't know what that dude was huffing
he is indian so i know what he was huffing: cow shit
who comes into a programming thread to tell the programmers in the programming thread that they should try to set a life trajectory to stop programming as soon as they can? I don't think someone who thinks like that has ever been truly passionate about something.
good saar trying to get his certification so he can do the needful
 
Back
Top Bottom