[Code] More Realistic Skyboxes

Post your example zscripts/ACS scripts/etc here.

[Code] More Realistic Skyboxes

Postby Ral22 » Tue Aug 27, 2013 7:59 am

One of the most common things I do in Doom is try and replicate features from other games. Some time ago (Two years, to be exact), I set my sights on creating more interesting skyboxes, mostly inspired by the tricks The Ultimate Doomer would do with is. So, in looking at how modern skyboxes in games are done, this script came to me to have more realistic skyboxes that add a greater sense of depth and scale.

By this, I mean that the skybox viewer actor will be slightly affected by the player's movement, giving a sense of depth to the things in the skybox besides the common, non-moving skyboxes we are currently subjected to in the ZDoom engine. It's only a few lines of code, but is easily modified to fit your needs and be implemented in your own maps.

Code: Select allExpand view
Script # ENTER
{
    While(TRUE)
    {
        SetActorPosition(S, GetActorX(0)/A+X*65536, GetActorY(0)/B+Y*65536, GetActorZ(0)/C+Z*65536, 0);
        Delay(1);
    }
}


Script Variable Breakdown:
# = Script number or name
S = Skybox Viewpoint Tag
A = X-Axis Sensitivity Modifier
X = Difference between Player and Skybox Viewpoint in map units on the X-Axis(Can be negative, but not equal to zero)
B = Y-Axis Sensitivty Modifier
Y = Difference between Player and Skybox Viewpoint in map units on the Y-Axis (Can be negative, but not equal to zero)
C = Z-Axis Sensivity Modifier
Z = Difference between Player and Skybox Viewpoint in map units on the Z-Axis (Can be negative, but not equal to zero)

For example:
Code: Select allExpand view
Script 1 ENTER
{
    While(TRUE)
    {
        SetActorPosition(1, GetActorX(0)/25+960*65536, GetActorY(0)/25-64*65536, GetActorZ(0)/25-50*65536, 0);
        Delay(1);
    }
}


The Skybox Viewpoint's tag is 1. Variables A, B, C have all been set to 25. The closer these variables are to zero, the more loose the skybox viewpoint's movement is, the higher the values, the movement will be more stiff. Variables X, Y, Z have the difference between the Player actor and the Skybox Viewpoint. Please consult the image below for a visual explanation of variables X and Y.
Spoiler:

The number 65536 is for conversion purposes and should never be changed.

NOTE: When placing a Skybox camera, it MUST be set to an angle of zero. Any other angle causes the alignment to be off.(Although setting it to, say, 180 could cause an interesting effect in void-esque maps.)

Here is an example WAD showcasing the script: http://www.mediafire.com/?92inzehbrp394ts

I will edit this post as it needs to be, to fix errors or add on to answer other's questions that they may have. In the meantime, enjoy the example and code. Please, if you have a question, ask.

P.S.- Since I have done this script, all previous skyboxes (All of the standard, non-moving ones) no longer look right to me. I will not be held accountable if this happens to you as well. :wink:
User avatar
Ral22
stoneshipMapper
 
Joined: 05 Sep 2010
Location: Land of Dawn and Thunder

Re: [Code] More Realistic Skyboxes

Postby Nash » Tue Aug 27, 2013 8:49 am

Neat trick, although it's obviously not multiplayer friendly. ;( Great for those single player mods though!
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [Code] More Realistic Skyboxes

Postby Ral22 » Tue Aug 27, 2013 12:27 pm

Yeah, it's only drawback, I think, is a lack of multiplayer support (And it's a little confusing to implement at first, but that gets ironed out in time). Then again, it is one less script that is constantly repeating itself so that should help keep multiplayer running fast. I suppose it could be possible to have a script that checks if it is in multiplayer mode or not, and if so, could terminate this skybox script, thus giving the map competent support for multiple platforms.
User avatar
Ral22
stoneshipMapper
 
Joined: 05 Sep 2010
Location: Land of Dawn and Thunder

Re: [Code] More Realistic Skyboxes

Postby Yholl » Tue Aug 27, 2013 9:00 pm

Oh wow, this is pretty damn cool. Nice work Ral22!
User avatar
Yholl
I will hit you with my Decorate.
 
Joined: 17 Dec 2012
Location: Here, stupid.


Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests