Dark Bit Factory & Gravity

GENERAL => Projects => Topic started by: axon on February 19, 2012

Title: s4k
Post by: axon 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..

(http://dl.dropbox.com/u/41070669/s4k/screenshots/s4k_tool.png)

so...


- 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
Title: Re: s4k
Post by: Jim 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
Title: Re: s4k
Post by: axon 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 (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..
Title: Re: s4k
Post by: ferris 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 :)
Title: Re: s4k
Post by: axon 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 !!
Title: Re: s4k
Post by: axon on February 24, 2012
aanndd.. a blog entry here, with some more new things..
http://torhelgeskei.blogspot.com/ (http://torhelgeskei.blogspot.com/)
Title: Re: s4k
Post by: axon 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)

(http://dl.dropbox.com/u/41070669/s4k/screenshots/s4k_edit_2.png)
Title: Re: s4k
Post by: Kirl on March 01, 2012
Looking really interesting axon, should be a very usefull demo tool!
Title: Re: s4k
Post by: axon 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...

(http://dl.dropbox.com/u/41070669/s4k/screenshots/s4ke_4.png)

- axon

Title: Re: s4k
Post by: ferris on March 13, 2012
Simply wonderful :)
Title: Re: s4k
Post by: axon 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 (http://dl.dropbox.com/u/41070669/s4k/previews/18mar2012/s4ke.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 (http://www.microsoft.com/download/en/details.aspx?id=5555).

(http://dl.dropbox.com/u/41070669/s4k/previews/18mar2012/capture.png)

Title: Re: s4k
Post by: Voltage 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?
Title: Re: s4k
Post by: Raizor on March 20, 2012
Looking great axon. Very interested to see what can be created with this :)
Title: Re: s4k
Post by: axon 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..
Title: Re: s4k
Post by: Voltage 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.

Title: Re: s4k
Post by: axon 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 (http://en.wikipedia.org/wiki/Waffle_%28speech%29)[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 (http://en.wikipedia.org/wiki/Waffle_%28speech%29) OFF >


Title: Re: s4k
Post by: axon 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..
Title: Re: s4k
Post by: axon 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 (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 (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
 (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
Title: Re: s4k
Post by: axon on March 23, 2012
tons of changes, tweaks and fixes...
and some new things:
register-banks
patterns
polyphonic audio synthesis and sequencing

(http://dl.dropbox.com/u/41070669/s4k/screenshots/s4ke_audio1.png)
Title: Re: s4k (editor+intro exe)
Post by: axon on March 27, 2012
i would be very grateful if somebody could try this: intro.exe (http://dl.dropbox.com/u/41070669/s4k/previews/27mar2012/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 (http://dl.dropbox.com/u/41070669/s4k/previews/27mar2012/editor.exe) (580k), and the test2.s4k (http://dl.dropbox.com/u/41070669/s4k/previews/27mar2012/test2.s4k) (1255 bytes) project file. (the .h file exported from this was used to compile intro.exe)

(http://dl.dropbox.com/u/41070669/s4k/previews/27mar2012/capture.png)
Title: Re: s4k
Post by: Voltage on March 27, 2012
It works here on my crappy work machine.  It spins very fast though.  Much faster than in the editor.
Title: Re: s4k
Post by: axon on March 27, 2012
It works here on my crappy work machine.  It spins very fast though.  Much faster than in the editor.

first, thanx for testing, and cool that it works..

i'm not sure, but i think the spinning speed can be for two reasons.. either that i have modified the project file somewhat after i compiled the exe.. likely if it spins about ten times faster... or it's because the editor uses a timer callback for timing (around 60hz, i think), while the intro just runs in a loop, and is probably synced with screen refresh rate.. but i'm still working on the timing and sync, it's currently a bit shaky..
Title: Re: s4k
Post by: Raizor on March 27, 2012
Works fine here too. I get a gray box in the top left of my desktop with the spinning cube. It's spinning not too fast.
Win 7 x64 with Nvidia gtx580. Nice work :)