Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Regarding Day and Night Cycles.

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Locked
coolmani1209
Member
Member
Posts: 2
Joined: February 25th, 2012, 4:40 pm
Name: Joshua

Regarding Day and Night Cycles.

Post by coolmani1209 »

Is day and night cycles avaible in FPS mode?
If so can someone make full and understandable tutorial how to make day and night cycles on FPS mode.
It would be really cool if it ware.

Type of tutorial wanted [Video Tutorial]

Thank you
*Hug*
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Regarding Day and Night Cycles.

Post by Hirato »

it's available for all modules, I just happened to show the RPG doing it.
It's the only one in which such a mechanic will have any use though.
You will need the current SVN which has the tesseract fork merged in.

Code: Select all

//basic day-night cycle map

light_1 = [ 1 ] //reduce light-radii to below activation threshold
mapstart = $lastmillis
daylength = 600000
moon = 0
entropy = 0

shiftcolour = [
	local init1 init2 init3
	local final1 final2 final3

	splitcolour init $arg1
	splitcolour final $arg2

	loop i 3 [
		id = (+ $i 1)
		cond [ || [! (rnd 2)] [= $[final@id] $[init@id]] ] [
			//dummy
		] [ > $[final@id] $[init@id] ] [
			[init@id] = (+ $[init@id] 1)
			entropy = (-f $entropy 1)
		] [ 1 ] [ //[ < $[final@i] $[init@i] ]
			[init@id] = (- $[init@id] 1)
			entropy = (-f $entropy 1)
		]
	]

	result (mergecolour init)
]

cycle = [
	local elapsed dawnborder dayborder duskborder nightborder
	local sunprogress

	dawnborder = (abs (*f $daylength .15))
	dayborder = (abs (*f $daylength .175))
	duskborder = (abs (*f $daylength .70))
	nightborder = (abs (*f $daylength .75))

	elapsed = (mod (+ (- $lastmillis $mapstart) $dawnborder) $daylength)

	//todo
	//fogcolour + fogquantity

	cond [ || (< $elapsed $dawnborder) (>= $elapsed $nightborder) ] [
		//night time
		if (>= $elapsed (+f $nightborder (*f .02 $daylength))) [
			light_1 = []
		] [
			light_1 = [ 1 ]
		]
		if $moon [
			sunlightyaw 180
			sunlightpitch 30

			ambient (shiftcolour $ambient 0x0A0A0A)
			sunlight (shiftcolour $sunlight 0x2F2F2F)
			cloudcolour (shiftcolour $cloudcolour 0x4F4F4F)
			skyboxcolour (shiftcolour $skyboxcolour 0x1F1F1F)
		] [
			ambient (shiftcolour $ambient 0x010101)
			sunlight (shiftcolour $sunlight 0x0)
			cloudcolour (shiftcolour $cloudcolour 0x0F0F0F)
			skyboxcolour (shiftcolour $skyboxcolour 0x0)
		]
	] [ < $elapsed $dayborder ] [
		//dawn
		light_1 = [ 1 ]
		sunlightyaw 260
		sunlightpitch 10

		ambient (shiftcolour $ambient 0x101010)
		sunlight (shiftcolour $sunlight 0xAF7F3F)
		cloudcolour (shiftcolour $cloudcolour 0x6F6F4F)
		skyboxcolour (shiftcolour $skyboxcolour 0xAF8F3F)
	] [ < $elapsed $duskborder ] [
		//day time
		light_1 = [ 1 ]
		sunprogress = (divf (-f $elapsed $dayborder) (-f $duskborder $dayborder))

		sunlightyaw (-f 260 (*f $sunprogress 160))
		sunlightpitch (+f 10 (*f 120 (? (>f $sunprogress .5) (-f 1 $sunprogress) $sunprogress)))

		ambient (shiftcolour $ambient 0x191919)
		sunlight (shiftcolour $sunlight 0xFFDFBF)
		cloudcolour (shiftcolour $cloudcolour 0xFFFFFF)
		skyboxcolour (shiftcolour $skyboxcolour 0xFFFFFF)
	] [ 1 ] [
		//dusk
		light_1 = [ 1 ]
		sunlightyaw 100
		sunlightpitch 10

		ambient (shiftcolour $ambient 0x101010)
		sunlight (shiftcolour $sunlight 0xAF7F3F)
		cloudcolour (shiftcolour $cloudcolour 0x6F6F4F)
		skyboxcolour (shiftcolour $skyboxcolour 0xAF8F3F)
	]

	//loop!
	sleep 0 cycle
]
cycle
This is not a url, clicking it is pointless
coolmani1209
Member
Member
Posts: 2
Joined: February 25th, 2012, 4:40 pm
Name: Joshua

Re: Regarding Day and Night Cycles.

Post by coolmani1209 »

So may i ask how do i put it on PAS.
what should i do with SVN.
yea sorry i suck at coding.
*iSuckAtCoding*

If someone experienced is reading this, so please make a understandable video tutorial about it.

Thanks
*Hugs*
User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Re: Regarding Day and Night Cycles.

Post by Sircameron »

Honestly without coding experience/software. You should just wait until its released in an actual version instead of a subversion (svn). A lot of them aren't as stable and are for testing/debugging.. Generally you dont want to grab an svn unless you have a compiler like with visual basic..
User avatar
chaozz
Member
Member
Posts: 12
Joined: November 9th, 2012, 5:48 pm

Re: Regarding Day and Night Cycles.

Post by chaozz »

Hirato wrote:it's available for all modules, I just happened to show the RPG doing it.
It's the only one in which such a mechanic will have any use though.
You will need the current SVN which has the tesseract fork merged in.

Code: Select all

//basic day-night cycle map

light_1 = [ 1 ] //reduce light-radii to below activation threshold
mapstart = $lastmillis
daylength = 600000
moon = 0
entropy = 0

shiftcolour = [
	local init1 init2 init3
	local final1 final2 final3

	splitcolour init $arg1
	splitcolour final $arg2

	loop i 3 [
		id = (+ $i 1)
		cond [ || [! (rnd 2)] [= $[final@id] $[init@id]] ] [
			//dummy
		] [ > $[final@id] $[init@id] ] [
			[init@id] = (+ $[init@id] 1)
			entropy = (-f $entropy 1)
		] [ 1 ] [ //[ < $[final@i] $[init@i] ]
			[init@id] = (- $[init@id] 1)
			entropy = (-f $entropy 1)
		]
	]

	result (mergecolour init)
]

cycle = [
	local elapsed dawnborder dayborder duskborder nightborder
	local sunprogress

	dawnborder = (abs (*f $daylength .15))
	dayborder = (abs (*f $daylength .175))
	duskborder = (abs (*f $daylength .70))
	nightborder = (abs (*f $daylength .75))

	elapsed = (mod (+ (- $lastmillis $mapstart) $dawnborder) $daylength)

	//todo
	//fogcolour + fogquantity

	cond [ || (< $elapsed $dawnborder) (>= $elapsed $nightborder) ] [
		//night time
		if (>= $elapsed (+f $nightborder (*f .02 $daylength))) [
			light_1 = []
		] [
			light_1 = [ 1 ]
		]
		if $moon [
			sunlightyaw 180
			sunlightpitch 30

			ambient (shiftcolour $ambient 0x0A0A0A)
			sunlight (shiftcolour $sunlight 0x2F2F2F)
			cloudcolour (shiftcolour $cloudcolour 0x4F4F4F)
			skyboxcolour (shiftcolour $skyboxcolour 0x1F1F1F)
		] [
			ambient (shiftcolour $ambient 0x010101)
			sunlight (shiftcolour $sunlight 0x0)
			cloudcolour (shiftcolour $cloudcolour 0x0F0F0F)
			skyboxcolour (shiftcolour $skyboxcolour 0x0)
		]
	] [ < $elapsed $dayborder ] [
		//dawn
		light_1 = [ 1 ]
		sunlightyaw 260
		sunlightpitch 10

		ambient (shiftcolour $ambient 0x101010)
		sunlight (shiftcolour $sunlight 0xAF7F3F)
		cloudcolour (shiftcolour $cloudcolour 0x6F6F4F)
		skyboxcolour (shiftcolour $skyboxcolour 0xAF8F3F)
	] [ < $elapsed $duskborder ] [
		//day time
		light_1 = [ 1 ]
		sunprogress = (divf (-f $elapsed $dayborder) (-f $duskborder $dayborder))

		sunlightyaw (-f 260 (*f $sunprogress 160))
		sunlightpitch (+f 10 (*f 120 (? (>f $sunprogress .5) (-f 1 $sunprogress) $sunprogress)))

		ambient (shiftcolour $ambient 0x191919)
		sunlight (shiftcolour $sunlight 0xFFDFBF)
		cloudcolour (shiftcolour $cloudcolour 0xFFFFFF)
		skyboxcolour (shiftcolour $skyboxcolour 0xFFFFFF)
	] [ 1 ] [
		//dusk
		light_1 = [ 1 ]
		sunlightyaw 100
		sunlightpitch 10

		ambient (shiftcolour $ambient 0x101010)
		sunlight (shiftcolour $sunlight 0xAF7F3F)
		cloudcolour (shiftcolour $cloudcolour 0x6F6F4F)
		skyboxcolour (shiftcolour $skyboxcolour 0xAF8F3F)
	]

	//loop!
	sleep 0 cycle
]
cycle
do you put this code in the cfg file of your map to make this work?
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Regarding Day and Night Cycles.

Post by Hirato »

Basically.
This is not a url, clicking it is pointless
Locked