The Fog - Survive! <<Multhithreaded game logic is done!>>

This is my new game. It should be called Looking At Grass, because that is all you can do so far. Eventually there will be monsters that eat you, and lost people to save, villages to build, but for now, you can watch the sun rise, look at the grass, and admire my GLSL fog effects.

Here is a video showing my day/night cycle, with multiple lights and shadows:

It’s built using JMonkey Engine.

UPDATE: I have got multithreaded game logic working. Entities think and do! Monsters hunt and kill, humans forage for food…

I love how the mountains and sky are always sunny, even at midnight. :wink:
Is there a sun you can actually see? Or is it just a light source?

Btw, your image link is broken and I can’t find the real link.
Edit: You fixed it.

There he/she is! :slight_smile:
We’ve talked about you just yesterday :smiley:
(see the latest JMonkeyEngine discussion)

Anyways, looks great so far :slight_smile: obviously needs work, but I love the shadows :slight_smile:

Yes, my sky box needs to be dynamic - at the moment it is just a default skybox as something needs to be there for the JMonkey Engine shaders to work as expected.

You might notice in the video that the FPS is quite low - 29 or so - but that is partly because I’m recording video, and mostly because the game is running on my Radeon Mobility 3450.

I have added a dynamic sky box to the game, with changing sky color and a moving sun. All I need to do now is add clouds and stars :slight_smile:

Sun casting a shadow:

Morning:

Evening:

That last picture with the sun setting looks very nice. :slight_smile: I like the changing sky color.

Here is a new video, showing my weather code - I can generate lots of different cloud effects from one cloud image:

I need to sort out how the mid range clouds look - they get too bright, but I’m happy with the thick and wispy cloud effects.

In addition to controlling the thickness of the cloud layer, I can also control the raw brightness of the cloud, so I can turn clouds black at night, or make very overcast skies look dark and threatening. Although the thickness and brightness jumps by large amounts in the video, I have much finer-grained control than that - for the demo I just mapped 0.1 increments to the keyboard.

The horizon gave me a lot of trouble.

Nice perlin noise clouds! And a good choice of engine :wink:

Thanks. Although the clouds are not perlin noise - they are the B channel from the cloud/stars texture. I pass the image through some simple calculations to generate different levels of cloud, and various shades of gray. I looked at perlin noise and it seemed a lot of processing for something I could get from a texture. I get join lines where the texture repeats, I can’t solve that yet and it is driving me crazy!

The G channel of the texture is the high altitude cloud layer - I still need to add that. Think of it… two layers of cloud with different speeds and directions, densities and cloud types :slight_smile:

The other two channels will be stars, but I’m not sure how to get enough resolution from a 1024x1024 texture. I think I might have to make a circular repeating texture for the stars too, rather than just two star domes as I originally planned.

I put a video on youtube, titled “The Fog - Survive… with weather control”:

You know youtube shows a sidebar with related videos? I’ve been filed under ‘insane conspiracy theories’. Some of the so-called related videos include:

The Chemtrail and Geoengineering Conspiracy - New Evidence August 2012
BREAKING NEWS Army has sprayed citizens with radioactive particles
Weather war big picture
Ben Livingstone: The father of weaponized weather
LITHIUM SPRAYING OVER US IN ROCKETS AND CHEMTRAILS (HD)
The US Military will use weather as a Weapon on American Citizens
…and so on.

The clouds in the video look a little bit too low, maybe you should put them higher…

EDIT:
Maybe it’s just the horizont, which shows that the clouds are just a flat planar.

Thanks, I know what you mean about the clouds being too low. I don’t think my maths is wrong, I think I need to add a cheat to make near clouds seem to recede higher. It could also simply be caused by the speeded up time, which may influence the sense of how far away the clouds are.

I’ve started work on this one once more… the entity system and world simulation. I want to get all the entities interacting and then I will tie the sim back to the OpenGL and add in the ability to be a player in the world.

Looks like a cool project! Keep it going, I like the weather video. There seems to be to much contrast between the sky and ground on the most cloudy weather setting though.

True, I need to adjust the ambient and point light sources based on the level of cloud cover, and really work on exactly how gray the clouds should be.

Still working on this project. Whenever I do some work on Fog, I get a bright idea to make some other app. My latest distraction was this, Barn Door Clock, the most obscure app ever published on Google Play:

https://play.google.com/store/apps/details?id=com.agslinda.barndoorclock

Anyway, I am now working on Fog again and I have put graphics to one side to focus on the entity system. I’ve written an entity system that looks a bit like an object database. The number of entities is large, but you can define indexes on the entities so the information should be slow to write but fast to read.

I also have object position stored as primitive ints with millimeters as the scale, so I can represent an area of 2000km x 2000km, sticking to positive ints.

While working on it I came up with a new (much smaller) game idea - similar to Diplomacy, but in a fantasy setting rather than WWI. It would play nicely on a small screen I think…

My entity system is running sweetly now. I am using multithreaded logic to update about 3200 AIs in about 4ms. When game speed is increased x20, updates are still sub-10ms on my A10-5750 laptop.

I split the map into stripes and then process the all the odd-numbered striped in parallel, then all the even-numbered stripes, so that there is no chance of two threads touching the same object at the same time, or not seeing the updated state from another thread. The game does have some long-range interactions which break the system, but when I get to those I will just queue all long-distance interactions for the next frame.

I don’t care so much about the user interface, so I am toying with letting it run in parallel to the logic loop. That would mean that the game would render slightly inconsistently, but would people notice ~16ms inconsistencies?

AIs are doing great. My monsters hunt for humans, and then eat them, and the humans get hungry and forage for food.

Your persistence with this project is admirable. I love that feeling when a complex redesign of a system is completed successfully.

Perhaps have something like this to couple the UI to the game loop?

Hmmm… the game world is currently 6km x 6km, but the UI is only rendering 0.6km x 0.6km at most (much less most of the time, the game is called Fog after all ;D), so we don’t need to queue most elements. Maybe I need to grab the entities near the camera and render them upfront, pass them off to the UI, and then carry on with the logic for the rest of the world.

Thanks for the compliment about persistence. I have a problem that I get distracted by other projects… but I really want to finish this.

I guess I meant the GUI, however now that I think about the misconception, I realize GUI being on separate threads is normal anyway…

For separating rendering and logic, a common system is for the logic thread to send snapshots of each logical frame to a queue, from which the render thread consumes the most recently computed frame, sometimes (if you’re fancy) interpolating multiple frames.