Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Calin Leafshade on Wed 04/11/2009 15:26:40

Title: An AGS platformer (MariVania)
Post by: Calin Leafshade on Wed 04/11/2009 15:26:40
I know this has come up before but i just thought I'd share my attempt at a tiny little "Tech Demo"

How does it feel to play? I tried to add in acceleration and stuff like that.. Is it believable?

http://www.thethoughtradar.com/AGS/Platformer7.zip (http://www.thethoughtradar.com/AGS/Platformer7.zip)
Title: Re: An AGS platformer
Post by: Arboris on Wed 04/11/2009 16:06:27
Yes, it is. It feels very good.
Title: Re: An AGS platformer
Post by: Matti on Wed 04/11/2009 16:22:26
Yep, nice and smooth. Good work.
Title: Re: An AGS platformer
Post by: Snake on Wed 04/11/2009 17:37:49
Wow, Calin, that's great! It doesn't feel "AGS-ie" at all. Great work! I especially like how you made his hat flip up when falling down or decending from a jump... great job.
Title: Re: An AGS platformer
Post by: Calin Leafshade on Wed 04/11/2009 17:40:23
Quote from: Snake on Wed 04/11/2009 17:37:49
I especially like how you made his hat flip up when falling down or decending from a jump... great job.

I stole the idea from somewhere... I wont say where... It's secret
Title: Re: An AGS platformer
Post by: DoorKnobHandle on Wed 04/11/2009 18:26:06
Bouncy Boxing? :p

Haven't checked this out yet but will asap.
Title: Re: An AGS platformer
Post by: Calin Leafshade on Wed 04/11/2009 19:06:46
Ramps!

http://www.thethoughtradar.com/AGS/woop.zip (http://www.thethoughtradar.com/AGS/woop.zip)

mario assaults draculas castle.

But you'll notice that the ramps dont work.

Im using regions to define platforms.. so Region 1 defines the top of a platform and will not allow the character to fall through it and region 2 defines obstacles that cant be passed through horizontally. Obviously this means that slanted ramps dont work.

Any ideas?

Title: Re: An AGS platformer
Post by: TerranRich on Wed 04/11/2009 22:51:15
Colin, you magnificent bastard, your platformer works like a charm and feels smooth... except for the multi-jumps. If you hold down "up" you can jump endlessly, which not many platformers actually do. This can be easily fixed, however.

Now I know why you asked about room width limitations. ;)
Title: Re: An AGS platformer
Post by: Crimson Wizard on Wed 04/11/2009 22:56:16
That looks realy cool. Did you draw these background graphics?
Title: Re: An AGS platformer
Post by: Arboris on Wed 04/11/2009 23:03:29
Quote from: Crimson Wizard on Wed 04/11/2009 22:56:16
That looks realy cool. Did you draw these background graphics?

My guess was a tile set from castlevania actually
Title: Re: An AGS platformer
Post by: Calin Leafshade on Wed 04/11/2009 23:17:36
Quote from: Crimson Wizard on Wed 04/11/2009 22:56:16
That looks realy cool. Did you draw these background graphics?

HAH! I wish kiddo.
Title: Re: An AGS platformer (Help me with parallaxing)
Post by: Calin Leafshade on Wed 04/11/2009 23:20:14
So I had a quick try at parallaxing.

I paint the background (the sky) onto the room surface at the viewport but it seems to lag slightly and is especially noticeable if you jump.

Any ideas why that might be?


DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.Clear();
surface.DrawImage(GetViewportX(),GetViewportY() , 14);


http://www.thethoughtradar.com/AGS/Platformer.zip (http://www.thethoughtradar.com/AGS/Platformer.zip)
Title: Re: An AGS platformer (Help me with parallaxing)
Post by: Wonkyth on Thu 05/11/2009 00:13:23
This looks nice.
However, when I tried the second one you uploaded, I sometimes fell through the top of staircases.
Sometimes with disastrous results:
(http://www.2dadventure.com/ags/Bug.jpg)

EDIT:
Having a look at the parallax problem, I'm haven't really got any ideas, except that it might just be general lagging.
I did notice that when you move to the left, you get a similar thing, but when you move to the right, it's fine.
You get this when you walk to the left:
(http://www.2dadventure.com/ags/Bug2.jpg)



My thoughts on the ramp problem are that perhaps if you were within a certain distance of the surface of the ramp(a couple of pixels should be enough), then you could make it so that....Arg! I cant explain!
I'll try pseudo

if (this.Location == StairAreaType.Right)                    //if the thingy is within the special ramp area of a ramp
{                                                                                 //going up to the right

this.HorizontalRightMovement = const_ALittle;          //make it so that pressing the right arrow makes you
                                                                                   //move to the right AND up a little
this.HorizontalLeftMovement = -const_ALittle;           //make it so that pressing the left arrow makes you
                                                                                   //move to the left AND down a little
                                                                                   //it should be set up so that when it's moved it stays
                                                                                   //within the ramp area
}


I hope I'm making sense, and I hope it works... :P
Title: Re: An AGS platformer (Help me with parallaxing)
Post by: Scarab on Thu 05/11/2009 00:40:25
Well if you created a hollow rectangle GUI which makes the screen smaller, then the viewport would be able to load behind it, which would stop the background from showing you its pink bits.
Title: Re: An AGS platformer (Help me with parallaxing)
Post by: Wonkyth on Thu 05/11/2009 00:47:15
That would work, except that you'd still get the weird squashing effect whenever you jumped.
Title: Re: An AGS platformer (Help me with parallaxing)
Post by: Calin Leafshade on Thu 05/11/2009 08:42:57
I really can't see why this doesnt work.

I paint the background everyframe at the viewport.

The only thing i can think of is that the GetViewPort functions dont return a pixel-perfect result.

EDIT: FIXED!

The following code seems to return the viewport more accurately (if the viewport is following the player)


int BGx = cEgo.x - 160;
if (BGx < 0) BGx = 0;
if (BGx > Room.Width - 320) BGx = Room.Width - 320;
int BGy = cEgo.y - 100;
if (BGy < 0) BGy = 0;
if (BGy > Room.Height - 200) BGy = Room.Height - 200;
Title: Re: An AGS platformer (Help me with parallaxing)
Post by: Calin Leafshade on Thu 05/11/2009 10:51:24
So I've done another build to show off the parallaxing a little more but does it hurt your eyes to play?

it seems blurry to me.. is it just my monitor?

http://www.thethoughtradar.com/AGS/Platformer2.zip (http://www.thethoughtradar.com/AGS/Platformer2.zip)
Title: Re: An AGS platformer (Help me with parallaxing)
Post by: Arboris on Thu 05/11/2009 11:12:32
Hm, it's sharp here.

Try putting the filter on '4x nearest-neighbour' in the game options, and don't allow your monitor to manually stretch it (keep the aspect ratio).   
Title: Re: An AGS platformer (MariVania)
Post by: Denzil Quixode on Thu 05/11/2009 11:16:42
It doesn't look blurry to me. Looks pretty awesome, in fact :)

My only (minor) gripe about the way Mario moves is that you can't control the height of the jump by tapping the key instead of holding it down. I don't know how difficult that would be to script, though. If you managed that I think you'd get it feeling close to indistinguishable from the original game.
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Thu 05/11/2009 11:29:00
Quote from: Denzil Quixode on Thu 05/11/2009 11:16:42
you can't control the height of the jump by tapping the key instead of holding it down.

Yeah i'm working on this but havent come up with a decent way of implementing it yet.
Title: Re: An AGS platformer (MariVania)
Post by: Snake on Thu 05/11/2009 13:13:33
Jesarsh!

This is incredible, Calin.

The only thing that I suggest is either blurring the clouds or dropping the lightest shade down a notch. That is the only thing distracting to me when I'm travelling through the castle. But other than that, w00t!
Title: Re: An AGS platformer (MariVania)
Post by: Crimson Wizard on Thu 05/11/2009 13:49:56
Great!  ;D Now to implement a health bar and scores  ::)
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Thu 05/11/2009 14:33:15
Bear in mind i'm still using stolen graphics until i get the mechanics sorted :p

speaking of which, I've fixed the jump and added real moving, animated enemies! oh noez!

http://www.thethoughtradar.com/AGS/Platformer3.zip (http://www.thethoughtradar.com/AGS/Platformer3.zip)
Title: Re: An AGS platformer (MariVania)
Post by: Arboris on Thu 05/11/2009 15:56:08
That works pretty well, altho he can jump REALLY high  :=
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Thu 05/11/2009 16:01:34
Quote from: Arboris on Thu 05/11/2009 15:56:08
That works pretty well, altho he can jump REALLY high  :=

he's mario...  ::)
Title: Re: An AGS platformer (MariVania)
Post by: Arboris on Thu 05/11/2009 16:03:57
Lies! we all know that white men can't jump! (http://www.imdb.com/title/tt0105812/)
Title: Re: An AGS platformer (MariVania)
Post by: Darth Mandarb on Thu 05/11/2009 18:37:20
Excellent work man!  Seriously good stuff.

Write some software (plugin) for AGS to make platformers like this and get it out there so those guys over at Stencyl will be screwed over for never releasing their vapor-ware!
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Thu 05/11/2009 18:49:19
http://www.thethoughtradar.com/AGS/Platformer5.zip (http://www.thethoughtradar.com/AGS/Platformer5.zip)

Now with wall jumps and rubbish particle effects!

(go to the far end of the room for a wall.)
Title: Re: An AGS platformer (MariVania)
Post by: Helme on Thu 05/11/2009 18:59:44
Very impressive. I would love to play arround with a plug-in and try to create a jump'n'run.

Title: Re: An AGS platformer (MariVania)
Post by: Midian Design on Thu 05/11/2009 19:09:20
Hey, I wanna play the entire game  :P Gratz!  ;)
Title: Re: An AGS platformer (MariVania)
Post by: Kaio on Thu 05/11/2009 19:17:35
 ;D Wow, nice job man! Do you plan to release this as a plugin or module or whatever?
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Thu 05/11/2009 19:20:15
Im not sure i would know how to kind of 'generalise' it.

Its fairly difficult to decipher game loops since they are always convoluted mess of if statements.

But i'll certainly release the source code 'as is' when ive done it.
Title: Re: An AGS platformer (MariVania)
Post by: Wonkyth on Fri 06/11/2009 05:11:48
Nice. :)

I haven't tried the latest version, as I'm still downloading it and I'm currently in my "No Game" time, but I'll tell you what I think when I'm done.


I must confess, even though I threw the thought of making an AGS platformer out the window(I decided to use XNA instead), I'm still itching to have a look at the source! :D

EDIT: Looks Great!
However, He does jump a tad high, even for Mario.
Title: Re: An AGS platformer (MariVania)
Post by: Gilbert on Fri 06/11/2009 06:35:27
Quote from: wonkyth on Fri 06/11/2009 05:11:48
However, He does jump a tad high, even for Mario.

Change it to Luigi then. :=
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Fri 06/11/2009 08:17:47
the height of his jump is literally changing one number :p I dont think its really an issue at this point :p
Title: Re: An AGS platformer (MariVania)
Post by: Arboris on Fri 06/11/2009 13:11:52
the particle effect does seem to get stuck on his feet. When you jump against the wall, and just let him slide all the way down, and then jump off it the particle effect will remain at his feet until you do a 'correct' wall jump.
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Fri 06/11/2009 13:31:34
already fixed that :p New build coming soon.
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Fri 06/11/2009 15:03:04
http://www.thethoughtradar.com/AGS/Platformer6.zip (http://www.thethoughtradar.com/AGS/Platformer6.zip)

New build.

Ramps now work
Health and score enabled.
Enemies are more generalised now and can be added with a simple function.
Enemies are more automonous too.
You have a goal (get to the top)
you can die.

It is essentially a proper game.. albeit a rubbish one.

had to disable particles though.. the overhead of redrawing the screen was too much.
Title: Re: An AGS platformer (MariVania)
Post by: Matti on Fri 06/11/2009 15:49:01
Yay, I won... absolutely nothing...  :=

Nice work!
Title: Re: An AGS platformer (MariVania)
Post by: arj0n on Fri 06/11/2009 16:09:22
Yah, I killed Mario. ...Oh wait, that wasn't the goal...
Why are the castlevania backgrounds gone? liked them very much.
Anyway, this goes better each "release"!
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Fri 06/11/2009 16:13:02
castlevania backgrounds went because i needed a bigger area to test stuff
Title: Re: An AGS platformer (MariVania)
Post by: Arboris on Fri 06/11/2009 16:40:54
Great tech demo. What's up with the 'buttslide' move tho ;P
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Fri 06/11/2009 16:45:42
Give me a better sprite and i'll make it a super-awesome-slide move :p
Title: Re: An AGS platformer (MariVania)
Post by: Wonkyth on Sat 07/11/2009 12:32:00
Someone start drawing!  :D

I'm still downloading(bluddydialup), but when I'm done I'll give it a try.
Also, just out of curiosity, what method did you use for the ramps?
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Sat 07/11/2009 12:35:41
Quote from: wonkyth on Sat 07/11/2009 12:32:00
Also, just out of curiosity, what method did you use for the ramps?

A bit of a hack.

I use region 1 to denote the platforms and check in the game loop to see if there is a pixel of region 1 above the current pixel, if there is then move the character up and check again. so eventually you end up in the top pixel of the region.
Title: Re: An AGS platformer (MariVania)
Post by: Wonkyth on Sat 07/11/2009 12:37:37
So in theory you move faster while going up stairs than on flat ground...?
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Sat 07/11/2009 12:57:42
Speed in the x direction stays constant. only the y position is changed.

but if you want to look at it terms of resultant vectors then technically yes.. though the same could be said of jumping.
Title: Re: An AGS platformer (MariVania)
Post by: Wonkyth on Sat 07/11/2009 13:04:41
Ok, I killed the baddies and got the star, but because I was holding down left at the time, I didn't get to see what it said. :(
One thing, you get weird things when you jump at the ceiling up and to the left of the star.

Either way, this looks great.  ;)
Title: Re: An AGS platformer (MariVania)
Post by: Arboris on Sat 07/11/2009 17:04:14
Quote from: Calin Leafshade on Fri 06/11/2009 16:45:42
Give me a better sprite and i'll make it a super-awesome-slide move :p

Heh. Do you already have an idea what to create with it? Or is this just for a fun tryout
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Sat 07/11/2009 17:22:25
Im toying with the idea of making it an entry for this months MAGS.

I was thinking like a prison break in the style of Duke Nukem 2.. thats kinda like 'breaking in'.. kinda

The problem is that my graphic skills are poor :p
Title: Re: An AGS platformer (MariVania)
Post by: Arboris on Sat 07/11/2009 23:47:04
Quote from: Calin Leafshade on Sat 07/11/2009 17:22:25The problem is that my graphic skills are poor :p

that's what's the critic lounge is for ;). Altho, making all of it will be quite time consuming since you'll need to animate every enemy aswell.  So I could help you a bit on the way, because I would love to see a finished AGS platformer.

(http://arboris.hell-on-earth.net/stuff/prison%20break.gif)  (http://arboris.hell-on-earth.net/stuff/prison%20break.gif) (http://arboris.hell-on-earth.net/stuff/Prison%20Break.bmp)

I know not the best animator ever, but I tried to keep it as simple as possible for 320x200 resolution in mind.
6 frames in total, and 1 for standing still. (http://arboris.hell-on-earth.net/stuff/Prison%20Break.bmp) Frame 4 can also double for jumping up.

Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Sun 08/11/2009 00:34:39
Thats very kind of you.

Would you like to see the latest build for your trouble?

Ofcourse you would

http://www.thethoughtradar.com/AGS/Platformer7.zip (http://www.thethoughtradar.com/AGS/Platformer7.zip)

Space to shoot enemies
or you can jump on enemies
or slide through them
Title: Re: An AGS platformer (MariVania)
Post by: Wonkyth on Sun 08/11/2009 12:13:26
Downloading...

Hmm, I've just been thinking.
It's about the wall sliding: I've always thought it would be neat to make a side-scrolling parkour game...
Title: Re: An AGS platformer (MariVania)
Post by: Arboris on Sun 08/11/2009 13:17:10
heh. In the first level i managed to get stuck between that second flying koopa trooper and Goomba. A small invulnerability timer might not be such an bad idea ;)
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Sun 08/11/2009 15:13:06
Quote from: Arboris on Sun 08/11/2009 13:17:10
A small invulnerability timer might not be such an bad idea ;)

Added to my todo list.
Title: Re: An AGS platformer (MariVania)
Post by: Wonkyth on Mon 09/11/2009 08:39:46
Quote from: Arboris on Sun 08/11/2009 13:17:10
In the first level
Is there more than one level?!?
I hadn't realised!
Title: Re: An AGS platformer (MariVania)
Post by: Dixon on Mon 09/11/2009 14:00:53
Amazing work you've done there! The second level was really slow on my aspire one so I guess that you would need a really fast computer if the games get more complex.
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Mon 09/11/2009 14:10:17
The second level includes more layers of parallaxing than the first one and a bigger sprite size.

on my machine the 2nd level clocks in at about 30%cpu usage with the effect and about 4% without it :p

so on the final release i will just add a switch to turn it off if needed.

but the game runs full speed on a P4 2.8ghz so it shouldnt be too much of a problem for most people.
Title: Re: An AGS platformer (MariVania)
Post by: Mehrdad on Tue 10/11/2009 15:12:46
Quote from: Calin Leafshade on Sun 08/11/2009 00:34:39
Thats very kind of you.

Would you like to see the latest build for your trouble?

Ofcourse you would

http://www.thethoughtradar.com/AGS/Platformer7.zip (http://www.thethoughtradar.com/AGS/Platformer7.zip)

Space to shoot enemies
or you can jump on enemies
or slide through them

sorry.but I cant download.(I think server is filter for me-I am from Iran).can you give me a mirror link?I need serious.
Title: Re: An AGS platformer (MariVania)
Post by: arj0n on Tue 10/11/2009 15:16:23
@MEHRDAD: I uploaded Platformer7.zip on Megaupload.com, download here (http://www.megaupload.com/?d=8XK91NMN).
Title: Re: An AGS platformer (MariVania)
Post by: Crimson Wizard on Tue 10/11/2009 15:32:44
Quote from: Calin Leafshade on Sat 07/11/2009 17:22:25
Im toying with the idea of making it an entry for this months MAGS.
Heh, good luck with that, you are doing really good progress ;) It would be nice to see something uncommon on MAGS.
(I was thinking about making a turn-based strategy for "Breaking in" MAGS, but then decided to postpone this crazy idea  :D)
Title: Re: An AGS platformer (MariVania)
Post by: Mehrdad on Tue 10/11/2009 16:08:42
Quote from: [ Arj0n ] on Tue 10/11/2009 15:16:23
@MEHRDAD: I uploaded Platformer7.zip on Megaupload.com, download here (http://www.megaupload.com/?d=8XK91NMN).

Thanks a lot.download complete.
Title: Re: An AGS platformer (MariVania)
Post by: Guyserman82 on Wed 03/02/2010 19:10:25
Can't wait for the source code on this.
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Wed 03/02/2010 19:14:42
Oh yeah!

Sorry, slipped my mind. I'll up it in an hour or soe after cleaning it up.
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Wed 03/02/2010 20:32:48
i release this on the condition that neither Monkey nor Khris download it.. they will shout at me for very very messy coding.

I cant 100% remember how the code works but if there are any parts which you dont quite understand just post and i'll see if i can help.

I wouldnt recommend using this as a base but rather an idea on how platformers work

http://www.thethoughtradar.com/AGS/PlatformerSrc.zip
Title: Re: An AGS platformer (MariVania)
Post by: Guyserman82 on Mon 08/02/2010 00:27:44
Okay, quick question: I wanted to put a platforming minigame in my next game, but I can't figure out how to get gravity to work in a room. I think I've taken everything out of the global script that I took out of the room script, and the one with the global script still works. Any ideas?
Title: Re: An AGS platformer (MariVania)
Post by: Calin Leafshade on Mon 08/02/2010 01:54:46
Im not 100% sure what you mean. Do you mean you only want gravity to work in certain rooms?

The gravity part of the code is very very simple. Movement itself is not difficult. The difficult part in AGS is the damn collision detection.

The gravity literally works like this:

1)set the player acceleration to whatever input is require (jumping, running etc)
2)set the vertical acceleration to the input (jumping usually, which would be a negative force remember) plus the effects of gravity (which would be a positive force).
3)once the player has left the ground the effects of the jumping force would no longer be there so now we just set the vertical acceleration to whatever gravity is and allow that to chip away at the players vertical speed until it becomes positive and then the player will begin to fall.
Title: Re: An AGS platformer (MariVania)
Post by: Guyserman82 on Mon 08/02/2010 22:39:31
Quote from: Calin Leafshade on Mon 08/02/2010 01:54:46
Im not 100% sure what you mean. Do you mean you only want gravity to work in certain rooms?

The gravity part of the code is very very simple. Movement itself is not difficult. The difficult part in AGS is the damn collision detection.

The gravity literally works like this:

1)set the player acceleration to whatever input is require (jumping, running etc)
2)set the vertical acceleration to the input (jumping usually, which would be a negative force remember) plus the effects of gravity (which would be a positive force).
3)once the player has left the ground the effects of the jumping force would no longer be there so now we just set the vertical acceleration to whatever gravity is and allow that to chip away at the players vertical speed until it becomes positive and then the player will begin to fall.
Just to clarify: I copied all code from your global script into my room script. There were parts of my room script that didn't apply, so I removed them (I need no enemies, and no particles). Once I got the original script modified to the point so that the game could run it, gravity wasn't working. Any idea as to why?
Title: Re: An AGS platformer (MariVania)
Post by: SinSin on Mon 15/02/2010 09:33:14
Only just spotted this thread    CALIN LEAFSHADE =  force to be reckoned with   good job dude ;D