Coloured Lighting Demo...

Started by
12 comments, last by Darrell 23 years, 4 months ago
A few weeks back there was a discussion about lighting in a tile engine. I've implmented a *very* simple lighting system and I'd like some feedback on performance, hardware etc. Of if you'd like to discuss the how's etc. thats great too. You can either post here or email me at darrellrmay@hotmail.com. You can download the demo here Screenshots can be found here Thanks, Darrell. Edited by - Darrell on 11/27/00 7:47:24 AM Edited by - Darrell on 11/28/00 4:40:10 PM
Advertisement
wrong link ...
It was working last night, seems the folks at Tridpod didn''t like something about the site? Weird because all it contained was a simple main page that linked to the demo and screen shots.

I put up an alternate link it should work now.

on an Athlon 750 w/ Matrox g400 32meg dual monitor.

I get 85 fps without light.

When lighting I get a max 60 fps and it droppes to around 40 when the light intersects a wall.

Looks nice over all. Is the animation frame-rate independent?

I''d like to see it lighting the faces of the walls rather than just the simple circle. And I''d like to see the light fade out with distance.

Lookin'' good.

-mat




mat williamsLead Programmer, DesignerZero Sum Softwarewww.zero-sum.com
Right now it is frame-rate dependent, although it''s not much of an effort for me to make it time lapsed based. Basically I''m not going to deal with those issues until I add some more game play features, like custom gui elements, picking up objects etc.

I''ll work on getting the light to be a bit more realistic.
Hi Darrell, i think it might have been my posts about UO lighting effects..no? Anyways..
Comments about demo:
I tried your demo and unfortunately the lighting effects didnt work. What do i mean by didnt work? Well, here is what i mean: when i hit f4(i believe to turn on light) it made all tiles on the screen into triangles half white, other half normal color along with messed up color at character. Pressing i believe F6-F8 just changed the entire screens color, while keeping the messed up triangles. Total bummer.
Frame rates were in the 30''s to high 50''s with a decrease to about 10-15 fps when i first turn on lighting.

The problem probably arises from my crapped out 2d card so dont worry, here are my specs just for your info:
233 pentium w/mmx,64M ram, S3 virge DX(i didnt see how much memory, but its sure to be crappy)

Constructive Suggestions:
-Like the other poster suggested, for your next lighting update, you should fade out the light as it goes away from its light source..but make sure that the light doesnt spread out too far if your simulating light from a fire..its not too bright. 8)
-If i may say, the animation of the character were a little jerky in his movements. I believe its quite noticeable when walking in an angle. It looks like your trying to simulate him swaying side to side but its not working out..or i may be wrong and its a slight displacement of graphic..im not sure. On the same note, i noticed you are also simutating a shadow underneath him. Problem is its like a light brown color that stands out a lot. I havnt done this yet but here is my idea to make it more realistic: make the shadow a more charcoal black color(almost black) and instead of doing a solid shadow..do every other pixel so when you blit some of the color of background comes through but mixed with the black shadow pixels! It should look sweet.

Questions:
- I really liked your stairs and how the roofs would be taken off when player was inside structures! May i ask you you did the stairs effect of the player? If im not mistaken it did look like he was climbing an incline(aka stairs)...and tips or suggestions on how you did this would be appreciated.

Well, i hope you dont take my comments the wrong way. I only try to give my perspective on what you can try to improve on your design/art and is not ment as an attack. keep up your good work mate!


aka John M.
Never give up. Never surrender!


Thanks for all the great suggestions, and taking the time to run the demo.

As for the "triangles half white" half white effect, I think I know what might be happening. The alpha blending routine may not be working right for your card.
Did this happen in both fullscreen and windowed modes? It may be that your card is 555 for 16bit which I haven''t tested.

Try setting your desktop to 32 bit and run only in windowed mode and try the lighted modes.

F5-F9 should fade the screen darker and darker.
F4 resets the ambien tlight level
F2 turns on player light
F3 turns off player light.
F1 resets player speed
+ increases player speed
- decreases player speed

As for the bad character graphics if you look in the AnimationSets/HumanMale directory you''ll see all the frames for animation in bitmaps, I probably missaligned them causing that jerkyness.

Again thanks for all the great input, I esp. like your idea about the shadows, which I''m going to implement.

I gotta run now, but I''ll post on howto do my height effects later on tonight.
I''m going to try to explain how I did my height system for the benefit of GalaxyQuest and whoever wants to read this.

I''m going to assume a basic understanding of isometric map systems, that is you know how to blit base tiles/layers etc.

My map structure is seperated into base tiles and objects. If you download the demo you''ll see in the Projects directory .bin files and .dat files. bin hold tile data, dat hold object data.

While only one tile can occupy a tile space in my map, many objects can occupy a tile space. Each of these objects cannot exist however at the same height. (Except floors more on that later)

In essence they are stacked upon one another to give the visual effect of height. My algorithm allows objects also to float in mid air, i.e. I can specify that they are stacked on mid air.
For each object in position (x,y) I can specify a height value.
The only exception is that I can place floor objects at the same height level as any object I want. Floor objects act as my platforms so that a player may walk at higher elevations.

If you run my map editor, you''ll notice that setting on the tool bar show current draw level = 0 , and draw levels from 0 to 64 are set.

All of my walls are of height 16. So level is from height 0 to height 15. Level 2 is from height 16 to 31. etc.

My stairs are of height 8. So 2 stairs beside each other, one placed at height 0 and the other placed at height 8 results in a transition from height 0 to height 8 to height 16. This gives the illussion of moving up to the 2nd level. When my player moves up in height I offset my drawing to shift my screen down height*4 pixels. My clipper is also moved up 4 pixels to show more of the upper area of the screen. Basically I''m adjustimg by viewing coordinates by 4*height pixels. Stairs can be any height, if you have lower stairs it just takes more of them to get upto the next level, and makes the animation smoother.

Why 4 pixels? Notice my walls are of height 16. Well 16*4 = 64 which is the height of my walls in pixels (look at the bitmaps if you don''t beleive me). I call this my height step. This allows for greater heights. I''ve forced my heights to be <64 so that they fit in a byte and leave two bytes for flags to be used later if I wish.

When running my demo press F11, this switches into coordinate mode, and gives x,y,z positions as output on the screen.

Step on a stair, notice your height is now 8. (8*4=32 pixels above the base tile under that stair object) Notice the screen shifts down exactly 32 pixels. If the player then steps up again 8 pixels then the screen shifts down again 32 pixels for a total of 64 pixels. Which is the height of my walls, and the dimension of my tiles.

Now for the disappearing roof trick:
After each player move I check if there exists an object above the player. If so I only draw the players current level. So of the player is at level 0 and he walks under a bridge, no objects at level 1 or higher are drawn (ie height level 0 - 15 are drawn.) Try this out in the map editor select draw heights 0 to 15 only and you get the effect of the walking into a building.

As the player walks up stairs, if he walks upto height 16 (level 1) and there exists more objects above him then only draw levels 0 and 1 (ie height 0 to 31).

This gives the effect that only things at the players level or below are drawn if the player has more objects above him. Go into the brick building north east of the starting position of the demo for a 3 level building.

Again playing with the tile editor''s draw level will show you how the engine restricts drawing each level.

I hope this helps, if not I''ll be more descriptive with code/examples in email or a tutorial with code if enought people are interested.
Yes nice

but also i think light can not walk through obstacles...can it?
u have to make light down when its over higher surfaces also

you need a line of sight algorithm

check my tile lightning in my rts demo:
www.gdarchive.net/bogdanontanu/index/htm
(downloads section)

notice that a ground unit can not see over teeeain obstacles if no air unit above?

What i wanna say is i started like you (nice circles) but i had to drop them because of "Line of Sight"

i will also post the Map editor there someday (about 1 month from now i think) but i have to say yours looks more elaborate

Nice work man
obysoft
Hi again. Well, i dont quite understand what you mean by "put into 32 bit mode"..i assume your talking about the display resolution..in which case my crappy card has a limit of 24bit color. My first test of your demo was on 16bit color mode when the triangles and stuff messed up demo. I then maxed it at 24bit graphics and no go! I got 0(zero) fps in window mode! Full-screen mode was pretty much the same as before with 16bit. Just thought you would like to know.

Question: Did you use this lighing effect with the MMX alpha-blending artilcle here on gamedev?(or am i confusing alpha-blending with this type of lighting effect..hmm)

As to your height design...ill have to re-read it a few times but it sounds like a nice idea...may i ask if you found any articles that helped in your implementation of this?

aka John M.
Never give up. Never surrender!


This topic is closed to new replies.

Advertisement