scottschiller / ArmorAlley

A browser-based interpretation of Armor Alley, a combat strategy game originally released in 1990 for the Macintosh and MS-DOS PCs.
https://armor-alley.net/
Other
91 stars 25 forks source link

Question: Bullet speed, trajectory, and enemy AI helicopter behaviour? #20

Open supercom32 opened 3 weeks ago

supercom32 commented 3 weeks ago

Hi again,

After spending some time playing with the new 25% camera fix, I started to notice that bullets behave kind of strange. When moving forward, machine gun bullets travel out at an impressive speed and distance. However, when moving backwards, bullets travel extremely slowly and only cover a very a short distance. This makes combat flying backwards almost impossible against enemy helicopters as your shots don't really travel any meaningful distance at all. Meanwhile, the enemies machine gun has no issues firing forward to reach you.

I guess this also leads into my second question: Is there a reason why the AI enemy helicopter has a propensity to just kamikaze you, instead of trying to dodge you and have a proper dog fight? In the original game, the AI actively tries to avoid crashing into you and you have to engage in dog fights, or be extremely careful and deliberate in order kamikaze the CPU. This CPU unwillingness to preserve their own life is exacerbated by the fact that often they will choose to hide in clouds (for long periods of time) and just wait for you to approach so they can make a deadly assault which almost always ends with an unavoidable collision.

These behaviors could be designed as intended, or perhaps omissions, or even unintended/WIP. I figured I'd just bring them up as a discussion in case it was not on anyone's radar.

scottschiller commented 3 weeks ago

I noted a shift in some of the velocities after the 25% buffer change, also. Gunfire, bombs and certain trajectories are relative to the helicopter speed and may need some adjustment. Initially, my version didn't account for the angle of the chopper, nor trajectory as I recall.

While more "accurate", it may be best to have gunfire always travel at a reasonable speed away from the helicopter - as noted when flying backwards and being chased, the enemy has the clear advantage. I need to review, but I think the original game has somewhat less trajectory and also ensures that ammo fired while facing backwards moves away from the chopper at a reasonable speed.

The AI is "rudimentary" at best and there is much left to be desired, I left a number of disclaimers when I first wrote these bits in the code. ๐Ÿ˜… The AI doesn't have a mode where it tries to crash into you, but that can happen if you get in its way at certain times.

The "AI" modes, roughly, are:

supercom32 commented 3 weeks ago

Hi again,

Thanks for the kind reply. Ah, I figured as much for the AI. I think the emerging behavior is probably a result of "target player and get within firing range" and the fact that it inherently implies that the CPU must align itself to you (For machine guns), and then travel at velocity to chase you. This basically makes the CPU like a missile since it will follow you and maintain altitude until it kills you or hits you? ๐Ÿ˜… (Usually ends up hitting you). The hiding in the cloud mechanic is interesting (dodging missile locks!), but the CPU sometimes commits to it for a really long time, almost like it's trying to camp you. A workaround I started doing is randomly spraying a cloud with machine gun fire just to check, but it's kind of annoying having to exhaustively check each cloud at distance for this.

As for ordinance fire speed and velocity, It probably would be fair to say they need to be adjusted. When trying to go in for a bombing run, the bombs just fling wildly forward or backwards until your almost stationary and dropping them down vertically. So if you try to go in for a fast strafe and retreat (to avoid missile fire for example), it's extremely hard to predict where they'll land. I don't think the original game had this much sensitivity to angles and such.

Anyway, thanks for your time. I really do appreciate your care and dedication to this otherwise amazing port!

PS: Random thought. Maybe this could be ported to run under Electron so that it could be a stand-alone binary for Linux/Windows/Mac, etc? ๐Ÿค” Another random thought, is shrapnel supposed to be as explosive as it appears? ๐Ÿ˜„ It seems like as soon as a crash or explosion happens, the entire screen is filled with an overly enthusiastic amount shrapnel which makes it really hard to avoid. Looks really cool, but I always seem to end up smoking afterwards since there's so much of it flying all in directions. Maybe the 25% screen change also effects how they fly?

scottschiller commented 3 weeks ago

Thanks for the feedback. I've had a lot of folks find and enjoy playing this one. There are tons of little details in the original - so any time someone recalls some aspect of gameplay that doesn't feel right, I try to go back and review.

The AI could use improvement. I recall the enemy sort of flies in a sine wave pattern and sometimes jumps vertically to avoid stuff, I have a note to try that at some point. The enemy also can drop paratroopers to guard against smart missiles and/or your gunfire, I have not yet implemented that. I don't recall if the original game did this on easier levels, or later on in harder missions etc.

The "AI" rolls the dice on a timer to choose the next strategy, and it may be that it repeatedly gets "hide in a cloud." I can improve this by at least forcing it to choose a different strategy.

Bomb velocity feels too fast with the 25% change. It was simply calculated based on the helicopter's horizontal velocity, vX * 0.75 - I've tested it at 0.5 and it's looking better.

Shrapnel may be a bit aggressive, I will review. I recall helicopter explosions being very dangerous in the original, similar to how you mention. The chopper would often move up vertically on the last frame when I was bombing from above, and shrapnel would fly upward and outward, fast. Hard to avoid getting hit!

Someone mentioned Electron or an app, then it could be on Steam - that could be another project, perhaps. It's not the same, but you should be able to "install" the game from within Chrome per PWA (web app) standards and then it can have its own icon on your desktop etc.