PDA

View Full Version : Nickel Iron / HTML5 game written in... Object Pascal!



Eric
12-01-2012, 02:38 PM
My small pet/test game project of an HTML5 / Canvas game written in Object Pascal

It is built with OP4JS (http://www.op4js.com/) (currently in Alpha), which is using DWScript (http://code.google.com/p/dwscript/) as compiler to generate JavaScript from a Object Pascal source code (so you get strong typing, compile-time syntax checks, virtual methods, etc.)
The output runs in iPad, iPhone, Android 2.3+, Chrome, etc.

http://i.minus.com/iik6CFKrQ05dp.jpg

Below are a couple videos captured in the Android emulator.

Very very first version:

http://www.youtube.com/watch?v=Y01RielSxJ0

Some sprites later:

http://www.youtube.com/watch?v=ErADEGJowTU

WILL
12-01-2012, 08:09 PM
Neat. :)

I was wondering when someone was going to make a game with OP4JS. Are you planning something bigger for the next game project?

I don't dare say 3D. :P

Eric
13-01-2012, 10:02 AM
Currently I'm planning to mostly add to it, things like achievements, global high-scores, more levels, etc. to test the tech.

Maybe make other small games, I've noticed I tend to get swamped by the need for art in larger projects (sprites, textures, models, music...), placeholders graphics only go so far, and I'm just not time-efficient at doing any kind of art myself, quick PaintShop hacks are okay, but anything more complex and I'm doomed ;-)

3D may or may not be too far removed, it'll depend on how fast the W3C settles on a 3D standard (be it WebGL or something else).

Ñuño Martínez
26-01-2012, 01:23 PM
My small pet/test game project of an HTML5 / Canvas game written in Object Pascal

It is built with OP4JS (http://www.op4js.com/) (currently in Alpha), which is using DWScript (http://code.google.com/p/dwscript/) as compiler to generate JavaScript from a Object Pascal source code (so you get strong typing, compile-time syntax checks, virtual methods, etc.)
The output runs in iPad, iPhone, Android 2.3+, Chrome, etc. Great job.

So you wrote the program in Object Pascal and translated it to JavaScript... But DWScript website says it's a "scripting engine for Delphi". Does it do the translation? Does it work on Linux? Does it work on WineHQ?

Eric
26-01-2012, 03:12 PM
But DWScript website says it's a "scripting engine for Delphi". Does it do the translation?
It also says "Scripts can be executed from Delphi applications [...] or compiled into JavaScript that can be run client-side in a browser or any Javascript-capable engine" ;)
So yes, it takes Object Pascal source, and spits out JavaScript.

Does it work on Linux? Does it work on WineHQ?
The JavaScript runs as long as you have a compatible web browser, anything not too ancient should be okay. For game stuff you need at least Canvas support, and the game is primarily tested/profiled for WebKit-based browser, ie. iOS, Android, Chrome & Safari.
FireFox, IE9 & Opera are okay except for some graphical glitches on the menu buttons (they aren't done in Canvas, but in HTML, and lack some specific CSS).

As for the compiler, at the latest news, DWScript compiles under FreePascal, but execution is problematic due to bugs in the FreePascal compiler/runtime wrt to Variants & Unicode Strings.

Ñuño Martínez
26-01-2012, 05:06 PM
Sorry, I read it too fast... I'll try to use the compiler in WineHQ.

WILL
26-01-2012, 09:52 PM
Have you updated your OP4JS source to Smart Mobile Studio yet? :) Or does it need much updating at this point?

chronozphere
27-01-2012, 07:11 PM
Wow, I didn't even know that this was feasible to do. :D I'm very curious about some benchmarks, that show the quality of the compiler. It would be a shame if the pascal version would be significantly slower.

paul_nicholls
02-02-2012, 03:43 AM
I thought this game was on the android market now, but I can't find it!

WILL
02-02-2012, 06:34 AM
I thought this game was on the android market now, but I can't find it!

That depends on how it's packaged for distribution. I'm assuming that the tool developers will be leaving it open for maximum flexability for the individual developers to decide; strapped on JavaScript run-time engine, pages to be loaded on a web server and so on...

The end result would be 100% web compatible so I think that the end product's form will depend on those that use it to make HTML5 apps and games.

paul_nicholls
02-02-2012, 08:59 AM
I just realized that I might have been getting confused with this Android app made with Smart Mobile Studio!
https://market.android.com/details?id=no.optimalesystemer.SmartMobileStudio_G alaxyClock

:D

cheers,
Paul

WILL
02-02-2012, 11:04 AM
Neat! :)

...and Tweeted. ;)

paul_nicholls
03-02-2012, 09:01 AM
If you were wondering how the Smart Mobile Studio made an Android app...PhoneGap (http://phonegap.com/) was used to convert the webpage version to an android app :)

WILL
03-02-2012, 09:26 AM
If you were wondering how the Smart Mobile Studio made an Android app...PhoneGap (http://phonegap.com/) was used to convert the webpage version to an android app :)
Sounds like a great Pascal Gamer article to me. ;)

Eric
03-02-2012, 07:45 PM
I thought this game was on the android market now, but I can't find it!

Not yet, I'm still adding stuff, and cleaning up the Java wrapper.
There is not much Java (less than 50 lines, including blanks & lines with only a squigly), but I've been tweaking the Android WebView option. PhoneGap doesn't really cut it for a game on Android, due to bugs in the Android 2.x browsers: things like scrolling & pinch-to-zoom can only be disabled on the Java side (for iOS, the viewport meta works perfectly AFAICT).

Performance is more complicated as there is a wild variety of devices, it runs at 30FPS on my HTC Desire, but I've add some issues on older phones and tablets (apparently some Android tablets don't have the hardware acceleration enabled). And need to find time to package the app (make the icon, marketplace graphics, etc.).

But it's coming ;)

paul_nicholls
03-02-2012, 09:07 PM
Thanks for the update Eric :)

Eric
17-02-2012, 07:45 AM
For those that want to give it a try, it's now on the Chrome Web Store

https://chrome.google.com/webstore/detail/fpagfgmeingaacdkophbpicjdhoncgkj

And Android marketplace

https://market.android.com/details?id=info.delphitools.nickeliron

it even has a minimal webpage for it

http://delphitools.info/android/nickel-iron/

Next in the list, looking at adding global high-scores, & achievements. Not sure what service to use, OpenFeint doesn't seem to have a RESTful API for posting scores (only for reading), otherwise I would have used it (could do my own global high-score server, but where would the fun be? ;-))

paul_nicholls
17-02-2012, 08:21 AM
Very nice Eric...thanks for sharing :)

paul_nicholls
17-02-2012, 08:23 AM
Is there any chance you could send me the missile command .apk file? The android market says it is incompatible with my device, and I would still like to test it :)
Email:
paulfnicholls AT gmail DOT com

cheers,
Paul

Eric
17-02-2012, 08:41 AM
Sent. The only requirement is Android 2.2+ (Froyo) though.

paul_nicholls
17-02-2012, 08:50 AM
Thanks mate! I just happened to have my tablet on, and it said I had a new email...and it was that! :D

It works nicely, and is very responsive as far as I can tell :)

If you were wondering, I have the heavier version (M7) of this tablet:
http://apads.com.au/haipad-m7s-slim-light-edition-bluetooth-1ghz-samsung-pv210-white-p-103.html
Mine is a Hiapad M7...

I did notice one thing...it would some times say that I could repair a missile launcher, but not give me anything to click on to - unless I am going blind? haha

The google chrome version didn't seem to allow me to repair any launchers, but only say I could :)

Very nice work chief!

cheers,
Paul

Eric
17-02-2012, 09:00 AM
Thanks mate! I just happened to have my tablet on, and it said I had a new email...and it was that! :D

Any idea why market didn't allow it? Does it happen for other app?
I don't ask for any right and your tablet is above 2.2.


I did notice one thing...it would some times say that I could repair a missile launcher, but not give me anything to click on to - unless I am going blind? haha

Did you have the flashing "repair"? You need at least +10 bonus for that (otherwise there is only a dark text, which might be confusing)


The google chrome version didn't seem to allow me to repair any launchers, but only say I could :)

Oops! Chrome sends mouse clicks, and I test repair only in the touch events! Will fix.

paul_nicholls
17-02-2012, 09:16 AM
Any idea why market didn't allow it? Does it happen for other app?
I don't ask for any right and your tablet is above 2.2.

Not sure why it happens...maybe it is a resolution issue? I don't know...it could just be due to my 'dodgy' Chinese tablet! haha
I have sometimes seen it with other apps, but not too often.


Did you have the flashing "repair"? You need at least +10 bonus for that (otherwise there is only a dark text, which might be confusing)

Ahhh...I did have the dark text only...I guess I didn't have the +10 bonus at the time :)


Oops! Chrome sends mouse clicks, and I test repair only in the touch events! Will fix.

Ok, no worries :)

Eric
07-03-2012, 07:32 AM
Just got a copyright infringement notice from Atari, apparently became a large enough blip on their radar to be worthy of the effort (I didn't knew they were still in the business tbh, and didn't expect to make a blip either).

I'll be renaming it to "Nickel Iron", if some admin can change the title of this thread?

WILL
07-03-2012, 10:42 AM
Changed the thread title. Well I'd personally take that as a compliment. :)

Not sure if Nickel Iron is as great a title. Actually I don't get it myself, but it's your dime. ;)

Question; Is this actually a commercial project or just a freeware game? Can't see how a fan-made for free clone could threaten them as there have been lots of notorious games that have been cloned and successful, yet the original creators never went after them.

Atari is indeed alive and making games ...I think. They are now owned by Infogrames.

Eric
07-03-2012, 11:03 AM
Not sure if Nickel Iron is as great a title. Actually I don't get it myself, but it's your dime. ;)
Probably not, was the first title vaguely related to asteroids (Nickel Iron core) that apparently wasn't related to any trademark, and I was in a hurry ;-)


Question; Is this actually a commercial project or just a freeware game?
Freeware.

After receiving the notice, I made a search on the name mentioned in the notice, and found they apparently went against other free & fan sites (f.i. http://atariuser.blogspot.com/2011/08/atari-continues-efforts-to-alienate-and.html).
There is a note on the site above that they apologized, but I'm not sure what really happened, given what you can still see at http://atari2600.org/

Eric
07-03-2012, 04:32 PM
Could you rename it too in the February roundup as well? Sorry for the trouble... :(

paul_nicholls
08-03-2012, 05:11 AM
Hey Eric,
I just searched for the new title "Nickle Iron" on the Google Market (play.google.com), and discovered that it is now compatible with my android tablet that it wasn't before...neat!

I wonder what changed?

cheers,
Paul

Eric
08-03-2012, 07:16 AM
I wonder what changed?
I didn't change anything in the manifest.xml, maybe some glitch in the market that got solved during the transition to google play?

paul_nicholls
08-03-2012, 10:18 AM
I didn't change anything in the manifest.xml, maybe some glitch in the market that got solved during the transition to google play?

Maybe...will never know I guess :D

SilverWarior
23-06-2013, 06:59 PM
@Eric
Congratulations for your game being accepted by FireFox Marketplace.
http://www.delphifeeds.com/go/s/105380

Darkhog
23-06-2013, 09:57 PM
While I appreciate effort you put into this game and general idea of making game with OP for android/HTML5, I must say this game is poor man's Missile Command version. It is fun to play around for few minutes but that's it. Some ideas to make it better for second version (and possibly make it mobile hit):

- Make it a cross between Asteroids and Missile command (Asteroid Command?). I.e. asteroids would split up into smaller ones, just like in original game of Asteroids, but you can't move your ship and has to deal with them Missile Command way
- Add (on later levels, when you're sure players are accustomed with controls) standard Missile Command stuff (ships that shoots missiles, missiles that splits up, etc.).
- Add bosses. In every 10 levels or so, there would be boss level. Boss would shoot asteroids or missiles, sometime both. You'll need to destroy those, but also shoot at boss to defeat it (which would have health bar). You could also shoot at asteroid/missile cannons so boss can shoot less or no amount of them.

WILL
24-06-2013, 06:41 AM
This is good to see. Congrats! I up-voted you on DelphiFeeds. ;)

Once I get Subject 33's first gameplay video I should write up a story about the first Object Pascal (Oxygene for Java) written game coming to the OUYA. Other than those couple of games that were made for the PGD Challenge mini-competitions, that's almost the breadth of the known games made with Oxygene. A capable games dev platform I should note!

I was working with Marc at RemObjects and Dr. Morrison creator of the Pascal Programming for Schools website project to setup his school, located in England, with a whole classroom full of Oxygene for Java to help get professional tools into the classroom for those learning Object Pascal. It also helps to grow the Pascal game programming culture as well. Plus I think the Students love the idea of being able to install their school (game) projects right onto their own Android devices so they can play them with their friends at their school.

I wonder what the take on Smart Mobile Studio would be in schools. Or if they would even be ready to support such a program.

paul_nicholls
24-06-2013, 08:27 AM
This is good to see. Congrats! I up-voted you on DelphiFeeds. ;)

Once I get Subject 33's first gameplay video I should write up a story about the first Object Pascal (Oxygene for Java) written game coming to the OUYA. Other than those couple of games that were made for the PGD Challenge mini-competitions, that's almost the breadth of the known games made with Oxygene. A capable games dev platform I should note!

The aforementioned video will happen after we fix some hiccups we are having ;)


I was working with Marc at RemObjects and Dr. Morrison creator of the Pascal Programming for Schools website project to setup his school, located in England, with a whole classroom full of Oxygene for Java to help get professional tools into the classroom for those learning Object Pascal. It also helps to grow the Pascal game programming culture as well. Plus I think the Students love the idea of being able to install their school (game) projects right onto their own Android devices so they can play them with their friends at their school.

That is awesome news Jason!! :D

Eric
25-06-2013, 08:24 AM
Thanks!


While I appreciate effort you put into this game and general idea of making game with OP for android/HTML5, I must say this game is poor man's Missile Command version.

Yes I know, I haven't been able to find much time for it, nor for other games.
I suppose the next things I'll be doing will be global high-scores or leaderboards though. I had been trying Playtomic sometime ago, but their servers weren't very stable, and they went offline, and I haven't had time to investigate alternatives.


Other than those couple of games that were made for the PGD Challenge mini-competitions

Yep, not much activity on the Pascal gaming front. I guess right now the issue is being stuck between ready-to-use game engine on one side, and hardcore C/C++ engines on the other.

The new platforms could be an opportunity, though they're still small in terms of market.

FireFox OS phones out there are still counted in the thousandths as far as I can guess, though that could change given the various partnerships they announced, but at the moment everything is still up in the air.


I wonder what the take on Smart Mobile Studio would be in schools. Or if they would even be ready to support such a program.

IIRC Jorn mentioned something about a "for kids" version sometime ago, I can't speak for him, but it's probably more a question of time and opportunity - since you're involved in such, you know the logistics involved :)

Darkhog
25-06-2013, 11:37 AM
I think it wouldn't be good to dumbing down SMS* for kids. I think it'd be better if Jorn or someone else would write point & click code generator, like Scratch that would generate proper Pascal SMS code. Then kids would be able to look into code generated and teacher could explain why code is written way it is and how it works. Kids would be able to make game visually, yet they'll learn Pascal skills.

*Smart Mobile Studio, not Short Messaging Service ;).

Eric
25-06-2013, 12:23 PM
I think it wouldn't be good to dumbing down SMS* for kids.

That's the idea AFAIK, mostly simpler layers/generators/libraries on top of the usual Pascal.

Personally, I kinda like systems where you can go from bird eye high-level components, all the way down to intricate implementation details if you want. That's why I picked Delphi over VB (only had the bird eye's view) and moved from C/C++ (where you're constantly buried in implementation details).