Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Alone in the Shadows: Ludum Dare #22 Entry  (Read 7878 times)

0 Members and 1 Guest are viewing this topic.

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Alone in the Shadows: Ludum Dare #22 Entry
« on: December 24, 2011, 11:18:55 pm »
Here is a link to my entry to the Ludum Dare #22. It uses SFML for windowing, render textures, text, and sound.

Download link: https://sourceforge.net/projects/aloneshadows/

As always, you will need the VS2010 runtime environment, linked in the readme.

Here is a screenshot:

Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #1 on: December 25, 2011, 01:00:15 am »
Very nice, I especially like the lighting system! Did you implement it with OpenGL lights?

And I find it rather difficult, sometimes you're almost instantly dead. Some remarks:
  • In the Line Wars level, I could slip diagonally through walls (from A to B in the drawing, where # are walls). I even managed to leave the playing area and to move in the black. Like this it's possible to survive very long...
Code: [Select]
#B
A#
  • The title says "Gore Factor SFML", seems like you forgot to change it ;)
  • The detection of the mouse over buttons is not correct
  • Before, I had the machine gun, a black fast enemy chased me, I ran away backwards and shot it for about 3 seconds, after that I was dead. I think usually that enemy dies faster, might there be a bug with close enemies?
  • It would be really nice if you increased the resolution a little bit :)
  • It looks like you also catch events when the window is not focussed. Partially, this is an SFML problem resulting of the new global inputs.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #2 on: December 25, 2011, 04:00:25 am »
Thanks for the feedback!

I showed this game to some of my friends, and they noticed many of the same issues. This is the most glitchy game I have made so far. Since the timers still run even while the rest of the game is frozen, you can go through a wall by hugging up against one and then dragging the window. Since the movement is frame-independent, the player will tunnel through the walls with a large enough time step.

The super fast enemy definitely needs to be nerfed! Its collision box is actually smaller than the distance at which the player holds the gun away from his body, so you cannot hit if it is too close. A bit of a problem.

Oh, and the pixelation shader was my attempt to hide my horrible art :).

The lighting was done with OpenGL directly, but not with any built in lighting or lighting used for 3D. It is the same system I use in Gore Factor. The lighting system actually comprises about 90% of the effort put in the game :wink:. Here is an explanation of how it works:

There are lights, emissive lights, and convex hulls. The lights come in 2 variations: purely dynamic and semi-static. The former means that the shadow geometry is regenerated every frame, and the later only updates when a hull it affects moves. Otherwise, it re-uses the previous geometry that is stored on a render texture.

Lights, emissive lights, and convex hulls are all stored in their own quad trees. With this, I can query which lights are visible on-screen and then rapidly query which hulls each of the lights affects. I then use an intermediate render texture to render a light with all of its shadow geometry.

The shadow geometry is generated in 2 steps: First the umbra portion, and then the penumbra. The umbra is generated by cycling through all the points in a convex hull and taking the dot product with the normals of all the sides and a vector to the midpoint of a side. This is then used to determine which sides are back-facing. After that, the shadow boundaries can be determined. The shadow geometry isn't rendered by color, but rather replaces the stencil test by using the depth buffer to create regions where the light won't draw. After that, the light is drawn.

After the light is drawn, the soft regions are computed by offsetting the original light-to-hull vertex vector origins by the radius of the light source. 2 vectors are calculated, which can then be used to render the soft shadows texture, which is just a gradient. This is applied to the light edges with multiplicative alpha blending, causing it to fade into darkness.

When the light is finally composed, it is rendered to the lighting render texture. This lighting render texture is rendered to the scene after all lights have been rendered using multiplicative blending.

All the maths are based off of what is presented in this article: http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/dynamic-2d-soft-shadows-r2032
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #3 on: December 25, 2011, 10:42:30 am »
Wow, thanks a lot for the detailed explanation and the link! That's a very interesting topic :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Haikarainen

  • Guest
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #4 on: December 25, 2011, 04:03:37 pm »
This doesn't work in Windows 7 Ultimate x64 running on an Core i5 and Geforce 615M.

You can start it and see the "previewbox" when you hover over it in the taskbar, but it's impossible to give it focus or even see the window. Will try this later on another computer. If you have a linux version I might try it there to.

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #5 on: December 25, 2011, 11:25:15 pm »
I heard from others that they had the same problem. I think is has something to do with the slightly messed up compilation settings. This game is very glitchy, despite it using a lot of the base code from my other game "Gore Factor", from which I have never heard a single complaint. Lesson learned for LD23: Test your games!
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Haikarainen

  • Guest
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #6 on: December 26, 2011, 12:42:33 am »
Allright! I tested it successfully on my stationary computer. To give you comparison specs;

This computer:
Processor: AMD Athlon II X4 645 ~3.1Ghz
RAM: 8192MB DDR3 XMS3
GPU: AMD Radeon 6870 1GB GDDR5 Black Edition
OS: Windows 7 Ultimate x64
Results: Works OK! Menu button has a little laggy positioning but it works.

My laptop:
Processor: Intel Core i5 2410m x4 ~2.3Ghz
RAM: 4096MB DDR3
GPU: NVidia GeForce 315m 512 MB GDDR3
OS: Windows 7 Ultimate x64
Results: Does not work! Refuses to catch focus, renders properly on Win7-taskbar layout.

BTW, Could you maybe share your code for the shadow/lightning-system? I want to read that, and the article you posted to learn how to do it on my own,  I wont use it directly in any project.  Would be nice with just those classes and implementations, not the whole project. If you do, and I use that kind of lightning in an upcoming steam-project, I'd put you on the "Thanks to"-list!

Cheers :)

Edit; And oh right, the game ;) I REALLY enjoyed it actually! Reminds me of doom somehow.

+ for the Music, the really smooth lightning system and the sweet gameplay!

- for the "new weapon spawned", to make it more fit to modern survival games, either give them directly to the player, or have a shop or something placed on the map where you can buy it. Also some enemies are just way to brutal :P

Also, what native resolution do you render in? Everything seems scaled up.

Great work!

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #7 on: December 26, 2011, 02:06:49 am »
Thanks for the info!

If I had more time to write the game, I would have probably spent it balancing and debugging the game some more. But, my 48 hours went by way to quickly :).

You want to use the light system? Go right ahead! I will give it a simpler interface and clean up the code a little, and then upload it separately. I will notify you when it is done, it shouldn't take long :).
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Haikarainen

  • Guest
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #8 on: December 26, 2011, 02:30:34 am »
Quote from: "lolz123"
Thanks for the info!

If I had more time to write the game, I would have probably spent it balancing and debugging the game some more. But, my 48 hours went by way to quickly :).

You want to use the light system? Go right ahead! I will give it a simpler interface and clean up the code a little, and then upload it separately. I will notify you when it is done, it shouldn't take long :).


Thanks dude! that would be really appreciated! :) Even though it was a competition entry, you should totally work on it! Sound effects gives a lot in a game btw ;)

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #9 on: December 26, 2011, 03:37:54 am »
Is it OK if the lights are limited to a certain region (were you can still receive the benefits of the quad tree) that cannot be changed during run time? This is the same problem encountered by physics libraries like Box2D: the spatial partitioning system has boundaries. I am currently writing a self-expanding quad tree to solve this problem, but it is still very buggy (and also ever so slightly slower). I have used the older version for a long time now, and I haven't encountered any bugs yet. If you are not doing stuff like procedural terrain generation, it isn't needed anyways.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Haikarainen

  • Guest
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #10 on: December 26, 2011, 03:58:44 am »
Quote from: "lolz123"
Is it OK if the lights are limited to a certain region (were you can still receive the benefits of the quad tree) that cannot be changed during run time? This is the same problem encountered by physics libraries like Box2D: the spatial partitioning system has boundaries. I am currently writing a self-expanding quad tree to solve this problem, but it is still very buggy (and also ever so slightly slower). I have used the older version for a long time now, and I haven't encountered any bugs yet. If you are not doing stuff like procedural terrain generation, it isn't needed anyways.


Allright, that's no problem, anything you give me is appreciated :) As said I just want to learn how to achieve such effects, not rip your code off ;P

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #11 on: December 26, 2011, 05:47:29 am »
Alright, I uploaded a test application for the lighting system with the source. I can write a little manual if you like.

Here it is: https://sourceforge.net/projects/letthebelight/
As always, you need the VS2010 runtime environment to run the test app.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Haikarainen

  • Guest
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #12 on: December 26, 2011, 05:27:54 pm »
Quote from: "lolz123"
Alright, I uploaded a test application for the lighting system with the source. I can write a little manual if you like.

Here it is: https://sourceforge.net/projects/letthebelight/
As always, you need the VS2010 runtime environment to run the test app.


Thanks! Why is VS necessary? Is this compilable on a GNU environment(gcc, gdb)?

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #13 on: December 26, 2011, 05:58:13 pm »
It is all cross platform. I only compiled the test application in VS2010.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Alone in the Shadows: Ludum Dare #22 Entry
« Reply #14 on: December 28, 2011, 11:13:54 pm »
Looks very good. I am going to try it today.
I missed this LD... the weekend LD was scheduled was my finals weekend.
CJ

 

anything