Decisions decisions.

113 views
Skip to first unread message

LaeMing Ai

unread,
Apr 14, 2017, 8:24:47 PM4/14/17
to Newspeak Programming Language
Obviously at the very early planning stages here :-) I have a decision...


In my proposed Virtual World Environment, I am deciding whether I should write the whole stack in Newspeak or use Newspeak at the general-user programming* level.

* That is, it is the language used to program scene graph entities from user-side (keeping in mind that the environment is explicitly about user-generated content).

My current idea is to split the system into multiple entirely independent parts that communicate via a single shared data structure (namely the 3D scenegraph)...


Independent execution threads (possibly eventually different physical processors each optimized for their task, they are strict black boxes from the user perspective):

- The Renderer engine repeatedly scans through the scene graph and draws the graphics and activates/attenuates/deactivates scene sound sources relative to user position in world (it can use OpenGL, Mantle, DirectX, soft-render, or specialized GPU/DSP code on the back-end but this is entirely transparent to the environment the user sees).

- The Audio streamer handles actual playing of audio streams and mapping of audio source directionality in direct response to the Render engine's updates to audio-source positions in world relative to user

- The Physics engine repeatedly scans through the scene graph and updates objects' physical properties (location, spin, etc.) according to their set delta-Vs, accounting for collisions, friction, etc.

- The scripting engine maintains a collection of event-triggered scripts for each scene graph object (events coming from user interaction, other scene-graph objects, and the physics engine). This one would definitely want to be in a language like Newspeak. Scripts themselves are, ideally, distributed as source for compile-on-load use as well as being available for user inspection. The primary appeal to me of Newspeak so far is its exceptional IDE. Not so keen on curly brackets (or even square ones) as I use a one-handed keyboard and those glyphs are a bit of a finger-twister! For that reason, I have been looking at Ada a bit too. Nice language, needs a Newspeak-like IDE :-)

- The synchronization engine keeps multiple users of the virtual world data-synchronized across a network (potentially allowing a distributed but contiguous world). This is more long-term. Initially I am targeting single-user applications, but keeping this in mind.

...

My concern with doing the whole thing in Newspeak would be what the scene graph data would look like if it was constructed from actual Newspeak objects, rather than a naive array of C-like structs containing the raw values and pointers-to-more-complex-data that the various engines above can quickly scan over picking out just the bits that are relevant to them.

The Newspeak way seems to imply that each engine would have to message each object to 'draw yourself', 'update your physics' etc., which implies a more homogeneous overall system (this may be better than my way for all I know, so I'm happy to be talked into it if it is).


Also the fact that, for example, while prototyping the graphics subsystem in Newspeak (or any high-level language) would certainly be easier in the short term, re-basing it to run on a dedicated GPU or DSP would likely be tricky if even possible if the code is entwined in a homogeneous object**


** My long-term hardware target at present is the RaspberryPi, mainly because it has properly open video drivers, and secondarily because of its education/hobbyist focus which matches my own target demographic for my project. Also, replacing the Vidcore's custom RTOS with a non-open-GL AV stack optimized explicitly for my own, simpler, system has some potential worth exploring (I'm kind of relying on my project gaining enough momentum to attract someone who might actually be able to do that, but it appears technically possible from my research into the matter).

Will stop there. I tend to be a bit long-winded!
-Lae.

Gilad Bracha

unread,
Apr 15, 2017, 5:19:05 AM4/15/17
to Newspeak Programming Language
A couple more points:

1. Are you familiar with ByteArrays? They can be used to get the effect of accessing linear memory efficiently.
2. Psoup runs on RasperryPi (but lacks an FFI :-(). 

LaeMing Ai

unread,
Apr 15, 2017, 6:37:10 AM4/15/17
to Newspeak Programming Language
Byte arrays are nice. :-)

Is Psoup related to the Beautiful Soup XML parser? (I assume you are not talking about "Genetic co-transformation with plasmids"!)

...

I spent my Saturday afternoon defining psudo-hardware for a triangle rendering engine. I think I will get a student FPGA board and see if I can learn to implement it (FPGA is new to me, but hard logic is what I was formally trained for long ago!). Have my render-loop punch in about 80* 16-bit registers of data (camera, lighting, model bounding box, triangle), trigger an execute command and splat a z-buffered triangle into the frame buffer. All fixed point. Framebuffer dimensions restricted to 2^n wide so I can use a static shift offset instead of a multiplier for buffer xy coordinate calculations. :-D (the renderer is very simple: as mentioned, it is well below openGL-1.0 capabilities by intention).

*a good bit of that data only has to be changed once per model or even once per frame.

Xilinx Zynq-7000 boards have a nice dual-core 32-bit ARM unit on them (I'd love to define my own CPU but I very much doubt I could, beyond something 6502-like). I can then run a thread to parse the scene tree objects and pass in their triangles one at a time.

I am leaning towards Newspeak as the user-side language for in-world programming and doing the base in, maybe, C and/or Ada. I like Ada, but C will have a lot of example code and libs for bits I can't quite handle myself. But I really don't want to inflict, C in particular, on my end user!!

So I envision the scenegraph objects will contain, amongst other things, a pointer to a sandboxed code block that can respond to messages sent to it from other objects, user interaction and the physics engine. I may be biased here, though, as that is how I spent a few years doing it in SecondLife. The familiar solution isn't always (or very often!) the best route, so pull me up on that if there is reason to!!!

(Also read up on how Broadcomm's VidCore chip interacts with its embedded ARM cores - fascinating stuff, but not quite useful to me, I think, sadly).

Regards,
-Lae

LaeMing Ai

unread,
Apr 15, 2017, 8:33:20 AM4/15/17
to Newspeak Programming Language

Gilad Bracha

unread,
Apr 15, 2017, 10:46:16 AM4/15/17
to Newspeak Programming Language
Psoup is short for Primordial Soup and has no relation to anything XML, living or dead :-)


On Friday, April 14, 2017 at 5:24:47 PM UTC-7, LaeMing Ai wrote:
Reply all
Reply to author
Forward
0 new messages