Tile-based game design problem

Started by
15 comments, last by Spalaen 19 years, 8 months ago
If I'm understanding your question properly, then I would say that bresenham's line algorithm would fix your littly problem. It would get your projectile from point a to point b. You really can't make it look good in the situation you've described where the target is two squares across and one square up. As the guy mentioned before, it would look better with smaller squares. It is convenient to subdivide your tile based map into smaller units, the most convenient unit being pixels.
Advertisement
Umm, the question is a gameplay question, not a math or intersection question.

For example, firing 2 tiles to the right hits 2 tiles. Firing 2 tiles to the upper right hits 2 tiles. Firing a knight's move [2 movement distance] would hit 3 tiles if done by intersection, making it more powerful.

Most games I've seen handle this by making the projectile arc. Thus the projectile only hits 1 tile within a radius rather than a 'line' of tiles.

If the projectile always produces a numerical result, you could simply make the "middle" tiles take a % of the result [as they only recieve a % of the blast?]
Yes, it is a gameplay question thanks Telastyn.

Unfortunately I intend to have both arcing and direct projectiles, so I can't use the 'arcing' rationale all the time. Also, the projectiles may cause a qualitative change, so I don't always have the option of dividing the effect up proportionally. Think 'Finger of Death'. Good suggestion though (also thanks Thermo, but same problem if I do 50% chance per square - which square do I check first?).

As for changing to a per-pixel game, I have considered this, since it would solve the problem (players would not really notice if the "tiles" are that small). There are very good reasons for sticking with plain tiles, for both simplicity in design, and better gameplay. I should clarify that this is for a turn-based strategy game.

For instance, if I did do per-pixel movement for projectiles only, then I would have to represent the actual shape of every unit in order to find out whether a hit occurred. For the purposes of this post, assume I am restricted to unit-sized tiles at least - I'll start another post if people really want to know why I'd stick with straight tiles.

I don't have an issue with the drawing of the projectile, or working out the tiles it intersects - just the gameplay issue really.
If the qualitative effects are singular, that is once the "finger of death" hits something it stops and the unit dies, I think that passing over the 3 tiles is not so bad.
The effects won't always be singular, so the solution must work in both cases.

EDIT : Actually the proportional distribution could actually work. For quantitative effects, I apply the results proportionally, and qualitative effects I apply possibly. Thanks to Telas, Thermo. The coding will be a real pain, unfortunately :(


[Edited by - Spalaen on August 19, 2004 6:35:49 PM]
Quote:Original post by Spalaen
The effects won't always be singular, so the solution must work in both cases.

Thanks to Telas, Thermo.

No problem. I am always glad to sound like I know something. ;)

Quote:but same problem if I do 50% chance per square - which square do I check first?).


This is easy to figure out. It hits the tile adjacent to you first. If you want proof, draw out the tiles and draw a line from the unit to the target. If the effect is singular you may want to lower the probability slightly below 50% (consider its a shot that is dodged more easily.

Hope this helps.
[s]I am a signature virus. Please add me to your signature so that I may multiply.[/s]I am a signature anti-virus. Please use me to remove your signature virus.
Quote:This is easy to figure out. It hits the tile adjacent to you first.
Doesn't work for hex-shaped tiles unfortunately (which is what I'll be using). The square tiles were just to make the example easier to follow. I actually had a rethink, and I don't want to go with 50% probabilities - will go with attacker's choice I think, if anyone's interested.

This topic is closed to new replies.

Advertisement