• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Surface fog effect.

L

Lars Karlsson

Guest
EDIT: I realized I didnt explain all that well. I'll update tomorrow with some pictures.

So I've got this extension that draws a players line-of-sight on to a surface which is working great. I think it's actually made for 'lights'. Can unfortunately not remember the authors name.

What I would like to do is copy that surface and merge that shadow map (see attached image) with a perlin noise iamge to create a fog effect. I've already generated the noise map outside of GM so that part is done.

Do I need to generate a texture from the noise map and blend(?) it with the copied shadow map somehow?
I understand that I have to set the blend mode to a specific one after the blend/merge.
If you could give some pointers or point me in the right direction I'd be grateful.

/Thanks.
 

Attachments

Last edited by a moderator:
M

maartenvt

Guest
Well loading an external image during runtime should be avoided, if possible.
Loading sprites and backgrounds from an external source can be done in GameMaker:Studio, as can creating new assets using functions like sprite_duplicate(). However each new asset that you create in this way will also create a new texture page, meaning that (for example) adding 10 new sprites will create 10 new texture pages! And each time you draw these sprites it is a new texture swap and a break in the batch to the graphics card.

As you can imagine, this is not very efficient, and so (unlike previous versions of GameMaker) it should be avoided, with all the graphic assets being added to the game bundle from the IDE. Note that you can use these functions for adding/creating small numbers of things and they won't adversely affect performance, but adding many, many images in this way should always be avoided as it will have an impact.
http://www.yoyogames.com/blog/23

So I would generate a perlin noise map on a surface at the start of the game (and whenever the surface gets destroyed, since this tends to happen sometimes due to the volatile nature of video memory) and blend this surface with your shadow map.
I recently helped someone who had a perlin noise script, you might want to use it: https://forum.yoyogames.com/index.php?threads/adding-a-falloff-map-to-perlin-noise.3618/
 
L

Lars Karlsson

Guest
Thanks for the help! I'll definitely check those links out when I get home.
 
Top