Sonic and Sega Retro Message Board: Working Palette Cycling in GM - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 3 Pages +
  • 1
  • 2
  • 3
    Locked
    Locked Forum

Working Palette Cycling in GM Need help testing this on other machines

#1 User is offline Mercury 

  Posted 07 May 2011 - 03:48 AM

  • His Name Is Sonic
  • Posts: 1711
  • Joined: 13-November 08
  • Gender:Not Telling
  • Location:Location Location
  • Project:AeStHete
  • Wiki edits:130
It's no secret that I like palette cycling. What I've always found pretty annoying, though, is that there's no native workable solution to get the effect running in Game Maker (which is what I'm making my Sonic engine in). Some levels absolutely rely on it or they look lifeless and lame - just picture Techno Base without it! More importantly, it's used to animate huge waterfalls that would be a real pain to make with sprites in GM.

Well, after lots of searching and beating my head against solid surfaces, I finally found a pixel shader solution that works. It's easy for me to implement even with my feeble grasp of shaders, and runs on both of my machines (they're about 5 years old, I guess) without slowdown.

So, I want to know how it works for anybody else. Download this demo of the effect and run it. If it runs on a fair amount of systems, I'll go ahead and use it for my engine (and by extension Sonic Time Twisted will get the benefit, too).

(If I'm feeling particularly generous - and not too self-conscious about how kludged together it all is - I might also write a tutorial explaining how I did it. =P )

Thanks in advance! smile.png

EDIT: I realise now that, though I'm using this for a Sonic engine, it's really only tangentially related to Sonic and mods might want to move this to Technical Discussion (?).
This post has been edited by Mercury: 07 May 2011 - 03:50 AM

#2 User is offline Mester Keel98 

Posted 07 May 2011 - 04:29 AM

  • Stuck in the past
  • Posts: 479
  • Joined: 16-June 04
  • Gender:Male
  • Wiki edits:3
It works on my relatively lower end Vista and Windows 7 computers just fine.

On my XP Pro computers (the best of which is this, which isn't that great to begin with), not so fine.

The worst result was of the lowest possible form of low-end computers:


On my other XP machine, it gave me an error in the creation event of your object, telling me that Pixel Shader 1.4 was needed to run it.

I think most users here have way above my set-ups.

@ the guy below: There are easy, way-less-efficient methods of doing that.
This post has been edited by Mester Keel98: 07 May 2011 - 04:39 AM

#3 User is offline Lapper 

Posted 07 May 2011 - 04:30 AM

  • Freelance Artist
  • Posts: 1204
  • Joined: 15-June 08
  • Gender:Male
  • Location:England
  • Wiki edits:111
Hey, this is pretty good, you can now have animated backgrounds in GM, I haven't seen it done before.

It works fine for me (W7) in the demo, don't know how it would effect the speed of a game though.
This post has been edited by Sonica: 07 May 2011 - 04:31 AM

#4 User is offline Cinossu 

Posted 07 May 2011 - 04:32 AM

  • inverted with love~
  • Posts: 2718
  • Joined: 21-June 04
  • Gender:Male
  • Location:London, UK
  • Project:Sonic the Hedgehog Extended Edition
  • Wiki edits:474
180
Runs fine on here, Intel Core 2 Duo @ 2.2GHz, 4GB RAM, with the ATI Mobility Radeon HD 4570, running on Win7 Ultimate 64-bit.

As for the topic.. considering it's using Game Maker, and will be implemented into a fangame, I think it'd be better to have the topic in Fangames Discussion. It could be considered technical, with the use of the pixel shader, but I feel it'd be better placed for its resulting outcome.

#5 User is offline LOst 

Posted 07 May 2011 - 04:39 AM

  • Posts: 4879
  • Joined: 10-January 03
  • Gender:Male
  • Wiki edits:2
Hi Mercury. Your shader works on my computers. That was to be expected as shaders MUST work on my dev computers. Looks just like the water palette animation in Green Hill Zone.

About your shader, you are probably doing some fancy stuff like turning things grayscale as well as using the resulting 0-1 value as a texture coord...

As you can see I stopped there because I don't want to be too rude. Just prove that High Level Shading Language (edit: it is actually asm code, not HLSL) can be easily "stolen" from RAM, in form of the original source code sad.png That's the main drawback of shaders.
This post has been edited by LOst: 07 May 2011 - 04:46 AM

#6 User is offline Techokami 

Posted 07 May 2011 - 05:28 AM

  • For use only on NTSC Genesis systems
  • Posts: 1101
  • Joined: 19-November 05
  • Gender:Male
  • Location:HoleNet!
  • Project:Sonic Edge
  • Wiki edits:63
It works on my modern computer system (Intel Core i7, NVIDIA GeForce GT 240, Win7 Ultimate x64), but I don't feel like digging out my old 5+ year old laptop to test it on an older 64-bit AMD machine.

#7 User is offline Mercury 

Posted 07 May 2011 - 10:24 AM

  • His Name Is Sonic
  • Posts: 1711
  • Joined: 13-November 08
  • Gender:Not Telling
  • Location:Location Location
  • Project:AeStHete
  • Wiki edits:130
QUOTE (LOst @ May 7 2011, 09:39 AM)
As you can see I stopped there because I don't want to be too rude. Just prove that High Level Shading Language (edit: it is actually asm code, not HLSL) can be easily "stolen" from RAM, in form of the original source code sad.png That's the main drawback of shaders.

Actually my entire engine is going to be open source, so I don't mind if people can see the shader code. In fact, it's stored as a string in GM and passed to the shader extension to be compiled at initialisation, allowing someone with knowledge of shaders to easily make modifications. That someone wouldn't be me at present though - I'm just using a direct copy of an open source example here. I plan on boning up on them, though, now that I have a way to actually use them in GM easily.

Also, thanks to those who have tested so far! thumbsup.png

#8 User is offline Overbound 

Posted 07 May 2011 - 11:02 AM

  • Posts: 547
  • Joined: 09-July 08
  • Gender:Male
  • Location:Iowa
  • Project:Sonic Time Twisted Graphics/Level Design
  • Wiki edits:236
Works great for me Mercury. So glad you got this worked out. The water animation created as a result looks more fluid than the original GHZ.

#9 User is offline Overlord 

Posted 07 May 2011 - 03:59 PM

  • Cat-herder
  • Posts: 14494
  • Joined: 12-January 03
  • Gender:Male
  • Location:Berkshire, England
  • Project:VGDB
  • Wiki edits:3,204
Runs fine with a solid frame rate on my PC. Core 2 Quad Q8300, 4GB RAM, GeForce 9800 GT 512MB, Windows 7 Home Premium x64.

#10 User is offline DimensionWarped 

Posted 07 May 2011 - 08:20 PM

  • Erinaceous!
  • Posts: 2398
  • Joined: 05-April 07
  • Gender:Male
  • Location:Huntsville, AL
  • Wiki edits:5
Works fine. Radeon HD5770.

#11 User is offline Mercury 

Posted 08 May 2011 - 05:13 AM

  • His Name Is Sonic
  • Posts: 1711
  • Joined: 13-November 08
  • Gender:Not Telling
  • Location:Location Location
  • Project:AeStHete
  • Wiki edits:130
QUOTE (Overbound @ May 7 2011, 05:02 PM)
Works great for me Mercury. So glad you got this worked out.

Great! STT won't have to have that static "Game Maker Sonic" look anymore.

QUOTE
The water animation created as a result looks more fluid than the original GHZ.

That might be because I didn't bother to find out the actual speed of the original. =P

Though, certainly this shader solution can allow improvements to the look - more tweener colours, more colours cycling at once, etc.

Also I've been learning about shaders and have done a few tests - water/heat distortion should be possible, too.
This post has been edited by Mercury: 08 May 2011 - 05:14 AM

#12 User is offline Azu 

Posted 08 May 2011 - 05:38 AM

  • I must be stupid.
  • Posts: 1463
  • Joined: 23-February 08
  • Gender:Male
  • Location:Home
I have no issues here. Works just fine. 8400GS.

#13 User is offline RGamer2009 

Posted 08 May 2011 - 02:25 PM

  • True Blue
  • Posts: 2434
  • Joined: 27-November 08
  • Gender:Male
  • Location:Wherever life takes me...
  • Wiki edits:3,086
Works perfectly on my 64-bit Window 7 Home Premium.

Also the framerate drops down a bit when you move the window around, but I don't think thats much of an issue.

#14 User is offline DalekSam 

Posted 08 May 2011 - 02:32 PM

  • Resident Tsundere
  • Posts: 1908
  • Joined: 19-February 08
  • Gender:Male
  • Location:Northern Ireland, Belfast
  • Project:Sonic Thrash, Sonic Boom, Super Famidev
  • Wiki edits:165
Runs with considerable frame-skip. Seems to be too system intensive for my computer.

#15 User is offline Overbound 

Posted 08 May 2011 - 05:45 PM

  • Posts: 547
  • Joined: 09-July 08
  • Gender:Male
  • Location:Iowa
  • Project:Sonic Time Twisted Graphics/Level Design
  • Wiki edits:236
QUOTE (Mercury @ May 8 2011, 05:13 AM)
QUOTE (Overbound @ May 7 2011, 05:02 PM)
Works great for me Mercury. So glad you got this worked out.

Great! STT won't have to have that static "Game Maker Sonic" look anymore.

QUOTE
The water animation created as a result looks more fluid than the original GHZ.

That might be because I didn't bother to find out the actual speed of the original. =P

Though, certainly this shader solution can allow improvements to the look - more tweener colours, more colours cycling at once, etc.

Also I've been learning about shaders and have done a few tests - water/heat distortion should be possible, too.


Using shaders sounds like it will open up a lot of possibilities for us. But I also wonder are their limits? In Attraction Attack for instance we talked about doing the spot lights coming from the city in the background. Vexer also made a couple of flashing decorations that could be done with tiles and shaders or animated objects. Then of course there's the house shoe pattern again. So I guess the question is how resource intense are these shaders?

  • 3 Pages +
  • 1
  • 2
  • 3
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users