SE scripts and raymarched nebulae
News about my recent work. Past month I mostly worked on updating the modding manuals, some work is still needed. HarbingerDawn and DoctorOfSpace now working on spellchecking of my updated posts. This is important because I want to put them in the new SE website, into the manual section, and launch it soon.
Working on VR is continuing, many things still must be done. 3D interface for Vive controllers is the most hard thing.
I am also working on advanced scripting system, which will be used to create the in-game tutorial. It is important for Steam release, because SE controls are quite complex for newbie players, and of course nobody cares to read the manual (so I didn’t bothered with it’s updating). So in-game training tour is very important. Scripts will also allows us to make a tours or scenarios like in Celestia. For example, tour through the Solar System.
I decided to give a “.se” extension to SE scripts. Is this good choose? The tutorial script have a name “tutorial.se”.
I also needed a way to speedup script development, so I decided to add a command line parameter parser to SE. For now it have only two parameters: -planetarium forces SE to enter planetarium after launch, without displaying the main menu. Another parameter is a path to a script file, which SE must run at startup. So this gives these possibilities:
1) Associate .se files with SpaceEngine. Then double-click on it will launch SE and force it to run this script (Se enters planetarium mode automatically if script file name is passed in command line).
2) If there is an instance of SE is running already, no new instance will be launched. Double-clicked script will be “opened” in it. If SE was minimized, it maximized back to run the script.
3) Using this, you can make an interesting thing. If you use some advanced text editor (like Notepad++) to edit SE scripts, you can assign SpaceEngine.exe as a compiler or launch option for .se files. Then pressing a hotkey will launch or maximize SE with the script you are editing. (BTW I made a syntax highlight config for Nortepad++, for .se, .sc, .sss and .cfg files – over 1000 keywords!).
4) You can make a bat file (or just edit the desktop shortcut properties) and use it to run SE with custom script.
Another thing I am working on together with Duke is making a raymarching rendering of volumetric objects in SE. Duke made a lot of amazing shaders on Shadertoy, and we are going to import them in SE. Actually, almost every thing in space is volumetric and transparent, so this method of rendering is SE future anyway. Just think about it: galaxies, nebulae, stars, accretion disks and jets, comet tails, atmosphere, clouds, and entire gas giants – they all must be rendered as volumetrics. Even some ship effects such as warp and engine exhaust (which is already done in SE). Non-transparent-volumetrics in SE are only solid planet surface, water surface, and ships. Here is some first results:
Interesting thing about these nebulae – is what they are made as a mods, which modifies some existing objects in SE. I implementing a new system which allows to replace rendering of any object with a custom mesh (model) with a custom shader and textures. For now it works only for nebulae and galaxies, but I plan to extend it on stars and planets. And also make a possibility to replace any type of object, for example all spiral galaxies. If I don’t stop develop this system, any type of object in SE (even default) can be described with a script. This is very reminds the SDK functionality! Example script for a custom nebula model (yes supernova remnant is animated, although explosion parameters must be moved to a nebula catalog script eventually):
CustomModel "Test SNR"
UseForObject "Crab Nebula"
ExpansionBegin 2457670 // 08.10.2016
Color0 ( 1.00 0.96 0.92 1.00 )
//Data0 ( 2.0 1.15 0.28 6.7 )