Real stars
Advantages
- Uses Actual Real Life stars
- The Moon and the sun are not locked together
- Low Graphics Compatible
- Works with Streaming Enabled
- Customizable
- Scriptable
Usage
Real-Time Stars at a location
Real time.rbxm (63.2 KB)
This example covers real time sky at a given location, start by downloading the rbxm and place the resulting folder into StarterPlayerScripts , Now after that, take a look inside the Real Time localscript inside the folder, there you’ll see lots of stuff, scroll down to
--VISUAL CONFIGURATIONS
local latitude =7.8383--Set latitude
local longtitude = 98.3454 --Set longtitude
local ttz =DateTime.now()
As you can see, you can set the location of the sky by latitude and longitude, positive means north and east, negative means south and west.
Eclipse Demo
Eclipse.rbxm (63.3 KB)
This demo sets the location and time to the 2024 eclipse at Cleveland, Ohio, USA, after which, the time will progress at 1000x normal speed
--VISUAL CONFIGURATIONS
local latitude =41.4993--Set latitude
local longtitude = -81.6944 --Set longtitude
local tt =DateTime.fromUniversalTime(2024,4,8,15,59,18)
as you can see, we set the location to Cleveland, Then the time to the start time of the eclipse, but remember, the system uses Universal Time, So the time of 15:59:18 for the start of the eclipse is actually around 11 o’ clock (it is somewhat inaccurate due to the complexities of solving moons location)
--TIME CONTROL
local dt = game["Run Service"].Heartbeat:Wait()*1000
ttz=DateTime.fromUnixTimestamp(tt.UnixTimestamp+dt):ToUniversalTime()
tt = DateTime.fromUnixTimestamp(tt.UnixTimestamp+dt)
year,month,day,hour,minute,second=ttz.Year,ttz.Month,ttz.Day,ttz.Hour,ttz.Minute,ttz.Second
Here we essentially get how much time has passed in 1 loop, then we multiply by 1000 to speed up, We then update the current time by adding the time passed times 1000 into ttz and tt
Analemma Demo
Analemma.rbxm (63.2 KB)
Here we essentially go forward in time 1 day every update, essentially going to the same time every day for a year. Now we also trace out the path of the sun
--VISUAL CONFIGURATIONS
local latitude =7.8383--Set latitude
local longtitude = 98.3454 --Set longtitude
local tt =DateTime.fromUnixTimestamp(1745131232)
We first set the location and the start time of the demo
--TIME CONTROL
ttz=DateTime.fromUnixTimestamp(tt.UnixTimestamp+86400):ToUniversalTime()
tt = DateTime.fromUnixTimestamp(tt.UnixTimestamp+86400)
year,month,day,hour,minute,second=ttz.Year,ttz.Month,ttz.Day,ttz.Hour,ttz.Minute,ttz.Second
We then go forward in time by 86400 seconds, Essentially a day every loop
--SUN
local ra,dec,lambda,Msun = sun.calculateSunPosition(JD)
local alt,az=constants.calculateHorizontalCoordinatesFromRA(ra,dec,latitude,LST)
local sunvec = constants.altazToUnitVector(alt,az)
sun.positionSun(sunvec,sunobj,loadpart)
sun.CreateSun(sunvec,3,loadpart)
We then update the sun’s position by using positionSun() and we create a trail tracking the sun by creating smaller sun every update
Documentation
Basic documentation for function use and outputs are provided when writing code
A few function you need to use
starcreator.LoadArr(database : Array , Part : Part)
- Loads stars from a Database array, around a part as attachment at 2000 studs
starcreator.calculateLST(JD : number , longitude : number)
-
Calculates the Local Sidereal Time from longtitude and time precisely
-
Returns Local Sidereal Time in Decimal Hour
starcreator.LoadRot(latitude : degree , 90 + LST : degree , Part : Part)
- Rotate a part to the appropriate rotation given latitude and LST
- The 90 Degree is to account for initial rotation of the part that has original rotation as 0,0,0 when loadArr is called on the part
Any auxiliary functions should be documented when you try using it using the code editor
Limitations
- It is accurate but in no way should be used for real world stuff like navigation
- Verified by checking with Stellarium Which might be incorrect
- Sun and moon will be included, But both will be off by a few degrees (Sun = Roblox sucks, Moon = Too complex)
- Fog have to start after the stars (Offset)
- Does not work with Roblox Cloud (Custom clouds untested)
- Shadows are very inaccurate at night
Expanding
Check this Github page, This is the code used to create the JSON data string to be used in Real Stars
License
Get it
-
Module Scirpt [Does not include usage script]
All demos are provided above
Notes
- Only top 1000 brightest (Apparent Magnitude) stars are added