About Store Forum Documentation Contact



Post Reply 
interior lighting
Author Message
ghreef Offline
Member

Post: #1
interior lighting
Not sure what I'm missing, I'm new to lighting etc, but I've built a number of interiors which I can enter. Once inside, they are completely closed off from outside light. Unfortunately, the game is still rendering them as lit (as if from an unknown source). I imagine this is a result of some ambient light setting, but I can't seem to figure out how to change this in the code, especially so it applies only when inside interiors. I've checked all the tutorials and forum threads and haven't seen anything. Anyone have any guidance?

Thanks,
gh
06-16-2011 04:26 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: interior lighting
Code:
D.ambColor(Vec(0));
Sun.light_color = Vec(1);

If you press F9 in World Editor, you can use the Ambient and Sun tabs to change these settings and see the effects in realtime within your world.

You're probably going to want/need to have some ambient lighting.
(This post was last modified: 06-17-2011 01:20 AM by Driklyn.)
06-17-2011 01:18 AM
Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #3
RE: interior lighting
F9 only affects the world editor environment. I was really looking to set up each world to have different lighting etc.. (eg: an underground world would have 0 ambient lighting, 0 sun, 0 horizon etc, and all be light by in-cave/tunnel lighting like torches) then outside worlds would have all the details like a sun, horizon, clouds etc...
06-20-2011 06:47 PM
Find all posts by this user Quote this message in a reply
Dampire Offline
Member

Post: #4
RE: interior lighting
You may create volumes - physics actors with disabled collision. If player in volume - set another D.ambPower (or color), else - default. Many engines uses same tech.
06-22-2011 08:39 AM
Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #5
RE: interior lighting
Thanks dampire. I think this is the approach for me. I'll be playing around with it today.

Thanks!
06-23-2011 12:07 PM
Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #6
RE: interior lighting
Update question - I'm not 100% sure how to create a volume as described by Dampire. Also, I noted in the RPG2 code that that there's a function to decide if the player is indoor (aptly named Bool Indoors())
That seems to return if the player is currently in the world file "Dungeon". Is that correct? (This is in the Game.cpp file).

If so, is there a way to do an if statement? ie:
Bool Indoors()
{
if Contains(Game::World.wordDir(),"Dungeon")
(
return Contains(Game::World.wordDir(),"Dungeon");
}
if Contains(Game::World.wordDir(),"Caves")
(
return Contains(Game::World.wordDir(),"Caves")
}
}

If I understand the code, this will return a "true" value if the current worlds are Dungeon or Caves, otherwise it returns a "false". Correct?
07-03-2011 10:55 PM
Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #7
RE: interior lighting
ok, I revisited my code - to show I actually am trying and cleaning these things up....

The following code seems to work, but I'm rough around the edges with C++ and still rusty with coding (been over 6 years since I've really been a coder). Can anyone suggest a cleaner way to do this? (I'm sure there is one)

thanks in advance.

Code:
Bool Indoors()
{
    Bool Ccatacomb, Cdungeon;
    Ccatacomb = Contains(Game::World.worldDir(),"catacomb");
    Cdungeon = Contains(Game::World.worldDir(),"Dungeon");

    if (Ccatacomb)
    {
        return Ccatacomb;
    }
    else
    {
        if (Cdungeon)
        {
            return Cdungeon;
        }
        else
        {
            return false;
        }
    }
        //return Contains(Game::World.worldDir(),"catacomb"); // was Dungeon
}
07-04-2011 05:10 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #8
RE: interior lighting
Code:
Bool Indoors()
{
    return (Contains(Game::World.worldDir(),"catacomb") || Contains(Game::World.worldDir(),"Dungeon"));
}
07-05-2011 12:27 AM
Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #9
RE: interior lighting
Thanks! Is || a pipe (to concatenate) or an "or" clause operator? If memory serves, it's a pipe. So I will get either a truefalse, falsetrue or falsefalse. Correct? In that case will the bool type be ok - will C++ do the evaluation that 10 is 1, 01 is 1 and 00 is 0?
07-05-2011 01:27 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #10
RE: interior lighting
It's OR. As you wrote:

x | y | or
0 | 0 | 0
1 | 0 | 1
0 | 1 | 1
1 | 1 | 1

It works the same for boolean true/false.
07-05-2011 02:37 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #11
RE: interior lighting
thanks very much Harry and Driklyn. Can you tell I learned C & Unix scripting the same semester - YEARS ago. smile
07-05-2011 09:42 PM
Find all posts by this user Quote this message in a reply
Post Reply