Jump to content
  • Advertisement
Sign in to follow this  
Nico_gamedev

how to code Axelay's scrolling?

This topic is 2554 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys,

SNES gamers may remember Konami's Axelay (shoot'em up): actually, I would be interested in coding a shoot'em up which could include Axelay's scrolling effect (as seen as in the very 1st level the game).

To code this graphic effect, do you have any hint or piece of info to share ? (or some math tricks?) :)

Thank you very much for your help!!!

PS: depending on your answers, I would use Java or C# or C++/SDL to code my game.

Share this post


Link to post
Share on other sites
Advertisement
Are you looking to emulate the actual technique used in the game (that involves per-scanline modification of graphics layer transform to fake perspective) or something that looks like it (3D geometry with true perspective and texture map)?

The former was used in the original game because robust 3D hardware that could handle the texturing was not available; the latter would be easier for today's hardware.

Share this post


Link to post
Share on other sites
Again, shaders would make it easy.

#ifdef GL_ES
precision highp float;
#endif

uniform vec2 resolution;
uniform float time;
uniform sampler2D tex0;
uniform sampler2D tex1;

void main(void)
{
vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy;
vec2 uv;

uv.x = p.x;
uv.y = 0.5*sqrt(1.0-p.y) - time;

gl_FragColor = vec4(texture2D(tex0,uv).xyz, 1.0);
}

Share this post


Link to post
Share on other sites
Regardless of the technique you end up using, the uv.y calculation in Antheus's shader is somewhat the precise formula used in the game (give or take some constant scaling).

The original effect used piecewise linear approximation, which is why there are progressive "zones" of perspective in the Axelay background. This approximation (should you want to emulate it too) could be easily achieved by using a vertex shader to interpolate the coordinates of a vertically-tessellated grid, instead of calculating them in the pixel/fragment shader. The vertex attribute interpolation is linear (hence the transitions between "slices" would also be piecewise linear).

Share this post


Link to post
Share on other sites
Thank you very much, for your precise answers!!!

Antheus, thanks a lot for your shaders (the Axelay-like shader and the sinusoidal fx) and for the ShaderToy link ! This is very handy!

By the way guys, I'm a total newbie about these shader-things, so here's my newbie question (sorry :rolleyes: ) : guys, what would you choose between Java, C# or C++(SDL) to code a game with such shaders ?

(...and, if you know some cool links/tutorials to help me begin from scratch with shaders, don't hesitate to tell me about them :) )

Once again, thank you very much!!!


PS: if you want to spend 5mn on a puzzle-game I coded, click here .

Share this post


Link to post
Share on other sites
Thank you for your answer about the SFML lib, BeerNutts! I wasn't aware about SFML.

Guys, about the shader above (thanks again Antheus!), do you know if it would be well handled by xbox360's graphic card? (XNA game)

Thanks! :)

Share this post


Link to post
Share on other sites

Thank you for your answer about the SFML lib, BeerNutts! I wasn't aware about SFML.

Guys, about the shader above (thanks again Antheus!), do you know if it would be well handled by xbox360's graphic card? (XNA game)

Thanks! :)


While Antheus's shader is GLSL (OpenGL shading language), it can be easily ported to HLSL/SM3 code which can be compiled to run on XBox360. The syntax is extremely similar between the two, but HLSL doesn't have implicit global variables such as gl_FragCoord or gl_FragColor; instead, HLSL parameters and return values are accessed by semantics (annotations that specify the logical purpose of the symbols). This is a very minor issue though, as the available functionality is about the same.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!