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

How to force camera to center screen? #18

Closed supercom32 closed 3 weeks ago

supercom32 commented 3 weeks ago

Hi there,

When playing Armor Alley remastered, I noted that the camera doesn't follow the helicopter. That means, as you push right to fly forward, your helicopter ends up being at the front of the screen making it virtually impossible to react to oncoming helicopters, attacks, or other obstacles. Is there a way to lock the camera on your helicopter, or make it push forward so that your helicopter remains centered or back from center, so that you can actually see and react to oncoming game-play? I kind of feel like this makes the game unplayable without it.

scottschiller commented 3 weeks ago

Thanks for the feedback, this is worth a review. This effect may be most noticeable on larger windows and widescreen / landscape monitors.

I think I set this behaviour with the earliest version of the game back in 2013. The original game has a buffer of sorts; the view isn't locked on the center and the chopper has some "freedom", but it can't go right to the edge of the screen.

Comparing vs. the original DOS version, the chopper's movement is limited to roughly the center half of the screen, e.g., 25% buffer on each side. I had set mine at 5%, so I will adjust accordingly. 😅 The trade-off here, historically, was you could fly fast out on the end but collisions would be more likely - so you had to watch the radar a bit more.

I may implement an option in preferences for this, so you can choose e.g., lock the view and chopper in center at all times, 25% (like the original game), or 5% (my own "V1") boundary.

scottschiller commented 3 weeks ago

25% buffer for now, this should be closer to the original. https://play.armor-alley.net/

supercom32 commented 3 weeks ago

Ok wow, that was fast. I just verified the change and this is way more playable now. :smile:

In the original game, it takes a fair bit of time before your helicopter reaches the far left/right of the screen. Almost like it goes fast at first, and then slows down by halving camera speed as it gets to the edge. In this version, it's pretty uniformly fast and responsive, but at least the 25% buffer makes the gameplay feel fair and less arbitrary cheap.

Thanks again! Much appreciated!

PS: Is there a way to full screen or full focus the game so your mouse cursor locks inside the browser and doesn't scroll off screen or over other windows? I thought maybe ALT+Enter or something might do it, but I guess it has to be programmed into the individual game or something. Maybe keyboard support to directly control your helicopter would make this moot perhaps? I know the original game supports keyboard, which moves a virtual mouse pointer (kind of jank). Not sure why it didn't just allow for the direct control of the helicopter.

scottschiller commented 3 weeks ago

You caught me at a good time, I just happened to be refactoring a few sprite asset things when the report came in. 😂 I may be able to get a similar "backing-off" effect when the chopper is closer to the edge, TBD. There is a balance between responsiveness, velocity, and scrolling of the view and so on.

Noted RE: pointer lock - the game should be OK in full-screen when staying within the screen boundaries, but I don't presently have a multi-monitor setup to test with and so that part is unclear. I imagine if I enable pointer lock, then the game should work in a window similar to how it would be in full-screen if you moved the mouse off to a different monitor.

Unsurprisingly, it appears Safari is somewhat behind in terms of support. https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API