PDA

View Full Version : Delphi's "Meteors" sample running in Chrome



Eric
29-03-2012, 12:58 PM
http://lh3.googleusercontent.com/-rVSVjDAru9U/T3RZCuTgDII/AAAAAAAABCc/rm5yE2_Jy5Q/s592/sms+meteors.png

Just for the fun of it I adapted the "Meteors" Delphi sample to SmartMobileStudio, compiled to JavaScript, ran it in Chrome.

Code changes are quite limited:
- changed TCanvas methods to TW3Canvas
- dropped the FreeAndNils
- changed Point() to w3_Point()
- declared TSize record
- change Random() to RandomInt()

That was about it. Not playable just yet (bug with the keyboard events), but otherwise it's alive!

Anybody knows who originally wrote that game? I would like to know about licensing issues before posting anything online.

PS: 19 FPS is the fixed frame-rate for DMeteors, in Delphi it's enforced by a timer, and the game code doesn't have any provision for variable frame-rate ;)

Eric
24-04-2012, 07:52 AM
Taking a break from PGD Challenge, I've revisited the thing, added some centering and clipping, but otherwise left everything untouched.

Try it there: Delphi Meteors running Web-side (http://delphitools.info/wp-content/uploads/2012/04/meteors.html)

Controls are unchanged: arrow keys to accelerate & turn, space bar to fire.

de_jean_7777
24-04-2012, 09:04 AM
Tried it in Firefox and Chrome, works. I'm not sure if the original Delphi sample behaves the same, but the acceleration of the ship is too high, unlike the original Asteroids.

paul_nicholls
24-04-2012, 09:21 AM
It runs here on my shiny new iPad (3rd generation) but I can't move or fire of course as I guess you have not implemented the touch routines :D

Eric
24-04-2012, 09:52 AM
Tried it in Firefox and Chrome, works. I'm not sure if the original Delphi sample behaves the same, but the acceleration of the ship is too high, unlike the original Asteroids.
The Delphi version is rather unplayable too, and even has more asteroids, so it's usually insta-death as you often spawn right on top of a meteor....


It runs here on my shiny new iPad (3rd generation)
I might revisit it for the iPad as an experiment on implementing multi-touch left hand/right hand controls (mimicking a gamepad, like many games seem to do)

That said http://bit.ly/nickeliron and http://bit.ly/wartrail should run just fine on your new iPad, they're both Object Pascal compiled to JS/HTML5 (but they ain't retina-ready, I have only an iPad 2 ;))

Nickel-Iron was my first attempt, I'll probably revisit it with the things I've learned doing WarTrail, to add more visual effects, leader-boards & such. Once that's done, I'll probably have experimented and have enough existing code to wrap everything into a Pascal mini-gamedev library for HTML5.

SilverWarior
24-04-2012, 02:51 PM
I tried it in IE9. It works. I also do have to complain about to fast acceleration.
Also I noticed that asteroids move only trough the middle part of the gamefield and not on sides. So you can just move on one side and stay there forever.

Eric
24-04-2012, 02:59 PM
They can even be motionless if you're lucky: the Delphi code doesn't have a minimal or even a set speed for them, every time you refresh (or restart in the Delphi version), they get a new random speed.

SilverWarior
24-04-2012, 03:47 PM
I gues you are correct.