• Advertisement

Archived

This topic is now archived and is closed to further replies.

Top-down shooter.

This topic is 6526 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

Hey there all, I''ve been reading this board for over a year, it has helped a lot, but this is my first post. Yay! Um, anyways, I am creating a top down shooter and I was wondering on how to implement the AI, or the lack of AI. I want it simple like in Raptor or Tyrian, where the ships come in a predetermined pattern. I just have no idea on how to start, so I''m looking for ideas or source code. Any help would be appreciated. Thanks Llew

Share this post


Link to post
Share on other sites
Advertisement
Well, what'' i''d do, is just make a file for patterns. It would tell what position to put the ship in each frame(or how much it should move each frame), and what sprite it would use(like, say you had a teleport sprite if it was about to go across the screen)... also, it''d include any actions like when to shoot, etc.

Then, the level file would specify which file each ship used, and they''d all be loaded in at the start, and just parsed for each individual ship

Share this post


Link to post
Share on other sites
Ok, I think I get it.

Just have a preset pattern file, that tells it to move 10 pixels left(while banking to the left ie. use a different sprite frame) then shoot, then 15 right, that kinda thing. I''d make it generic so it could be used with any enemy. And in the map editor, when placing a ship give it a path also. Probably include a path editor aswell.

One question though, in a game like this (vertical scroller), would I only initialize the enemy when it is a about to come on the screen and then initialize the pattern? I think that would be the best way. If there is a better way, I''d be glad to hear it.

Thanks SeanHowe

Llew

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
yup, just initialize when they come on screen... that''s the way i did it, and it worked fine.

Share this post


Link to post
Share on other sites
Hi
In almost all side/updown/tile based shooter games, you
position the objects (enemies,etc) in the map editor.
at run time your engine will triger them when they come
on the screen or they are near to be on the screen,
i have a Focus function for all objects, when they are
trigered they start their action (move,rotate,shoot) the
Focus function is the object''s brain.
Do a general engine, you also need to implement a
powerful map editor with the capabilities to set and
edit several property and flags for each object, for
example speed, shooting delay, rotation speed, life,...
Such map editor and engine can be used to develop
too many games of the mentioned types.
And one thing, do it in 16bpp video modes, if you need
ground tiles, i have ripped Raptor, Tyrian, Delta Force2
tiles from their files Delta Force2 has many true color
tiles.

Share this post


Link to post
Share on other sites
I am wondering about copyright issues with using tiles from those games. I will be releasing the game as freeware, but charging for it to be shipped on a cd with full screen movies. So basically they are payihng for the movies, not the game, since it can be downloaded. Does anyone know if I could use these tiles then?

Share this post


Link to post
Share on other sites
i''m not sure about this, but i think you''d only be able to charge for shipping and cost of disc.


crazy166
some people think i'm crazy, some people know it

Share this post


Link to post
Share on other sites
Ok, so could I use tiles from tyrian or raptor if I released it as freeware, no charge at all? I am kind of thinking I''m not allowed to. I dunno though.

Llew

Share this post


Link to post
Share on other sites
no, copyright infringement is copyright infringement.. it doesn''t matter if you give it away free of charge, it''s still illegal (check out the thread(s) about the Hasbro suit)

Share this post


Link to post
Share on other sites
(1) move patterns work well
(2) I use a linked list! Sprite is simply added to the list shortly before it appears on the screen
(3) I currently use keyframing (splines) for the path! So I define some positions between the sprite is interpolated. This works very fine! Very smooth movement and easy creation of path!

Share this post


Link to post
Share on other sites
Well, actually, I was going to make something like that. Except I was thinking of something more like this:

You specify the starting point on the world map. You specify the sprite. Then you do something like this:

int x = x_start_coordinate;
int y;//y path


//in main loop
y = x^2 + 5;

//update the ship''s position
moveship(x, y)

//every 150 y coordinates
if(y %150 == 0)
{
//this function would make the sprite shoot at
//the user''s ship
shoot(&sprite);
}

or something like that.


"Remember, I'm the monkey, and you're the cheese grater. So no messing around."
-Grand Theft Auto, London

"It's not whether I win or lose, as long as I piss you off"
-Morrigan, Super Puzzle Fighter II Turbo

Share this post


Link to post
Share on other sites
Here''s my little piece of advice, AFAIK division is the slowest operation for a CPU. So don''t use %,/ or \ too much. Especially for EACH sprite in your game loop. Of course I could be wrong, so anyone?

-------------------------
-Now Working on Pokemon like Engine!

Share this post


Link to post
Share on other sites
quote:
Original post by Marauderz

Here''s my little piece of advice, AFAIK division is the slowest operation for a CPU. So don''t use %,/ or \ too much. Especially for EACH sprite in your game loop. Of course I could be wrong, so anyone?


You''re almost right. Those operations are slow, but not that slow. Using them on a per-sprite basis is almost always ok. It''s when you use them on a per-pixel or per-vertex basis that you want to look into optimising them out. Remember - such optimisations should be left until you know you need them! As cleaner code is of more use to you in the meantime.

Share this post


Link to post
Share on other sites
In my recent project I store the ship path as vertex points. These points are then used to calculate a linear, quadratic, or cubic spline. I realize these methods aren''t the fastest but they give the smoothest possible movement and are VERY easy to design!

Share this post


Link to post
Share on other sites

  • Advertisement