Back to Index Page generated: May 8, 2024, 6:16:03 AM

Expansion System Features: Rings

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Adds ring systems to occasional planets. Requires a shader-capable graphics card to view. Adds ring systems to occasional planets. Requires a shader-capable graphics card to view.
Identifier cim.gsagostinho.systemfeatures.rings cim.gsagostinho.systemfeatures.rings
Title System Features: Rings System Features: Rings
Category Ambience Ambience
Author cim, gsagostinho cim, gsagostinho
Version 2.10.3 2.10.3
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/System_Features_Rings n/a
Download URL https://wiki.alioth.net/img_auth.php/5/5d/Cim.gsagostinho.SystemFeatures.Rings.oxz n/a
License CC-BY-SA 3.0 CC-BY-SA 3.0
File Size n/a
Upload date 1610873308

Documentation

Also read http://wiki.alioth.net/index.php/System%20Features:%20Rings

README.txt

System Features: Rings
======================

Version: 2.10.3
Required Oolite Version: 1.84
Author: cim, Gilberto Agostinho (gsagostinho)
License: CC-BY-SA 3.0

About
=====

This OXP adds rings to a few planets in each galaxy. A shader-supporting graphics card is required, the more recent the better. Older shader-supporting cards may be too slow to render the rings at an adequate framerate. 

Version history
===============

16/10/2018 - Version 2.10.3: Fixing a newly introduced bug in the visuals of the gaps in the rings.
13/10/2018 - Version 2.10.2: some more minor optimizations.
09/10/2018 - Version 2.10.1: more optimizations.
                             rings get more transparent when entering an atmosphere.
09/10/2018 - Version 2.10: optimized some of the shader's code (thanks Svengali!).
07/10/2018 - Version 2.9: better handling of the alpha channel .
23/09/2017 - Version 2.8.1: bug in the description text now properly solved, it was still present due to a small oversight (thanks again, Cody).
23/09/2017 - Version 2.8: changed description text to "This planet has rings."
                          fixed a bug in which the description text appears many times (thanks Cody and Norby).
19/09/2017 - Version 2.7: added "use strict"; to scripts which removes some warnings in the log.
                          rings are now a little bit more common (1/8 of planets will have them).
                          the description of a system will now tell whether it has rings or not (thanks phkb for the help implementing this!).
                          close-up grain density now proportional to the colour intensity of the ring lane.
                          fixed bug in which Ribior's main station would spawn inside rings (thanks to spara, cim and all others for the suggestions and spara for doing the all hard work for the fix).
27/08/2017 - Version 2.6: the sinusoidal functions which create the variations of colour intensity now fade in one by one according to the distance, which solves the Moire pattern problems.
                          shading applied at close distances so that the grains look like rocks.
17/08/2017 - Version 2.5: fix for a small bug affecting certain cards (wrong type for second argument of pow).
03/08/2017 - Version 2.4: change to shader to fix a bug with certain ATI cards.
24/07/2017 - Version 2.3: code refactoring.
                          rings fade into blue when entering the atmosphere (such as when using PlanetFall).
20/07/2017 - Version 2.2: smaller ring bands and grains only visible at closer distance.
                          improved the issues with moire pattern, in particular at lower resolutions.
20/07/2017 - Version 2.1: the large gaps in the rings are now randomized making each system more unique.
                          the colour gradient function is also randomized for more unique rings.
                          renamed the effect script.
19/07/2017 - Version 2.0: rings now have different relative sizes to the planet.
                          they also have different radial length.
                          applied a slight yellow tint.
                          applied ambient light.
                          shadows are darker.
                          changed the spawning algorithm which, among other things, make the rings more common.
                          ring now uses a colour gradient instead of a texture (which is now only used to generate noise).
             Version 1.2: use 1.80 features, repackage.
             Version 1.1: improved ring texture and appearance contributed by ZygoUgo.
             Version 1.0: initial non-beta release.
             
Links
=====

Elite Wiki: http://wiki.alioth.net/index.php/System_Features_Rings
Bulletin Board thread: http://aegidian.org/bb/viewtopic.php?f=4&t=12544

Equipment

This expansion declares no equipment.

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Scripts/systemfeatures-rings-effectScript.js
"use strict";
this.author      = "cim and gsagostinho"; 
this.copyright   = "(c) 2011-2017 cim and gsagostinho"; 
this.licence = "CC-BY-SA 3.0";
this.version     = "2.10.3"; 
this.name = "System Features Ring effect script";

this.$fcb;

this.effectSpawned = function() {
		this.$fcb = addFrameCallback(this._updatePosition.bind(this));
		// assuming these two are constants
		this.visualEffect.shaderVector1 = system.sun.position;
		this.visualEffect.shaderFloat1 = system.mainPlanet.radius * system.mainPlanet.radius;
		
		// random ring size
		var salt1 = galaxyNumber * 256 + system.ID; // number between 0 and 2047, unique for each system. Used as salt for system.scrambledPseudoRandomNumber
		this.visualEffect.shaderFloat2 = system.mainPlanet.radius * (7.0 + 3.0 * system.scrambledPseudoRandomNumber(salt1)); // random ring size, between 7 and 10
		
		// random integer
		var salt2 = galaxyNumber * 256 + system.ID + 2048; // number betwwen 2048 and 4095, also unique for each system. Used as salt for a second system.scrambledPseudoRandomNumber
        this.visualEffect.shaderInt1 = Math.floor(100.0 * system.scrambledPseudoRandomNumber(salt2)); // random integer value, between 0 and 99
        
		this.visualEffect.shaderVector2 = player.ship.position;
		this.visualEffect.scale(this.visualEffect.shaderFloat2);

}

this.effectRemoved = function() {
		removeFrameCallback(this.$fcb);
}

this._updatePosition = function() {
		if (player.ship.position) {
				this.visualEffect.shaderVector2 = player.ship.position;
				// move very slightly towards player to deal with depth-buffer issues
				this.visualEffect.position = system.mainPlanet.position.subtract(system.mainPlanet.position.subtract(player.ship.position).direction());
		} else {
				removeFrameCallback(this.$fcb);
		}
}
Scripts/systemfeatures-rings.js
"use strict";
this.author      = "cim and gsagostinho"; 
this.copyright   = "(c) 2011-2017 cim and gsagostinho"; 
this.licence = "CC-BY-SA 3.0";
this.version     = "2.10.3"; 
this.name = "System Features: Rings";

this.startUpComplete = function() {
    //  this adds the phrase "This system has rings." to all systems where rings are present.
    for (var gal = 0; gal < 8; gal++) {
        for (var sys = 0; sys < 256; sys++) {
            var s = System.infoForSystem(gal, sys);
            if ((s.radius >= 6381) && (s.description.indexOf(" This planet has rings.") === -1)) { // indexOf(string) returns -1 if string not present
                s.description += " This planet has rings.";
            }
        }
    }
        
    delete this.startUpComplete; // deleting this function so that the phrase above does not get added at every load of the game.
    
}

this.systemWillPopulate = function() {
	// code to select which planets get rings
	if (system.isInterstellarSpace || system.sun.hasGoneNova) {
		return;
	}
	if (system.info.radius < 6381) { // out of the 2048 planets in all 8 galaxies, there are 256 planets with radius >= 6381, i.e. the largest 1/8 of planets
		return;
    } else {
    	system.setPopulator("system-features-rings",
			{
				callback: this._addRing.bind(this),
				coordinates: system.mainPlanet.position,
				priority: 1000
			});
    };
}

this._addRing = function() {		
		var ring = system.addVisualEffect("systemfeatures-rings",system.mainPlanet.position);
		ring.orientation = system.mainPlanet.orientation;
		ring.orientation = ring.orientation.rotate(ring.orientation.vectorRight(),Math.PI/2);

}