Wedge

Public area => The Pub => Off-topic => Topic started by: Arantor on December 10th, 2011, 05:22 AM

Title: I couldn't sleep
Post by: Arantor on December 10th, 2011, 05:22 AM
I couldn't sleep tonight and I've been in something of a rut in terms of coding, wanting to do really little time wasting things rather than epic code production.

Now, I have a licence for http://impactjs.com/ and I finally got around to trying it, this is my first game in Impact, and I've spent maybe a little over 2 hours on it total, but I'm pretty happy with the results.[1] Uses Canvas, so needs IE 9, recent Chrome, FF 3.6+ should work alright etc.

http://arantor.org/meteor-storm/

Here's the deal: You're a spaceship caught in a meteor storm, one of your engines is burned out so you drift to the left, but you can use the other to push you to the right.

The deal ultimately is to survive as long as you can. Holding down Space will engage your engines and push you to the right but at the cost of fuel. Fuel is replenished with hitting the little petrol pump icon, though it does slowly regenerate while drifting.

How long can you last?

(Mobile... doubtful to work. I haven't done anything with respect to binding the 'buttons' on the display to anything, so I doubt it'll work on mobile, but that's a tweak for tomorrow.)
 1. The background graphics are ones that come with a demo game, the main ship/asteroids etc are mine.
Title: Re: I couldn't sleep
Post by: Asgard on December 10th, 2011, 05:25 AM
^_^

Is fun.

My current high score is a paltry 31 55.

Works great in Safari 5.1.1 on OSX 10.7.2
Title: Re: I couldn't sleep
Post by: Dragooon on December 10th, 2011, 06:07 AM
I'd bind the space press event to screen click as well and remove the mobile button frame, would make it a lot more full of win.
Title: Re: I couldn't sleep
Post by: Arantor on December 10th, 2011, 02:31 PM
Well, if I were to do that, Dragooon, I'd end up with a shortened background. I didn't draw the background images, they came with one of the demo games, and I'm really no artist, so I'd probably end up having to roll my own... though maybe I could go for a black motif and use white pixels. *scratches chin* It was really just laziness on my part to reuse the images, though.

Yeah, I suppose I could bind space to screen click, actually... when you only have one control, etc. (Might prompt some interesting refactoring on the main loop though as the first thing it does is test for enter to restart. Long story as to why.)

I just intended to reuse the two buttons at the bottom, left for move, right to restart, again mostly out of laziness. I'm still amazed that I could get a game working in a little over two hours.
Title: Re: I couldn't sleep
Post by: Nao on December 10th, 2011, 05:43 PM
Too fast for me. My best score while using Space is 13, while my best score while relying on probability (i.e. not touching anything at all) is 23, on the third, ahem, "try".

Are you working on our easter egg? :P
Title: Re: I couldn't sleep
Post by: Dragooon on December 10th, 2011, 06:27 PM
For 2 hours it's a very good game, I managed to get 43 without touching anything on iPad :P.
Title: Re: I couldn't sleep
Post by: Arantor on December 10th, 2011, 07:08 PM
Hahaha, awesome :)

Yeah, it needs tweaks but considering that I didn't exactly attempt to balance it or anything and things like positions and spawning is pretty much random...

Theoretically, I could bundle it in Wedge; the Impact licence would allow me to do so. However, when you issue a build for a game, when it compresses all the JS files down into a single file, it uses JSMin, and even then I still end up with a 50K JS file (of which most of that is Impact) plus several hundred K of assets, of which the two background images account for most of it (my images are tiny seeing how the largest is the font, weighing in at 711 bytes)

I suppose I could try compressing it with Packer but I honestly don't know if it would work properly then.

It was just a nice couple of hours working on something that didn't have any massive code dependencies, didn't need to worry about maintenance or breakage down the line, or worry too much about security or performance.
Title: Re: I couldn't sleep
Post by: Nao on December 10th, 2011, 10:44 PM
I still have plans myself for a Js game ;)
Entirely in jQuery I think. A Gaps game using the card set I had had made for my 2006 project. Ah well!
Title: Re: I couldn't sleep
Post by: Arantor on December 10th, 2011, 10:47 PM
jQuery's nice for DOM manipulation and implementing drag and drop wouldn't be too strenuous for working with card images, but if you're working with Canvas, I'd say Impact can't be beaten, even if it is $99. The fact you get a (decent) bundled level editor is a major plus for me.

(What's a Gaps game?)
Title: Re: I couldn't sleep
Post by: Nao on December 10th, 2011, 10:59 PM
Gaps is the 'generic' name for Addiction Solitaire on Noisen ;) Took me years to find it out...
Title: Re: I couldn't sleep
Post by: Arantor on December 10th, 2011, 11:07 PM
Odd, I've never heard it called Gaps before. Various other things, but not Gaps. Makes sense, though.

And yes, it would work pretty well done in jQuery.
Title: Re: I couldn't sleep
Post by: Nao on December 10th, 2011, 11:16 PM
Well, that's what I'll be making sure of ;)

Of course I can't even get started on this before I'm done with Wedge 1.0... In my opinion. I know how... perfectionist I can be when it comes to any of my projects. And this would be a 'side project' and thus I'd devote time to it. Hopefully not too long but once I'm onto something... :P
Title: Re: I couldn't sleep
Post by: Arantor on December 10th, 2011, 11:19 PM
That's the thing, I'm finding that it's actually quite nice to have a side project that just isn't too demanding, perfectionist or otherwise. It makes a change from the multi-thousand-line things I end up working on.
Title: Re: I couldn't sleep
Post by: Aaron on December 11th, 2011, 12:44 AM
Quote from Nao on December 10th, 2011, 10:44 PM
I still have plans myself for a Js game ;)
Kyodai Mahjongg, WebGL edition? ;)
Title: Re: I couldn't sleep
Post by: Arantor on December 11th, 2011, 12:46 AM
Quote from Aaron on December 11th, 2011, 12:44 AM
Quote from Nao on December 10th, 2011, 10:44 PM
I still have plans myself for a Js game ;)
Kyodai Mahjongg, WebGL edition? ;)
Doooooo eeeeeeet :D
Title: Re: I couldn't sleep
Post by: godboko71 on December 11th, 2011, 01:09 AM
59 was best I could do before getting bored.
Title: Re: I couldn't sleep
Post by: Arantor on December 11th, 2011, 01:10 AM
Is it wrong to admit that my best is a mere 33?

Still, if you had 5 minutes of fun playing, then it served its purpose :)
Title: Re: I couldn't sleep
Post by: godboko71 on December 11th, 2011, 01:18 AM
Yep, would have lasted longer but really floaty today.
Title: Re: I couldn't sleep
Post by: Nao on December 11th, 2011, 08:58 AM
Quote from Arantor on December 11th, 2011, 12:46 AM
Quote from Aaron on December 11th, 2011, 12:44 AM
Quote from Nao on December 10th, 2011, 10:44 PM
I still have plans myself for a Js game ;)
Kyodai Mahjongg, WebGL edition? ;)
Doooooo eeeeeeet :D
I'd rather start slow. And anyway. Do you see an economic model in that? :P
Title: Re: I couldn't sleep
Post by: Dragooon on December 11th, 2011, 11:49 AM
Quote from Nao on December 11th, 2011, 08:58 AM
Quote from Arantor on December 11th, 2011, 12:46 AM
Quote from Aaron on December 11th, 2011, 12:44 AM
Quote from Nao on December 10th, 2011, 10:44 PM
I still have plans myself for a Js game ;)
Kyodai Mahjongg, WebGL edition? ;)
Doooooo eeeeeeet :D
I'd rather start slow. And anyway. Do you see an economic model in that? :P
I'll give you 5$.
Title: Re: I couldn't sleep
Post by: Arantor on December 11th, 2011, 02:42 PM
I'd pay, too, but really though what I'd do is make the core game free and pay for extra optional tilesets and so on.

Or, make an iPad app for it, I imagine the touch aspect would work pretty well.
Title: Re: I couldn't sleep
Post by: MultiformeIngegno on December 11th, 2011, 03:20 PM
Quote from Arantor on December 11th, 2011, 02:42 PM
Or, make an iPad app for it, I imagine the touch aspect would work pretty well.
+1 :)
I'd buy it!
Posted: December 11th, 2011, 03:17 PM
Quote from Arantor on December 10th, 2011, 05:22 AM
http://arantor.org/meteor-storm/

Here's the deal: You're a spaceship caught in a meteor storm, one of your engines is burned out so you drift to the left, but you can use the other to push you to the right.
Ahaha! It's a nice game!! ;)
Title: Re: I couldn't sleep
Post by: Aaron on December 11th, 2011, 04:17 PM
Quote from Arantor on December 11th, 2011, 02:42 PM
Or, make an iPad app for it, I imagine the touch aspect would work pretty well.
Oh, that's a good idea! Not sure whether there are proper Mahjongg iPad apps yet (I don't own an iPad), but worth looking into, I think. Especially since you can easily port it to iPhone and OS X afterwards.
Title: Re: I couldn't sleep
Post by: Arantor on December 11th, 2011, 05:21 PM
Porting to iPhone, yes, but porting to OS X may be a bit different depending on how you handle the touch side of things.
Title: Re: I couldn't sleep
Post by: Aaron on December 11th, 2011, 07:21 PM
I imagine the controls could be analogue to what Nao's using in Kyodai Mahjongg on Windows. Perhaps with the addition of multitouch goodness, of course. :)
Title: Re: I couldn't sleep
Post by: Arantor on December 11th, 2011, 07:27 PM
Therein lies the challenge. iOS only extends multi-touch connectors to the user, with click handlers mimicking single-presses in multi-touch contexts. While OS X has some of that too, it's not primarily geared for it and doesn't provide quite the same interfacing, so while the core language is the same, the underlying interface logic may not be the same.

Honestly, the bigger problem for converting Kyodai or similar to OS X/iOS is the fact that everything there is OpenGL oriented.
Title: Re: I couldn't sleep
Post by: Aaron on December 11th, 2011, 07:46 PM
Quote from Arantor on December 11th, 2011, 07:27 PM
Honestly, the bigger problem for converting Kyodai or similar to OS X/iOS is the fact that everything there is OpenGL oriented.
Quite. Shame the OpenGL drivers on OS X aren't nearly as good as they are on Windows and Linux, though. Experienced this myself while attempting to play games in Wine on my Macbook Air -- they run glitchy, whilst they run fine on Linux. I hear Steam had to workaround much the same issues when they ported their Source engine to OS X.
Title: Re: I couldn't sleep
Post by: Arantor on December 11th, 2011, 08:01 PM
*nods* I believe so but I wonder how much of that is related to the graphics hardware on the Mac itself (not knowing it in much depth)

One thing I do know, iOS itself works with OpenGL so that does make 3D graphics on portable devices a viable option.
Title: Re: I couldn't sleep
Post by: Nao on December 11th, 2011, 08:47 PM
I'm pretty sure I still have an archive somewhere of Kyodai Mahjongg 10.21, the last version that was built for OpenGL... Then I made the sad mistake of going Direct3D for version 11.00, and it took me several major updates to get it right. It was needed at the time (~1999) because OpenGL support was very poor on non-ATI, non-NVIDIA video cards. It wasn't the same market as nowadays.
I've always loved OpenGL more than D3D, but then looking at WebGL, I'm not sure I see much of the OGL syntax any more...

As for iOS, it's funny how you should all be talking about me making a version for it... I decided against it LONG ago, when I saw Moonlight Mahjongg on a friend's iPhone. It's pretty much KMJ for iOS, without the name and assets obviously. The guy is still working on it I believe... I bought it but I never play it. I don't play any MJ games actually...
Title: Re: I couldn't sleep
Post by: Arantor on December 11th, 2011, 09:28 PM
Quote
I've always loved OpenGL more than D3D, but then looking at WebGL, I'm not sure I see much of the OGL syntax any more...
WebGL isn't really OGL but iOS uses OGL pretty natively.

That's kind of ironic, and sad in a way, that you don't play Mahjongg any more after the amount of time spent on KMJ :(
Title: Re: I couldn't sleep
Post by: Nao on December 11th, 2011, 10:16 PM
Oh... even back in 1997, I didn't play it much!
The thing was that I played it from time to time, but not much, but my girlfriend of the time was addicted to Taipei, which I loathed, so I made a bet that I could do better than this in less than a week... After 4 days I had a much better clone and she switched to it. I just... didn't know *when* to stop working on it. ("A week" would have been a good suggestion.)

The only mahjongg games I played a LOT were the Shanghai family from Activision. Shanghai Dynasty, I loved these, mostly because they had the *proper* Mahjongg game as well (not the puzzle game.) The game's producer asked me if I was interested in hiring him after Activision pulled the plug on Shanghai. (That was sad.)
Title: Re: I couldn't sleep
Post by: Arantor on December 11th, 2011, 10:42 PM
Hmm, I've never played the proper Mahjongg game, though I've heard about it.

Seems like if you found a game you'd love to write and play you'd be well away!
Title: Re: I couldn't sleep
Post by: Arantor on December 12th, 2011, 02:59 AM
In other news, I felt a pang of nostalgia this evening so I fired up a Spectrum emulator and typed in a listing from a book written before I was born.

And you know what? I discovered two things.

Firstly, the Spectrum is awesome. If you never came across its keyboard, you will either love or hate it. It's a 40 key device, where each key had anything up to 7 different uses, depending on which key it was and what the circumstances are. There is something quite invigorating about using an editor that forcibly checks your syntax as you enter a line, and an editor that essentially wires *every* language construct to a keyboard macro. I do mean that literally. You want a common keyword? In keyword mode it's a single keypress. Want a more complex function, it's probably a symbol-shift + keypress away, or maybe extended mode (caps shift + symbol shift, puts you in extended mode)

I find that sort of imagination and ingenuity quite intriguing, because there's nothing like it today. I'll attach a screenshot of the result of what I typed in with a screenshot of the virtual keyboard in a minute. (Yes, the *real* thing had that printed on the metal faceplate around the rubber keys)

Secondly, there is actually something really rather nice about typing a listing in from a book. I don't know why there is, but in the course of ~80 lines of code maybe, I was able to play a working if simple game with graphics and sound, and see it be constructed as I went. I think we've lost that today, even with all the code samples out there, where you can copy/paste in a jiffy.

(By the way, the game's called Nightfall, the plot is that you're an aircraft flying along and you'll crash into the buildings unless you can bomb them all out the way. Interestingly, there is no 'win' condition written into the game, because such a thing is actually impossible in the game's design. Never mind.)

Also interestingly, the book this listing came out of, was the one that I learned to program from, years and years ago. The 20+ years I have since have taught me how many problems there are with the program structurally but the language doesn't allow for anything nicer. (No multi-line if statements. No separate functions, everything's with global variables etc. Heck, there's even DATA statements.)

But it reminds me of a simpler time, and I think we've kind of lost that a bit lately, you know?
Posted: December 12th, 2011, 02:47 AM

Also: posted on Facebook. I may actually have to start re-entering other stuff and posting it there too. I feel really nostalgic at the moment, and have done so for a little while.
Title: Re: I couldn't sleep
Post by: PantsManUK on December 12th, 2011, 12:06 PM
Ah, the Speccy... Machine I learned to program on (ooh! That gives away my age...). Didn't really like the rubber keyboard on them, and still dislike short-throw keyboards to this day. Can honestly say I looped JetPac though  :eheh:
Title: Re: I couldn't sleep
Post by: Nao on December 12th, 2011, 01:54 PM
Quote from Arantor on December 11th, 2011, 10:42 PM
Hmm, I've never played the proper Mahjongg game, though I've heard about it.
It's like a mix between (a bit of) poker and (a lot of) gin rummy, only much more complex and, thus, more interesting. Only problem is, every country (or even region...) has their own custom rules, so it's hard to say what you like etc. I know for a fact that I like the official Chinese rules best, but the Hong Kong and Japan variants are interesting, too!
Quote
Seems like if you found a game you'd love to write and play you'd be well away!
I loved writing it... I just didn't love playing it as much as in the early 90's.
Perhaps because I couldn't help but think of WORK when playing these games? :P

Probably will be the same with any other game, really...
Title: Re: I couldn't sleep
Post by: Arantor on December 12th, 2011, 03:05 PM
Quote from PantsManUK on December 12th, 2011, 12:06 PM
Ah, the Speccy... Machine I learned to program on (ooh! That gives away my age...). Didn't really like the rubber keyboard on them, and still dislike short-throw keyboards to this day. Can honestly say I looped JetPac though  :eheh:
I'm probably a shade younger than you by the sounds of things but it's what I learned to program on too; it wouldn't be until 1990 that we were able to afford something more powerful than a Spectrum... then I discovered the joys of Amigas.

I have to admit, though, the Sinclair machines all demonstrated a certain elegance and ingenuity that I just haven't seen anywhere else - true, everything built in the early 1980s *had* to be efficient because of the shortness of memory etc. but to cram an entire functional BASIC inside 16K is pretty impressive. Sure, other machines did similar things, like the BBC Micro (another British piece of technology) but there's something impressively imaginative about the way the Sinclair boxes worked. A complete computer in the size of a small paperback book, just plug in a TV and a power supply.
Quote
It's like a mix between (a bit of) poker and (a lot of) gin rummy, only much more complex and, thus, more interesting. Only problem is, every country (or even region...) has their own custom rules, so it's hard to say what you like etc. I know for a fact that I like the official Chinese rules best, but the Hong Kong and Japan variants are interesting, too!
Interesting. It's something I've heard about but just never had the time or enough motivation to really explore. Perhaps you could write a version of it for the web? (Or at least provide enough information on the rules or where I can go to find out more, because it could be an interesting plugin for Wedge, no?)
Quote
Perhaps because I couldn't help but think of WORK when playing these games?
Ah, that's a problem. I found it relatively easy to separate writing 'proper' code, i.e. Wedge, or any of my professional engagements, from writing Meteor Storm, simply because it didn't feel like work.
Title: Re: I couldn't sleep
Post by: PantsManUK on December 13th, 2011, 10:59 AM
Quote from Arantor on December 12th, 2011, 03:05 PM
I'm probably a shade younger than you by the sounds of things but it's what I learned to program on too; it wouldn't be until 1990 that we were able to afford something more powerful than a Spectrum... then I discovered the joys of Amigas.
Now that's freaky... Same here! A500 then I got an A1200 when they came out (and I loved them both dearly).
Title: Re: I couldn't sleep
Post by: Nao on December 13th, 2011, 11:44 AM
I went through Thomson TO7/70 (2 years) -> Atari 520 STF (3 years) -> Amiga 500 (a few months) -> Macintosh 68k (a few weeks) -> PC (a few decades), myself...

My favorite is still the Atari so I'm gonna kill y'all in good spirit :P