Lighting in the darkness

Hi and welcome to this week of programming 1.1.

This week I was going to work with something I dreaded and was excited to learn from first choosing colossus core as our Concept the lightning where we wanted it to be dark except where we light up in the game to see where we are looking or effects from things as secondary weapons such as missiles, lasers or even our time bomb.

We will also use our lights to show how much damage our ship has taken and when we are exploring the caves we will happen upon old ship parts from previous ships (not previous runs) and they will blink I think.

The colossus core concept had a dynamic lightning system where the light collides with objects and don’t show up behind but as I was looking upon guides to see how it was made I found some who was plausible and I took what I learned and discussed it with one of our graphic students in our group named Oscar. We decided we shouldn’t implement dynamic lightning and decided on a static lightning where it won’t collide with the surroundings because it was easier and removed a lot of work from our graphic designers too.

Now to begin with I decided to make everything dark I made a sf::RenderTexture and a sf::Sprite in a class for the darkness then I used .create (Screen width , Screen Height) and then I set the texture but I had to Sprite. Get Texture for it to work. By this time It was time to work in main where I prototype where I cleared the texture of the render texture then this is where I have to draw out the lights it out before the clear of window then I had to draw out the darkness.

Now it was time for my light class to begin with I added sf::Texture and sf::Sprite then I began by setting the texture I was going to use for my experiment and fixed the colors at 255,255,255 and the transparency at 255.

Now something I still have some problems with is I have to use Blendmode::BlendAdd to work which is needed to make it see through the darkness but I will burrow through to and hope I can succeed.

For I will only make a single object instead of a vector for our lights since I only want to try how it works. Now I will draw it out before I display it on the black canvas.12784570_10153975642788620_1627045639_n

If you want the link for the tutorial from this work just pm me.

One comment

  1. deredr1 · March 1, 2016

    Hi Christopher,

    Your blogpost is very informative. You have described what you have worked with and how you have solved it, in very deep description. You even writte about the functions you have been using. I think thou that you are describing a litle to deep, as for example:

    “Now to begin with I decided to make everything dark I made a sf::RenderTexture and a sf::Sprite in a class for the darkness then I used .create (Screen width , Screen Height) and then I set the texture but I had to Sprite. Get Texture for it to work.”

    The first part is okey, as the readers may be curious about what libary you have used, which in this case is sfml. You could have probably just written “SFML’s Render Texture class” instead of sf::RenderTexture, but that isn’t the big deal. The big deal is when you are writing about the functions which has been used. You have written “.create”, which made me stop in the text and reread beffore I could understand. I would highly recomend you to write “the create function” instead, as it will make the text more read friendly for the readers. You have otherwise written clearly what you have done,how and why.

    – Johan Persson, Group 9.

    Like

Leave a comment