Game Maker's Garage Forum

Game Creation => SilverCreator => Topic started by: Circuit on December 13, 2011, 04:49:38 PM

Title: intro + artillery game
Post by: Circuit on December 13, 2011, 04:49:38 PM
Hey guys!  I've posted a couple of times before, but most of you probably don't know who I am.  I'm Circuit.  I used to make a lot of GM games, many years ago.  If you've played Stan's World or Mac Frost, I'm the guy who made those.

I want to share a project I've been working on, and ask for your feedback on it.  I've been working on a level editor for a turn-based artillery game.  The actual game itself doesn't exist yet, just the editor.  Please take a look at this and tell me what you think.  I'd like to get some feedback regarding the GUI: whether or not it's intuitive, how I can make it better, etc..  Also, I'd like to know how fast this runs on your machines.  Please tell me which tools are fast and which ones are slow, and tell me if the color rendering is too much slower than the black and white rendering.  You can drop bombs on the Color Range and BW Range to get an estimate of how fast/slow the game will be in either rendering mode.

Thanks!

http://www.mediafire.com/download.php?gb8nfseb2l1hhbd

(http://i1223.photobucket.com/albums/dd504/Circuit11/grassyartilleryrange.png)
Title: Re: intro + artillery game
Post by: Gan on December 13, 2011, 05:35:37 PM
That is so cool!

The tools are pretty straight forward. The color does run noticeably slower than the black and white, but not unbearably slow. Your code looks incredibly professional, and I laughed at the Batman map.

This is epic. My only wish is that Sc could run it faster/smoother. Though hey, imagine this in the HTML5 GameMaker. With a planned code structure similar to Sc, I think you'd be able to run this a ton faster in the browser.
Title: Re: intro + artillery game
Post by: GMG Kurt on December 13, 2011, 05:39:09 PM
This is amazing! I wish I could do something like this !!!
Title: Re: intro + artillery game
Post by: Connors on December 13, 2011, 08:28:53 PM
I truly am impressed! I've wondered how to make this kind of game, I could probably get the projectile motions but the dynamic terrain is beyond me.
Title: Re: intro + artillery game
Post by: Circuit on December 14, 2011, 12:45:11 AM
Quote
That is so cool!

The tools are pretty straight forward. The color does run noticeably slower than the black and white, but not unbearably slow. Your code looks incredibly professional, and I laughed at the Batman map.

This is epic. My only wish is that Sc could run it faster/smoother. Though hey, imagine this in the HTML5 GameMaker. With a planned code structure similar to Sc, I think you'd be able to run this a ton faster in the browser.
Wow, thanks Gan!  I don't really think it's professional-looking, but that's nice of you to say.  :)  I'm definitely trying to make it as efficient as possible.  Arithmetic in SC is lightning fast - I can drop a bomb with a radius of 10, or a radius of 750, and there's no difference in framerate.  I just wish that the rendering could keep up with the arithmetic.
I'll definitely re-write this in HTML5 GameMaker.  A browser-based game would be much better, for the rendering speed, and for the greater accessibility of it, and for a lot of other reasons too.
Title: Re: intro + artillery game
Post by: Circuit on December 14, 2011, 02:00:29 AM
Quote
This is amazing! I wish I could do something like this !!!
Thanks Kurt.  But I think that you probably could do something like this.  It's all just middle-school and high school algebra, translated into code.  It's less complicated than it looks.  If there's any part of the code that you want help understanding, I'd be glad to explain it to you.   :)
Title: Re: intro + artillery game
Post by: Circuit on December 14, 2011, 02:33:19 AM
Quote
I truly am impressed! I've wondered how to make this kind of game, I could probably get the projectile motions but the dynamic terrain is beyond me.
Thanks Connors.  I know what you mean.  I spent years wondering how to do that!  When I figured it out, it was surprisingly simple.  You use a variant of the Pythagorean theorem to determine the height of each X pixel in the radius of the explosion.  If a pixel in the explosion radius is below the ground, the ground at that X is pushed down.  Collision detection works the same way.
Title: Re: intro + artillery game
Post by: EqwanoX on December 28, 2011, 10:00:21 AM
wow, this is really impressive stuff, i put off downloading it cause i saw the screens before and thought it was just a terrain editor, i didnt read you can actually drop bombs to alter the terrain, this would make a great game, it reminds me of worms or a battletanks game i had. you seem to be into programming, are you still into drawing or graphics at all?
Title: Re: intro + artillery game
Post by: Connors on December 28, 2011, 04:38:26 PM
Oh and I would help with pixel art if you need, I'd enjoy helping.
Title: Re: intro + artillery game
Post by: Circuit on December 29, 2011, 03:30:23 AM
wow, this is really impressive stuff, i put off downloading it cause i saw the screens before and thought it was just a terrain editor, i didnt read you can actually drop bombs to alter the terrain, this would make a great game, it reminds me of worms or a battletanks game i had. you seem to be into programming, are you still into drawing or graphics at all?
Thanks man.  Yeah, the terrain deformation is key to making it into a game.  By the way, I take a lot of inspiration from Worms.  Eventually I plan to add infantry combat to the game, because I want it to be kind of a cross between Worms and Scorched Earth.  As for graphics, I haven't drawn anything in a long time.  Like I mentioned in another recent thread, my drawing skills are terrible.  So I focus on programming.  ;D

Oh and I would help with pixel art if you need, I'd enjoy helping.
Thanks for offering, but I'm not sure that I want to use sprites in the game.  I'm still debating it in my head.  I'll think about it.

EDIT: Update!  It's now possible to shoot arcing artillery shells.  This is kind of a weird way of doing it, because it doesn't involve trigonometry or physics calculations.  I'll explain tomorrow.
http://www.mediafire.com/download.php?namdrsdomvmqdsn

IT'S TOMORROW: The control scheme is similar to Angry Birds.  Artillery guns are fired like slingshots.  Go to the Test Artillery card and click anywhere below the ground.  Hold the button down, and drag the pointer anywhere below the surface.  Release to fire.  By default the 'tracer' is ON to show the projected path of the shell.
This is kind of weird because the curve equation is generated from points, not from angle and power.  It's probably not correct.  It's the best I can do with the knowledge I have.
Title: Re: intro + artillery game
Post by: EqwanoX on December 29, 2011, 08:06:51 AM
wouldnt you need sprites for infantry? or the players artilary? and enemies? could that be the next step?
Title: Re: intro + artillery game
Post by: Circuit on December 29, 2011, 03:03:17 PM
wouldnt you need sprites for infantry? or the players artilary? and enemies? could that be the next step?
I've been planning to use the drawing commands to draw simple shapes.  I just don't think that sprites would go well with the maps.  Sprites are detailed, with various colors, shading, possibly texture.  But the maps are extremely simple, consisting of 3 colors.  It seems like it would be a bad contrast.  But if you and Connors think differently, and you guys really want to make some sprites, I'd like to see them.  :)
Title: Re: intro + artillery game
Post by: Connors on December 30, 2011, 03:25:11 PM
Oh if that's all it is I can do some very simple art, or even make it extra small so you can scale it up and it looks pixelated on purpose. All retro like. Just two or three colors.

Oh and I immediately fired a bomb of the left edge by accident and got an "array out of bounds" error.
EDIT: It does fire shots, looks good to me...
Title: Re: intro + artillery game
Post by: Connors on December 30, 2011, 03:44:52 PM
(http://i1215.photobucket.com/albums/cc511/Connor_McHarney/Tank1.gif)(http://i1215.photobucket.com/albums/cc511/Connor_McHarney/Tank2.gif)

Maybe something simple like this, tinted to match the team color (I think it's TINTSPRITE?).
Or even just an empty colored outline of a unit, which also can be colored with TINTSPRITE. If it's white it matches exactly the values you enter.
And you draw a line to show the gun's angle.

And you should totally have explosions launch units based on the angle and the weight of the target(s).
Title: Re: intro + artillery game
Post by: EqwanoX on December 31, 2011, 09:21:46 AM
yea maybe theres a way to use FILLOVAL as an explosion like in the old missile command games
Title: Re: intro + artillery game
Post by: Circuit on December 31, 2011, 05:12:38 PM
Oh if that's all it is I can do some very simple art, or even make it extra small so you can scale it up and it looks pixelated on purpose. All retro like. Just two or three colors.

Oh and I immediately fired a bomb of the left edge by accident and got an "array out of bounds" error.
EDIT: It does fire shots, looks good to me...
I'm not sure about the color palette.  But I definitely think that the sprites need to be big, not small, so that they can be scalable.  Maps will differ in scale, and it will be possible (eventually) to zoom in and out.
Regarding the array OOB... don't worry, it will work when I make the actual game.  I just made the Test Artillery card to demonstrate my idea for the control scheme.

(http://i1215.photobucket.com/albums/cc511/Connor_McHarney/Tank1.gif)(http://i1215.photobucket.com/albums/cc511/Connor_McHarney/Tank2.gif)

Maybe something simple like this, tinted to match the team color (I think it's TINTSPRITE?).
Or even just an empty colored outline of a unit, which also can be colored with TINTSPRITE. If it's white it matches exactly the values you enter.
And you draw a line to show the gun's angle.

And you should totally have explosions launch units based on the angle and the weight of the target(s).
I like those.  I took a screenshot of a map, and then copy-pasted the first tank sprite onto it.  It's a better combination than I expected.  The all-color map with black-outlined sprites is kind of reminiscent of old-school Looney Tunes.  Which is a good thing.  Now I'm thinking that maybe an exaggerated, cartoony art style would be perfect for this game.  Dark humor, deception, the dawn of the atomic age... so many ideas brewing in my head right now!
I'm not quite ready to put tanks in the game.  My plan is to start with artillery, then add tanks, and finally infantry.  Would you be able to draw an artillery gun?

BTW, I'm not sure what you mean about the explosions and angle and weight.

EDIT: I almost forgot to post the picture:
http://i1223.photobucket.com/albums/dd504/Circuit11/Screenshot2011-12-31at30310PM.png
Title: Re: intro + artillery game
Post by: Circuit on December 31, 2011, 07:26:16 PM
yea maybe theres a way to use FILLOVAL as an explosion like in the old missile command games
That's a good idea, and I think I know how to do it.  The main problem is that animations have multiple frames, and the Paint event can only render one frame at a time.  The solution would involve a counting variable in a SELECT CASE structure.  The value of the variable would determine which frame to render, i.e. the size of the explosion circle.  I just need to decide where to increment the variable (in Paint, or in a method), and how to coordinate the animation with the explode() method, which is what actually deforms the terrain.  But that can be worked out.
Title: Re: intro + artillery game
Post by: Connors on January 01, 2012, 08:41:43 PM
Probably call two methods when a bomb hits the ground right? Oh and I just meant it would be fun to have explosions push things away from their center like in Worms.
Sorry for awkward choice of words. :P
I originally thought this would be a bit more like just having two players each with one tank but I'll be interested to see where it goes!
Title: Re: intro + artillery game
Post by: Circuit on January 02, 2012, 03:05:42 PM
Probably call two methods when a bomb hits the ground right?
Yeah.  The deformation needs to occur in the middle of the animation, when the circle is at its widest diameter.  So those things will need to be synchronized somehow.

Oh and I just meant it would be fun to have explosions push things away from their center like in Worms.
Sorry for awkward choice of words. :P
That's OK.   :D  I understand now.  What kinds of objects do you want to see on the battlefield?  I'm open to suggestions.

I originally thought this would be a bit more like just having two players each with one tank but I'll be interested to see where it goes!
I'll start with two tanks, and then add more.  Eventually, I want the game to involve 3 or more players, with each player controlling several units of various types.  Success will require careful strategy as well as skillful shooting.  Thanks for being interested.   :)
Title: Re: intro + artillery game
Post by: Connors on January 02, 2012, 03:34:13 PM
It's a pretty small battlefield, and could become crowded. I think you'll need a wider space if it gets to be three teams... Have you tried this? Or is your program hard-coded for the screen size?
And there is a reason Worms usually has two teams. The one in the middle would get pulverized before the outside teams reach each other.  You'd find it hard to make these fights balanced.

    >:(                    :o                    >:(
Red---->        <--Blue-->        <----Green
Title: Re: intro + artillery game
Post by: Circuit on January 02, 2012, 07:26:16 PM
It's a pretty small battlefield, and could become crowded. I think you'll need a wider space if it gets to be three teams... Have you tried this? Or is your program hard-coded for the screen size?
The length of the ground array is 540, one Y value for each X pixel on the screen.  That's hard-coded.  BUT, the pixels can represent any distance.  The scale of a map will be determined by the mapmaker.

And there is a reason Worms usually has two teams. The one in the middle would get pulverized before the outside teams reach each other.  You'd find it hard to make these fights balanced.

    >:(                    :o                    >:(
Red---->        <--Blue-->        <----Green
Hmm... I hadn't thought about that.  That would probably be even worse with artillery.  Darn!
Title: Re: intro + artillery game
Post by: EqwanoX on January 03, 2012, 10:36:46 AM
not if the team in the middle is ai. i like pulverizing ai :D

you could also use ROTATESPRITE to rotate the tank to line up with the angling terrain, however you cant recreate sprites that have been rotated, so maybe hold off on that. looking forward to the next update
Title: Re: intro + artillery game
Post by: Connors on January 03, 2012, 02:48:42 PM
not if the team in the middle is ai. i like pulverizing ai :D
I LOVE it! Both players have to fight the AI in the middle while still planning how they will finish off the player on the opposite side.
Title: Re: intro + artillery game
Post by: EqwanoX on January 04, 2012, 12:00:33 PM
except, whoever the ai attacks is at a disadvantage cause one ai can only attack one ai
Title: Re: intro + artillery game
Post by: Connors on January 04, 2012, 07:40:23 PM
You could balance it to attack both players, that's what AI is for. And the length of the battle would depend partially on how strong you make AI units.
Title: Re: intro + artillery game
Post by: Circuit on January 04, 2012, 09:17:58 PM
Like the Chinese proverb, "the enemy of my enemy is my friend."  This would be especially interesting with tanks and infantry running around.  You would be trying to maneuver your temporary friend's units into vulnerable positions, so that you could kill them after you kill your mutual enemy.  Or, that might not even be your true objective.  You might actually want the AI to kill him first, then you finish off the AI.  I like it!
Title: Re: intro + artillery game
Post by: Gan on January 04, 2012, 09:32:25 PM
Haha yeah true. I like lots AIs. I suppose the middle could be 2x harder to compensate. Create a work-together effect.
Title: Re: intro + artillery game
Post by: Circuit on January 08, 2012, 09:58:15 PM
Small but significant update:
You can now change the RGB colors of the earth, surface, and sky of a map.  You can also give it a name, put your name on it, and write a brief description.  All of this data is saved in the map file.  My maps (included in the download) are now colorized, and have descriptions that explain how they were made.

Will you guys design some maps for my game?  I'll give you full credit of course.  I can't pay you, but I won't be making any money off of it either, so... yeah.   :D

http://www.mediafire.com/download.php?2aoj50jiyeu26nw
Title: Re: intro + artillery game
Post by: Connors on January 08, 2012, 11:40:24 PM
Did you consider adding a feature to choose the map size? It would allow for some interesting battles.
Title: Re: intro + artillery game
Post by: Circuit on January 09, 2012, 12:03:51 AM
Yes.  The map size will be variable.  It will always be 540x291 pixels, but those pixels can represent 200 feet, or 200 yards, or whatever.  I'm still figuring out how that will work, TBH.
Title: Re: intro + artillery game
Post by: EqwanoX on January 09, 2012, 09:38:37 AM
OMG! you have to convert this to full screen! larger maps would make it so much better
Title: Re: intro + artillery game
Post by: Circuit on January 09, 2012, 01:35:28 PM
Full screen rendering would be a lot slower.  As it is, I get 19 fps in color and 36 fps in black and white.  The program draws a filled rectangle for the sky, then draws 540 vertical lines on top of that for the earth color, and then 540 lines on top of that for the surface.  Full screen rendering (1024x768) would require about twice as many lines in either mode, so it would be about half as fast, and probably less than that, because the rectangle would be larger and the earth-coloring lines would be longer.
Title: Re: intro + artillery game
Post by: Gan on January 09, 2012, 05:16:14 PM
Woh.

I sense a need for a faster game maker! *Time to get back to work!*
Title: Re: intro + artillery game
Post by: Circuit on January 09, 2012, 07:07:37 PM
Heh.  That was kind of a shameless plug, but yeah, get on it!  I want the improved speed that a JavaScript-based tool (HTML5 GM) can offer.  That, and OOP support.
Title: Re: intro + artillery game
Post by: Connors on January 09, 2012, 08:07:21 PM
Speaking of shameless plugs... No I'm kidding.
How does it look if you don't draw the second 540 lines for the surface? Or even better, make the lines below twice as thick, and draw every other line. Depends on how far you can take the resolution before it looks bad.
Title: Re: intro + artillery game
Post by: Circuit on January 10, 2012, 12:28:15 AM
Connors, thank you so much!  I just wrote a new pair of rendering methods which draw half the number of lines.  It looks good, and the speed increase is dramatic:
High quality color: 19 fps
Low quality color: 26-28 fps (depending on surface line thickness)
High quality black and white: 34 fps
Low quality black and white: 47-54 fps!!!!!
Title: Re: intro + artillery game
Post by: Gan on January 10, 2012, 01:09:20 AM
Impressive!
Title: Re: intro + artillery game
Post by: Circuit on January 11, 2012, 03:45:02 PM
That was a really good idea Connors.  I took it a step further and allowed the method to divide the array by any number that's a factor of the screen's width.  So it can render every other line, or every 3rd, etc., greatly improving speed.  Also, the factor can be gradually incremented & decremented for blurring & sharpening effects:

(http://i1223.photobucket.com/albums/dd504/Circuit11/transition.gif)
Title: Re: intro + artillery game
Post by: Gan on January 11, 2012, 05:08:34 PM
Wow haha! That's intense!

Way cool effect, would look very nice as a transition between maps
Title: Re: intro + artillery game
Post by: EqwanoX on January 12, 2012, 09:55:10 AM
that looks awsome, i tryed to make my own, it runs pretty smooth compiled, but its not as mathmatically accurate, press space to throw grenades
http://www.mediafire.com/?byxc5cb3wnp3oqp
Title: Re: intro + artillery game
Post by: Circuit on January 12, 2012, 03:00:29 PM
That's really smooth!  I like how you can stand close to a hill and throw grenades rapid-fire, BAM BAM BAM, and the game doesn't slow down.  How did you program the movement of the guy and the grenades?
Title: Re: intro + artillery game
Post by: Gan on January 12, 2012, 03:18:50 PM
Wow, haha. That's awesome!
http://cl.ly/2W3W0b1f291R0R0u0g1l
Title: Re: intro + artillery game
Post by: EqwanoX on January 13, 2012, 09:10:53 AM
and throw grenades rapid-fire, BAM BAM BAM,
Wow, haha. That's awesome!
lolz, its like portal! i gotta add more to this

movement is the same as in the mario platformer i made a while back, in a timer, if leftkey=1 then let xspeed+=-2, and for inertia, if left and rightkey equal 0 then if xspeed is greater than 0 subtract 2 otherwise add 2. also each pixel on the x axis has a y value so instead of running a FOR loop to see where the player is, it just checks the pixel value that the player is on to determine if he's on the ground or not

Title: Re: intro + artillery game
Post by: Connors on January 13, 2012, 09:20:46 AM
You could even add code to check the slope of terrain and decide if he can walk up it.
Title: Re: intro + artillery game
Post by: EqwanoX on January 13, 2012, 09:36:04 AM
i added movement for fun but i think it would be better as a game with stationary tanks and health bars
Title: Re: intro + artillery game
Post by: Connors on January 13, 2012, 10:05:05 AM
There's plenty of ways you could use the engine...
Hmm.
Title: Re: intro + artillery game
Post by: Circuit on January 13, 2012, 09:02:46 PM
Thanks for explaining that Eq.  I've been trying to think of different ways to simulate physics in my game.  I like the basic control scheme, but the animation of the artillery shell isn't realistic, and the aiming just doesn't "feel" right to me.  I wish I knew more about physics.
Title: Re: intro + artillery game
Post by: Connors on January 13, 2012, 10:18:09 PM
You know what? I'll try and convert a projectile motion thing I made in class for SC and get back to you.

EDIT: Won't be back in school until Monday which is too bad because we had a great, elegant way to do the equation that gives back the X and Y position as a function of time, angle and initial height and velocity.
Or maybe I can remember it. :/
Title: Re: intro + artillery game
Post by: Circuit on January 14, 2012, 07:36:57 PM
Thanks, that would be helpful.  If you can't remember it right now, that's OK.
Title: Re: intro + artillery game
Post by: EqwanoX on January 15, 2012, 02:07:52 PM
i was able to add a simple ai but this was harder than i thought, i'm not good with math. the damage isnt completely accurate but it works. it checks to see if the center pixel of the tank sprite is within the damage box, the inaccurate part is that the box has corners where as the blast is circular, then i just ported over the controls from FreeThrow2k12
Title: Re: intro + artillery game
Post by: Connors on January 15, 2012, 04:30:32 PM
You guys can easily add the Distance Formula.
(http://www.purplemath.com/modules/xyplane/dist07b.gif)
Gotta remember how to square something with SC though. Or there are workarounds.
If the distance is less than the radius of the explosion in pixels it hit. If you could improve it to work with the shape of the tank that's even better.
And does it use Circuit's explosion code? Because that makes proper nice round craters. :P
Title: Re: intro + artillery game
Post by: Circuit on January 15, 2012, 04:39:19 PM
That's pretty good!  I like how the sliders keep their positions after you fire a shot, so that you can fire the same shot repeatedly.  My game doesn't have that.  Also, the AI isn't bad.  It seems very accurate at times.  You should make it so the AI's shots gradually get closer and closer to the player, the same way that a human plays the game.

I was gonna suggest using the distance formula (aka Pythagorean theorem) but Connors just barely beat me to it.  I wrote a method for this which uses the SQRT and POW commands.  Basically, call the method with the explosion XY coordinates and the tank XY coordinates as arguments.  The method returns the calculated distance.  If the distance is less than or equal to the explosion radius, it's a hit.  You can also make the amount of damage proportionate to the distance: closer = more damaging.
Title: Re: intro + artillery game
Post by: Connors on January 15, 2012, 04:55:01 PM
So Tuesday I'll be able to copy the code I used for the "Zippy the Clown" assignment in which we do some calculations for shooting him out of a canon, and see when he hits the ground. XD
It uses the initial angle, velocity height and time in the air and returns both x and y. This will be fun.