Author Topic: s4k  (Read 9098 times)

0 Members and 1 Guest are viewing this topic.

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
s4k
« on: February 19, 2012 »
[have been thinking/doubting, back and forth about posting this, feels a little too much like shameless self-promotion.. but finally decided to just jump into the deep water, and see what happens..]

a mixture of a sneak-peak and a mock-up, of what i've been doing lately.. it's early, it's work in progress, lots of things will change and twist as i go on..but it feels like it's flowing in the right direction..



so...

  • it's mainly a hierarchial tree/graph system, and a script/expression parser, inspired by what blueberry is talking about here (http://www.youtube.com/watch?v=9b9xuRfooXM) and here (http://zine.bitfellas.org/article.php?zine=13&id=9), and some other ideas
  • the editor thing shown in the screenshot, is just something i threw together in lazarus in an hour, took a screenshot of, and then colorized a little with gimp.. messing around, experimenting, trying out things, to see if my ideas would be doable, and practical.. so it's not a working thing, but an idea, a prototype..
  • the 1136 bytes final exe is from a test thing with a few simple expressions and procs/callbacks, for testing, but it does the main work with tree/scene-parsing and expression evaluation.. and its compressed with crinkler of course..
  • some simple code is in there (but not used for anything yet), for glsl shaders (compile/select), textures (upload/select), meshes (display lists/glu), ..
  • also, i have an ugly, simple synth, but i hope to use the tree/graph system for the music/synth too..
  • it should be more or less prepared for easy porting to linux (etc), but i haven't given that side much effort yet, just tested a little with gcc/mingw..
  • i'm considering releasing everyting as some kind of open source project, but i might want to make something with it myself first, and see if the ideas work...
  • and then i have to come up with some actual effects. and music... :) 

- axon
(is the handle 'axon' still available?)

oh,. and this is my forst post here (excluded the 'hello world' during registration), so please be easy on me if i do something wrong, or break any rules or whatever ... i'm just very eager to get back 'into the scene'  ;D

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: s4k
« Reply #1 on: February 19, 2012 »
It's always good to hear what other sceners are up to, even (especially) if it's something new and still prototypey.
Get it out in the open and you are sure to share some good ideas.

Jim
Challenge Trophies Won:

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #2 on: February 19, 2012 »
ok, zipped up the sources and put them here:
http://dl.dropbox.com/u/41070669/s4k/s4k_v0.0_19.feb.2011.zip
yes, the year in that filename is wrong.. :-/
they're a bit messy at the moment, right in the middle of some more testing and experimentation (as always).. and, didn't include the msvc project files.. next time..

i'll be glad to hear any comments or suggestions or complaints, or whatever..

Offline ferris

  • Pentium
  • *****
  • Posts: 841
  • Karma: 84
    • View Profile
    • Youth Uprising Home
Re: s4k
« Reply #3 on: February 21, 2012 »
This is a fantastic project :) Duckers/Outracks and I are doing something similar for synthesis using a graph compiler for signal routing and a vm-based synth, but it only applies to music.

Keep us posted; I'd really like to see where this goes :) .

Also, we should talk about a Trondheim pubmeet :D Lots of sceners here; Duckers, Mortzerr, Neuratix, Quisten, Zeila, Wic, myself.. the list goes on :)
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #4 on: February 22, 2012 »
This is a fantastic project :) Duckers/Outracks and I are doing something similar for synthesis using a graph compiler for signal routing and a vm-based synth, but it only applies to music.

Keep us posted; I'd really like to see where this goes :) .

thanx

been thinking a lot about the audio/music part lately.. my 'problem' is that the synthesis stuff (phase-modulation/distortion, waveguide, perhaps formants/phonemes), and the number of voices i have in mind, would need quite a few state-/config-variables per voice, so i'm experimenting with how to do that with only 256 'virtual registers' (and a stack).. banks of such registers, and/or sub-graphs is some of the ideas i'm playing around with.. but then, i don't want too much pointer-juggling in there either... so, we'll see.. currently i can have a callback func/proc to update each voice, so perhaps i should postpone the audio stuff until the other things are more mature..

also, i'm re-organizing things a little, trying to make it smaller, and also to make it easier to also compile a dll, so i can make an editor (or a vst plugin) in any other language/ide (like pascal/lazarus, or whatever)..

will post updates when i have something new..

your synth project, is that strictly private, or are you open for discussing ideas?

Also, we should talk about a Trondheim pubmeet :D Lots of sceners here; Duckers, Mortzerr, Neuratix, Quisten, Zeila, Wic, myself.. the list goes on :)

i have to be a little bit careful about what i plan/promise, because of my health, but that would absolutely be cool !!

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #5 on: February 24, 2012 »
aanndd.. a blog entry here, with some more new things..
http://torhelgeskei.blogspot.com/

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #6 on: March 01, 2012 »
the tool for setting up the graph/vm is progressing..
next up is making it interact with a real, running graph/vm
(the data in the screenshot is just a test i use while coding the editor)



Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1217
  • Karma: 230
    • View Profile
    • Homepage
Re: s4k
« Reply #7 on: March 01, 2012 »
Looking really interesting axon, should be a very usefull demo tool!
www.kirl.nl
Challenge Trophies Won:

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #8 on: March 13, 2012 »
a lot of progress on this project, but i didn't want to spam the forums, so i haven't posted every little update here, only on my blog... the editor is getting into shape.... i can now completely edit a graph, its hierarchy, and all its connections, expressions, conditions, callbacks, etc, 'compile' the scripts and other lists, and run it, all from within the editor.. also, there's a opengl preview window, so now i can start doing proper intro specific code, play with glsl, mess around with audio and synthesis code, etc.. last few things currently being added, are load/save project file(s), and export to .h... planning a "how it works, behind the scenes" type of post.. and as soon as i have added project load/save, i will post a binary, so you can test the editor yourself.. but i am still debating with myself about how to release the final, finished project... a fully opensource thing, or the editor exe and playback routines only (libs or sources)... input and suggestions and comments welcome..  another screenshot below, but it's a few days old, so quite a lot of things have already changed since i took it...



- axon


Offline ferris

  • Pentium
  • *****
  • Posts: 841
  • Karma: 84
    • View Profile
    • Youth Uprising Home
Re: s4k
« Reply #9 on: March 13, 2012 »
Simply wonderful :)
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #10 on: March 18, 2012 »
more progress.. load/save, shaders, textures, bitmaps, meshes, timing, (primitive) procedural texture generation.. i doubt anybody will understand much of the editor without a walkthrough of the s4k 'engine' (coming soon, when things get a little bit more stable), but here's an .exe if you feel adventurous.. it's not too stable yet, shader compilation when preview window is closed crashes (gl context vs fltk)...  almost no error checking or anything is done.. so you can easily make infinite loops, or callbacks with null pointers.. and, you might need msvcr100.dll.




Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: s4k
« Reply #11 on: March 20, 2012 »
This looks really cool.  I downloaded it to play around a bit, and I have no idea what I'm doing. 

Any chance of a 2 minute 'getting started' explanation?
Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: s4k
« Reply #12 on: March 20, 2012 »
Looking great axon. Very interested to see what can be created with this :)
raizor

Challenge Trophies Won:

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #13 on: March 20, 2012 »
@all: thanx for all encouraging comments!

@voltage: working on it.. i hate writing docs and instructions, so, unfortunately it takes a little time, to get something that is understandable for other people than myself.. a day or two, and i'll try to come up with something..

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: s4k
« Reply #14 on: March 21, 2012 »
I'm trying to figure it out by your screen shots....  Even some saved examples to work with would be helpful... maybe even preferred.

I can't produce any output from it.

See attached screenie... I tried to copy your screen shot, but there are parameters that I can't see.

Challenge Trophies Won:

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #15 on: March 21, 2012 »
whoa. just being able to actually edit something without any instructions is impressive :-)

ok, well, this it my (probably) fifth attempt at writing something about it, i know it's necessary, but words doesn't come out as i think them inside my head, especially not in a foreign language, and things are still a bit abstract.. so... it became a lot of babbling, confusing more than explaining.. being ashamed about it, i wanted to delete this completely, but decided to "ow, fuck it", and post it anyway.. better than nothing, eh? as mentined everywhere else, ask about anything if you want to know more..


< waffle[varies] this, and calls the son/bro either conditionally, a number of times, or other things...more on that later..

in the editor (the large grid), nodes are the colored blocks, son-nodes are below, and brothers to the right of each node.. a black line either at the bottom or the right inside the node indicates that this assumption is not valid for that node.

so, that was the traversal. but just parsing through the graph's nodes doesn't do much, that's what the node type/arg is about.. there are a bunch of node types for influencing the parsing:

- empty
  return to the caller, exit/quit the graph parsing, finito

- noop
  nothing, just call son/bro
 
- proc
  callback function
  arg : proc-index (array of pointers to callbacks)
 
- expr
  script/expression
  arg : list-index (array of pointers to lists of bytes)

- cond
  conditional, just like scripts, but after its execution, if the top of the stack is positive, the son is called, else the brother
  arg: list
 
- repeat
  call son a specified number of times, before calling brother
  arg: number of times

- loc
  set location (like a bookmark)
  arg: loc-index
 
- call
  jump to location (bookmark)
  arg: loc-index
 
- [cycle]
  deprecated, because of some changes in graph parsing
  arg: number

- [pattern]
  deprecated, because of some changes in graph parsing
  new ideas are bubbling, so it will be re-introduced, but slightly different
  arg: list

- wait
  calls son only every x time
  arg: num

- poly
  'polyphonic registers'
  mainly for
  call son for every polyphonic voice (or layer, can be used for other things than audio), but switches 'polyphonic register bank' before calling..
  more info later, as this is still in the baby-stages..
  arg: num

- voice
  same as poly, but one specific voice/layer
  arg: num/voice
 
the rest are (mostly?) open-gl specific nodes... i wanted these to be 'callbacks' originally, so that nodes were only for traversing the graph and handling array indexes, procs for calling functions/code, and expression for doing math with floats..
but, they need a parameter (shader number, etc), and callbacks have none (the byte arg in proc nodes are used for selecting which procedure).
but, there are some ideas bubling around, so these may change...
 
- vertex shader: define vertexshader
- fragment shader: --"-- fragment shader
- compile compile: compile currently selected vertex/fragment shader
- select shader: select/use shader
- init texture: init texture with last selected bitmap
- select texture: use texture
- render target: not finished...
- begin mesh: start mesh definition..
- end mesh: finalize mesh
- render mesh: and render it
- init bitmap: procedural generation, two for loops /x/y) is being run, and the son node is called for each pixel. scripts have access to the X/Y for the current pixel (0..1), eventually the result for a previous script, and save the result to R,G,B,A registers..
- select bitmap: not much use yet...

as you can see, there's a lot of "work in progress", half finished stuff, etc...

the final thing that need explanation, the expressions/scripts:

this is like a tiny, simplified virtual machine, parsing bytecode, the vm has 256 virtual registers (an array of floats), and a data-stack.. and that's it, really
the various opcodes available in expressions (and conditionals):

push/pop: for moving floats between the stack and the registers
add,sub,mul,div,sin,cos,rand etc: do some math on the top-of-stack values
dup, drop, rot, etc: manipulate the stack

---

so, that was a little introduction (probably completely confusing and non-understandable) to the s4k system..

the editor tries to edit the various arrays directly, and show as much detail of selected node and stuff as possible, and you can edit names for the array elements, to make it easier to remember which array element does what..

you edit the nodes and other arrays, compile to convert everything to bytes, and then play to get it started.. play searches for a location node called 'intro_init' and calls this before starting its main loop.. then looks for 'intro_frame', which is called for every frame..

especially the list editor is a little shaky at the moment.. it can edit text by having a " character as the first one (which will be skipped, no ending ") to directly copy/paste the text (for shaders, etc). if no " is found first, it parses each word and convert them individually to bytes.. script opcodes are translated to their corresponding value (for bytecode interpreter), and register names to their indexes.

---

the editor will eventually/later also export a .h file, "used_elements.h", or "optimize.h" or whatever, with a bunch of "define USED_OPCODE_PUSH, #define USES_NODE_CALL, etc, and the intro source code is filled with relevant #ifdef/#endif's.. so things you don't use in the editor, will not be compiled into a final 4k intro...

and, added music and audio yesterday, using nodes and expressions for both the sequencing and audio generation... seems to work really great! when this is a bit more stable, i'll start formalizing the nodes and opcodes and stuff..

and also, as mentioned, a few project files for testing and showing off things, would be really great, but, if the nodes and/or opcodes change, that would make the files useless... need to formalize, make a final decision about the nodes/opcodes, and perhaps have some version info in the project file first...

< waffle OFF >



Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #16 on: March 21, 2012 »
I'm trying to figure it out by your screen shots....  Even some saved examples to work with would be helpful... maybe even preferred.

I can't produce any output from it.

See attached screenie... I tried to copy your screen shot, but there are parameters that I can't see.

hmm, by the screenshot, i can't quickly see what the problem is... in theory, the 'intro_init' node should be executed when you click compile (this has changed a bit in a newer version, called when starting playback instead)..  but i will make some very simple examples later today, and post them, so you can try them out.. and also a new s4ke.exe..

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #17 on: March 21, 2012 »
screen recording while editing, including a nice crash :-)
canstudio and youtube both tried to ruin the quality and framerate as much as they could...

http://www.youtube.com/watch?v=5vMJU5YMknk
[youtube]5vMJU5YMknk[/youtube]

saved project file: test.zip (2k)
http://dl.dropbox.com/u/41070669/s4k/previews/21mar2012/test.zip
new s4ke.exe (725k)
http://dl.dropbox.com/u/41070669/s4k/previews/21mar2012/s4ke_debug.exe


EDIT: Embedded the youtube video for you. There's a "YOUTUBE" tag for embedding them. If you try and modify this post, you should be able to see the format - raizor
« Last Edit: March 21, 2012 by Raizor »

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k
« Reply #18 on: March 23, 2012 »
tons of changes, tweaks and fixes...
and some new things:
register-banks
patterns
polyphonic audio synthesis and sequencing



Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: s4k (editor+intro exe)
« Reply #19 on: March 27, 2012 »
i would be very grateful if somebody could try this: intro.exe (2899 bytes), and see if it works on your machine.. if everything goes according to plan, it will draw a textured, rotating sphere, directly to the desktop (forgot to turn on the S4K_FULLSCREEN flag).. and play some ugly 'music'.. there's mainly basic stuff going on in there, so hopefully, it will work pretty much everywhere.. but theory and practice seldom match too well, so... it would be good (or bad) to hear any reports, if it works or not, and where it causese problems.. also, if you're interested, here's the editor.exe (580k), and the test2.s4k (1255 bytes) project file. (the .h file exported from this was used to compile intro.exe)