Jump to content


Photo
- - - - -

Advanced Shockwave/glass-effects For Gm 6+


  • Please log in to reply
37 replies to this topic

#1 thenoller

thenoller

    GMC Member

  • GMC Member
  • 208 posts

Posted 02 April 2005 - 12:41 AM

  • Title: Shockwave Effect
  • Description: A nice looking distortion effect done using surfaces
  • GM Version: GM6
  • Registered: Yes
  • File Type: .zip
  • File Size: 2.3MB
  • File Link: Posted Image
  • File Mirror : http://www.host-a.ne...k13673/wave.zip
  • Required Extensions: No
  • Required DLLs: No

Summary

Made this example long ago but fixed the links after quite a while - I'm currently working on a set of tutorials to explain how to use surfaces and textured drawing to create certain effects - possibly including improved versions of these scripts.

You need GM6.0 or older (registered/pro version) to run the gm6-file!

How did you make this?
Primary by using texture primitives combined with surfaces, and then drawing parts of the screen with some offsets.
It's hard to explain, but I recommend you to look at the comments in the scripts.

Does this work in 3D?
Surfaces does not work in 3D - I assume it wouldn't be possible; however i recommend you to keep an eye out for another tutorial I'm about to make, where I explain ways to create realistic 3D-effects without going into 3D-mode.

Is scripts taking up lot of CPU?
I had to call and draw at least 20-30 scripts in order to make the system lack. That equals to about 800-1200 textured vertexes. I guess that surfaces and texture primitives are not the worst when it comes to performance.

It's awsome! Can i use it in my game?
You're free to use any of the scripts, but I ask kindly that you give me credit (My name and "compagny" is: Nils Rungholm Jensen - Northern Realm Jackal Gaming).

Hope I've made myself useful.
You will hear from me again soon.


MODERATOR EDIT : This topic has been fixed by me as the effect is really well done and looks fantastic.

Edited by Nocturne, 22 January 2012 - 07:51 AM.

  • 4

#2 fhd

fhd

    GMC Member

  • GMC Member
  • 149 posts
  • Version:GM:Studio

Posted 06 April 2005 - 03:18 PM

where exactly we must put these codes in the example ..??

the example run smooth in my PC.
  • 0

#3 ChunkOfAsbestos

ChunkOfAsbestos

    GMC Member

  • New Member
  • 54 posts

Posted 29 April 2005 - 02:17 AM

Hmmm... but, how would you get an object to do that every say... Alarm 0?
  • 0

#4 Dantai_Amakiir

Dantai_Amakiir

    GMC Member

  • New Member
  • 386 posts

Posted 02 May 2005 - 04:25 PM

cool effects

on the magnifying glass one, if you zoom in too far, the image flips upside down
  • 0

#5 GMakerExtrodinare

GMakerExtrodinare

    GMC Member

  • New Member
  • 175 posts

Posted 20 May 2005 - 08:38 AM

Really awesome effects, this makes me want to register ;)

Do these waves effect everything on screen? Or just the background?
  • 0

#6 ForteMP3

ForteMP3

    Shmupper For Life!

  • New Member
  • 67 posts

Posted 27 May 2005 - 04:41 PM

VERY impressive script. While I'm not sure how it would work on my laptop if I used it in my game, I'm sure my desktop could handle it without any problems.

I must say, this is a beautiful set of scripts you've created, and I'm sure a lot of people will be getting ideas of what they can do with them (I already have one!)

However, I have noticed something a bit odd while messing with your example. To see what it might do with sprites, I made a small red X sprite and an object to correspond to it. No code, they just sit there on the screen. Anyway, I've placed them in the first room (The water one) and the one with the greenish background. When I first create some waves in the water room, the sprites are completely overlapped, as if they aren't there (IE, the effect is drawn over them entirely). Once I get to the green room, however, they're distorted as one would expect when inside the wave effect. Strangely enough, if I return to the water room and do the waves again, this time the X objects ARE affected by the waves. Any idea why they'd be drawn over on the first run, but not the second?

I ask this because the idea I have would be taking sprites into account, I'd want them to be distorted by the effect just as backgrounds would.

Anyway, as for performance, as a standalone it ran without slowdown until I started clicking fast enough to have about 20-30 of these suckers onscreen at once. Even then it didn't slow down to an extremely slow speed, but there definately was notable slowdown. I'll try this on my desktop (My main gaming machine, my laptop is my main game developing machine) a little later and tell you how they ran there as well.
  • 0

#7 viestituote

viestituote

    The Moinen

  • New Member
  • 84 posts

Posted 29 May 2005 - 12:42 PM

No I have not seen the effect before, in GM games that is.

This is a very beautiful effect and reasonably fast too. I'm glad you're letting me use it without bounds. I don't have an exact use for it right now, but I would even be ready to change my game a bit if that made it possible to include such a nice eye candy.

The only obvious drawback is that drawing it dynamically over animate objects would be a lot slower. I didn't test it, but taking a screenshot every step would certainly not be good for the framerate. But for example a ripple or an explosion shock wave would more likely traver on the surface of the game level, that is, under the sprites.

In the matter of fact, I've tried to produce this effect twice myself. During the GM5 era someone asked me, a GM mentor, if I could make this happen. And I actually used a similiar method to yours, but it was too slow to work. Later on I tried to make those steams that distort the background when a Formula One race is starting for a racing game I was making, but realized that to be to slow for GM5 too.

A great script, this'll go in my collection of snippets for future use, thank you.
  • 0

#8 Indecom4000

Indecom4000

    GMC Member

  • GMC Member
  • 1578 posts
  • Version:GM:Studio

Posted 29 June 2005 - 06:39 PM

This is a great example, but for those of us that can't download, do you think you could post the source code for the scripts? That would help me alot, thanx.
  • 0

#9 brosBM

brosBM

    GMC Member

  • New Member
  • 139 posts

Posted 26 July 2005 - 05:57 PM

Very good work on the waves; I especially like the wave_inv function and black hole effect. I just saw a minor bug at the end of effects that use the draw_wave function, which is a small "twitch" in the edge of the wave right before it disappears.
  • 0

#10 thenoller

thenoller

    GMC Member

  • GMC Member
  • 208 posts

Posted 11 June 2008 - 09:47 PM

To everybody that has been complaining - I fixed the links; I know of most of the bugs in this example, but I'm not going to correct them before I release a new version anyway.
  • 0

#11 RamboFox

RamboFox

    Tainted Fortune

  • New Member
  • 992 posts

Posted 17 June 2008 - 02:32 AM

To everybody that has been complaining - I fixed the links; I know of most of the bugs in this example, but I'm not going to correct them before I release a new version anyway.

...but is it view compatible?...
  • 0

#12 thenoller

thenoller

    GMC Member

  • GMC Member
  • 208 posts

Posted 23 June 2008 - 12:48 AM

To everybody that has been complaining - I fixed the links; I know of most of the bugs in this example, but I'm not going to correct them before I release a new version anyway.

...but is it view compatible?...


It should be, as any used positions are fixed, and not relative to the view. Notice, however, that updating an entire room-size surface that is not view all at once, is properly not necessary.
  • 0

#13 T. Westendorp

T. Westendorp

    GMC Member

  • New Member
  • 1270 posts
  • Version:Unknown

Posted 28 June 2008 - 09:51 AM

Get a different host... Can't download anything from that site... Cos there is NO DOWNLOAD BUTTON DISPLAYED on the page.
  • 0

#14 Dead1yM00

Dead1yM00

    GMC Member

  • New Member
  • 191 posts

Posted 03 July 2008 - 06:52 AM

Get a different host... Can't download anything from that site... Cos there is NO DOWNLOAD BUTTON DISPLAYED on the page.


you have to enter the colored numbers/letters you see in the top right hand corner to start the download.
  • 0

#15 MaZice

MaZice

    GMC Member

  • GMC Member
  • 5 posts

Posted 07 November 2008 - 04:48 PM

Awesome effects!
Is there any chance to use them in a huge room? Like, 8000x8000.
I tried that, but after going away from the x=1000 or y=900, the surface started to turn black and weird, showing waves purely black.
Best regards!

Edited by MaZice, 07 November 2008 - 04:48 PM.

  • 0

#16 fasteddy_jones

fasteddy_jones

    Anarchist

  • GMC Member
  • 663 posts
  • Version:GM8

Posted 07 November 2008 - 05:20 PM

I'd really like to see this but your host just wont let me, everytime i downlaod it the connection gets reset and it ends the download,

fasteddy
  • 0

#17 ApplePiePod

ApplePiePod

    GMC Member

  • New Member
  • 406 posts

Posted 07 November 2008 - 05:37 PM

MaZIce, surfaces normally have a max size of 1024x1024.
  • 0

#18 MaZice

MaZice

    GMC Member

  • GMC Member
  • 5 posts

Posted 07 November 2008 - 05:40 PM

Yes, but I've saw already some techniques (like icuurd's Low Cost) that tile surface to cover giants rooms. I tried that one, but it doesn't work well with this wave example. Maybe someone has achieved this already, and I'm asking for that =)
Salutt!
  • 0

#19 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 21733 posts
  • Version:GM:Studio

Posted 07 November 2008 - 05:49 PM

I´ve spoken to thenoller about the surface problem as he didn´t know about it and I´ve sent him a gmk demonstrating the error... So we just have to sit back and wait for this outstanding example to be fixed for larger rooms... (if it can...) Oh and I use surfaces much larger than 1024x1024 and have no problems. It is true that they should only be multiples of 1024 however, and that some older machines have problems with anything bigger...

Edited by Mark13673, 07 November 2008 - 05:51 PM.

  • 0

#20 mireazma

mireazma

    GMC Member

  • GMC Member
  • 357 posts

Posted 19 November 2008 - 01:14 PM

Very impressing.
I always look at the fps - I've twitched the mouse button as fast as I could to see a drop in the fps... it never goes below 50. I expected to drop to around 10-15 fps.

offtopic: you could take a look in the following links:

http://w210.ub.uni-t...pdf/09warp.html
which is explained here:
http://en.wikipedia....wiki/Warp_drive

I suppose you can do it :)
  • 0

#21 LarQ

LarQ

    GMC Member

  • New Member
  • 12 posts

Posted 25 November 2008 - 04:47 PM

Hi, thank you for the example! :)
But I have a question many here have: the view compability...
I understand the whole script, I know it doesnt matter what the room size is,
but when my view goes out of the range of the room_width and room_height it goes sort of black.
My room is 700x4500 (it scrolls upside down with view 700x500)
So Ive put in the code of the surface: (room_width,500) //room width doesnt matter, xview always the same.
But when the view_yview goes above the 500, you get the black wave thingy...
Please help me!

PS: sorry for mispelling ^_^

Edited by LarQ, 25 November 2008 - 05:00 PM.

  • 0

#22 Ezion

Ezion

    GMC Member

  • New Member
  • 38 posts

Posted 22 December 2008 - 08:19 PM

I've been beating my head against the wall for the last several hours based on the same "black texture" problem the previous few posters are having. I've tried setting the global.surface variable that holds the screen at my current view position, and I've tried freeing and remaking the surface every step (in hopes that surfaces are set to the origin of your current view. Tiling the surface doesn't appear to work, and manually setting the surface size to 2048 by 2048 also yields no results (seems to make no difference than the default room_width and room_height arguments). I've tried screen_refresh() as opposed to the script's screen_redraw(). I've also tried getting a sprite of the screen and then drawing that to the surface (I was running out of ideas). In short, my script-fu is not strong enough.

So...anyone know how to make these scripts work outside of my default 1024x768 view (room size is 2048x2048)? Is it possible to set surfaces to have an x and y they follow (I assume this is the problem?)

*Edit: Concise description of problem:
The wave effects are created using textured primitives. The primitives get their texture from the global.srf surface, which takes a screenshot of the room every step. The problem is that the surface doesn't appear to extend past my view of 1024x768, and the room is much larger than the view. When the primitives are drawn outside of the surface (and thus, the texture), they are merely filled with a half-transparent black color, as opposed to the texture they are supposed to possess. I believe this is a problem of either the screen_redraw() function only drawing the first 1024x768 pixels of the room onto the surface or more likely, the surface is not drawn over the entire room, and I cannot find a way to move the surface with the view.

Edit2: In case my description of the problem is incorrect, I'll try to detail how the wave script functions.
1. Surface called global.srf is created. It is supposed to have the same dimensions of the room, but appears to have set dimensions at the first 1024x768 pixels of the room.
2. Screen_redraw() is called while target is set to global.srf to get a screenshot of the room.
3. In its drawing step, obj_wave invokes "draw_wave_off(x,y,global.srf,radius-10,200,-(-radius+200)/5,20,0,0)"
4. The draw_wave_off script creates a texture based off of the global.srf surface.
5. The draw_wave_off script creates a primitive textured ring at the passed arguments x,y on the texture
-> The ring is as wide as your specified width and the script tiles that ring outwards to reach the desired radius of your ripple's circle. The ring is also offset by argument5 to create the ripple effect.
6. The script draws the textures primitives on the default drawing plane in GM.

(I'm not 100% sure on how the vertices are created for the textured primitives in #5.)

Edited by Ezion, 22 December 2008 - 11:57 PM.

  • 0

#23 Nexer

Nexer

    GMC Member

  • New Member
  • 18 posts

Posted 25 December 2008 - 03:58 PM

Hi...

This example is really awesome. I didn't imagine that it was possible to make such sweet effects with GM..

Danish: Det styrer virkeligt grumt det her Nils.

I think I'll use one of your effects in my topdown shooter. And ofcourse I'll credit you as you kindly requests.

Good Job ;)
  • 0

#24 ultim8p00

ultim8p00

    GMC Member

  • GMC Member
  • 282 posts

Posted 28 December 2008 - 06:16 PM

Your link is down again. Megaupload isn't working.

EDIT: nvm, it's up now, but I suggest you add another mirror. The effect looks pretty sweet btw.

Edited by ultim8p00, 28 December 2008 - 06:20 PM.

  • 0

#25 FiLkAtA

FiLkAtA

    GMC Member

  • GMC Member
  • 536 posts
  • Version:GM:Studio

Posted 28 December 2008 - 08:26 PM

Really impressive. And works fast enough if it isn't overused.

~FiLkAtA
  • 0

#26 ultim8p00

ultim8p00

    GMC Member

  • GMC Member
  • 282 posts

Posted 28 December 2008 - 11:10 PM

Yeah, as a few posters have pointed out this does not work very well with views
  • 0

#27 funlerz

funlerz

    GMC Member

  • New Member
  • 113 posts

Posted 04 May 2009 - 01:48 PM

hmm seems like it would be neat, but I don't really need it and I hate waiting for megaupload to let you download the file, maybe I will download this later.
  • 0

#28 FireProof Games

FireProof Games

    GMC Member

  • GMC Member
  • 107 posts
  • Version:GM8

Posted 07 December 2009 - 07:07 AM

Awesome effects!
Is there any chance to use them in a huge room? Like, 8000x8000.
I tried that, but after going away from the x=1000 or y=900, the surface started to turn black and weird, showing waves purely black.
Best regards!

I have the same issue! Would changing the variables for width from room to view and updating every step fix it? Or would it just slow everything down?
  • 0

#29 fhd

fhd

    GMC Member

  • GMC Member
  • 149 posts
  • Version:GM:Studio

Posted 09 May 2010 - 07:59 AM

I've been beating my head against the wall for the last several hours based on the same "black texture" problem the previous few posters are having. I've tried setting the global.surface variable that holds the screen at my current view position, and I've tried freeing and remaking the surface every step (in hopes that surfaces are set to the origin of your current view. Tiling the surface doesn't appear to work, and manually setting the surface size to 2048 by 2048 also yields no results (seems to make no difference than the default room_width and room_height arguments). I've tried screen_refresh() as opposed to the script's screen_redraw(). I've also tried getting a sprite of the screen and then drawing that to the surface (I was running out of ideas). In short, my script-fu is not strong enough.

So...anyone know how to make these scripts work outside of my default 1024x768 view (room size is 2048x2048)? Is it possible to set surfaces to have an x and y they follow (I assume this is the problem?)

*Edit: Concise description of problem:
The wave effects are created using textured primitives. The primitives get their texture from the global.srf surface, which takes a screenshot of the room every step. The problem is that the surface doesn't appear to extend past my view of 1024x768, and the room is much larger than the view. When the primitives are drawn outside of the surface (and thus, the texture), they are merely filled with a half-transparent black color, as opposed to the texture they are supposed to possess. I believe this is a problem of either the screen_redraw() function only drawing the first 1024x768 pixels of the room onto the surface or more likely, the surface is not drawn over the entire room, and I cannot find a way to move the surface with the view.

Edit2: In case my description of the problem is incorrect, I'll try to detail how the wave script functions.
1. Surface called global.srf is created. It is supposed to have the same dimensions of the room, but appears to have set dimensions at the first 1024x768 pixels of the room.
2. Screen_redraw() is called while target is set to global.srf to get a screenshot of the room.
3. In its drawing step, obj_wave invokes "draw_wave_off(x,y,global.srf,radius-10,200,-(-radius+200)/5,20,0,0)"
4. The draw_wave_off script creates a texture based off of the global.srf surface.
5. The draw_wave_off script creates a primitive textured ring at the passed arguments x,y on the texture
-> The ring is as wide as your specified width and the script tiles that ring outwards to reach the desired radius of your ripple's circle. The ring is also offset by argument5 to create the ripple effect.
6. The script draws the textures primitives on the default drawing plane in GM.

(I'm not 100% sure on how the vertices are created for the textured primitives in #5.)


Dear thenoller
please Answer us,we all have the same issue with larger rooms,please.
  • 0

#30 gmwiz2010

gmwiz2010

    GMC Member

  • New Member
  • 28 posts

Posted 09 May 2010 - 08:48 AM

Looks cool! nice work.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users