by baggers
Hey again, I've been on holiday and I decided that, even though it was a staycation, it would be a holiday from all obligations (and everyweeks fell into that pot it seems).
[EDIT]
I tried to keep this kinda short and failed so hard. Sorry :/
I had a set of mindstorms that I had only played with a little so I got the IDE set up and got cracking. Got a little arm and controller going. The visual programming language means it's got such low information density though and working via the mouse felt painfully inaccurate.
Good experience but was to dig into the lower level code sometime.
Got a couple of PRs into this project
Non glitch-free observables seem odd to me now, especially after reading more of the inventors views on what it should be (continuous, denotational), Cells isnt that either, but it doesnt feel like a stream at all, just like a spreadsheet instead.
With all the above in place I can, in about 30 lines of code, take a single-header library as source and have the lisp build system:
Example project here: https://github.com/cbaggers/raw-bindings-nuklear
After getting the bindings for nuklear generating to my satisfaction it was time to make it nice to use. I had already been hacking around with the basics so it didnt take long to come up with a ok API.
It is very macro based and feels 'heavier' that regular lisp code. This is by design, I wanted the UI to feel more like an artifact, a language of it's own that mixes with regular code, but cant be thrown around as easily as regular functions...hard to explain as it's a feel thing. But it is ok to write and extend at least!
Here it on github and here it is working on OSX and Linux:
In the linux one you can see some of the code that made the bigger of the windows.
Been watching a bunch of talks recently
I'm sure there were some more. Anyhoo I very much like some of the ideas:
avoid world modelling. Ask yourself the question is this subclass (whatever) for the datastructure's sake or a story Im telling with the data. It should always be the former. The example I liked was StaticChair
, PhysicsChair
& BreakableChair
shouldnt be in type related as they are entirely different in data & behaviour from each other. What they have in common they had with MANY other game objects.
The CPU is spending half it's time idling waiting for cache. Thought in data-structures can help this.
Efficiency is about doing less (algorithms), Performance is about doing what you have to do fucking fast (data-structures)
Also the feeling I get is a lot about keeping things flat and simple where possible.
I feel the speakers are naturally biased in favor of these things (Mike Acton can be a real arse on the subject), but there are some good takeaways I can use in my low level stuff to make sure I can piss cycles away in the high-level fun bits.
I live in a tiling window manager and wanted something similar for GL. The idea is to be able to split the screen into any number of frames that you can either render into, or attach textures that it will render for you.
If you have used emacs you know the drill.
So I made that, I have no good screenshots yet as it's very WIP but will do another day
Whilst profiling the UI library above I noticed some places I was unnecessarily allocating memory. It's turns out that my compiler doesn’t yet store pointers 'unboxed' in structs so I was hitting a lot of places the pointer was getting type tagged/untagged.
I talked to a couple of guys on the compiler team and they have this on their todo list and in the mean time I can user a machine-word. This will work for all architectures..except Alpha :D so I don't think that is a problem (though the compiler doesn’t support this!).
To aid working with this I made a simple library which uses machine-word on SBCL and pointer everywhere else.
This has helped me chop down large amount of unnecesary garbage for the GC to handle.
One more bit of love for this compiler.. its type system is just so fucking cool, it's a dynamic language with a crazy type inference engine, with some dependent-type magic in there too. So take this case:
I need to call glScissor, it takes floats. Now I have a x position (float) from my UI window and a scale (32bit int). I multiply them, however my compiler (correctly) doesn’t know if this will be a number than can fit in a single precision float. But I can just do this
(declare (type (single-float 0s0 #xffff) x)
As I know that my window won't on a screen 65000 pixels wide. Now the compiler KNOWS it can safely use a faster multiply
I think that's cool, also this is optional stuff, unless you tell it to, the compiler does the safe thing.
Been doing some other things I've been putting off
I saw King Crimson live the other day, which was mental. 3 drum kits at the front of the stage, truly mindbending noise coming out of that band. Nice to see them before they start dying.
Also went and had 2 sessions in a floatation tank, which is essential sensory deprivation (no light, no sound, floating in body temperature salt water...so no touch). Was very relaxing of course but in the first session at about the 50 minute mark I started thinking on some code and the clarity of the thoughts was alarming to me, 10 seconds and I had the answer to stuff I'd been musing about for ages. Didn’t work as well the second time, but there were a number of variables I had changed so I need to tweak those in future sessions.
Also just been working at coffee shops more. Worked well in 9-10am slot to get a bunch of ideas in place before heading home to really hammer on code. Was nice, must do this more.
I haven’t touched on general RnD stuff I have been doing for upcoming projects yet...but this is toooo damn long
Goodnight all, thanks for wading through this crap :D
Last Edited on Mon Oct 03 2016 18:14:00 GMT-0400 (EDT)
I have always wanted to try a flotation tank! That must have been a great experience! I'm not much of a coder so I really don't have much to comment on for your projects, mostly because I don't understand them :P. I am rather jealous of your kayak adventure tho, I haven't had mine out all year :( ... summer is gone. Hope you had a good vacation!
on Mon Oct 03 2016 20:49:17 GMT-0400 (EDT)