Mechanics in 250 Or Less With Corona - Doodle Jump

No need to apologize, I didn’t claim I knew your purpose (notice all the if’s).   what I said was essentially “IF it’s any of THESE purposes, then here’s why” because the other poster apparently could see NO PURPOSE for doing so.

Because there are LOTS of other POSSIBLE purposes you MIGHT have had (ones that I didn’t even bother to mention/critique because it seemed already obvious that they weren’t the purpose) that need not involve ssk at all, for example:

1.  to demonstrate how “pure out-of-the-box corona” could do it in few lines (obviously not the case)

2.  to demonstrate oop principles (fe having a separate class for world/camera/player/platform/spike/coin/etc)

3.  to demonstrate idiomatic lua syntax (it fails this, but presumably because of the focus on line count)

4.  to demonstrate luadoc style full commenting (using as MANY lines as needed - obviously not)

et al (iow, even those additions wouldn’t make it a complete list of possible purposes)

if you had left out the “in x many lines” bit i wouldn’t have even commented, because no-one would probably have ever asked “so how many lines w/o ssk?”.  fe if it had just been “here’s a quick impl of doodle jump core mechanic” and leave it at that, no gauntlet thrown down to challenge the kids.

as it is, the loc aspect will just spark some to go rewrite it as obfuscated code in order to “beat your record”, which does little to advance any practical discussion.


because your theory itself is sound.  (ie, that many popular games have easy-to-implement mechanics)

take the one-tappers fe (geometry dash, jetpack joyride, much of ketchapp’s portfolio, etc).  you can distill their “model” (ie, ignore the “view”, what they “look like”) down to a game of tap-along-to-the-rhythm.

ie, if i give you a “percussion score” of “hit-rest-rest-hit-hit-hit-rest” but render it instead as blocks to jump over - you’re essentially just playing the music, but it looks like you’re playing geometry dash.  if you really think about it, it’s amazing how many games can be boiled down to “playing a snare drum chart” - the core of which might only take a few loc to implement.

I’ve often found that “just for the fun of it” is more than enough reason to do something. :smiley: SSK or not, I think this is a cool project and isn’t SSK free or am I mistaken? Works as good marketing material for it in either case.

That’s awesome :slight_smile:

Fantastic @roaminggamer!

Rob

nice one thumbs up

Thank you again!

Hehe, that’s great. I’m always doing stuff like that too :slight_smile: Corona is insanely quick to prototype stuff.

Now try it in 250 lines of code without SSK!!

SSK is part of hard work and knowledge of @roaminggamer. I do not see why he would have to try to do it in 250 lines without SSK. I give it to RG, simply brutal, fantastic, excellent example … Thank you!

Interesting idea… hmmm

I might be able to do this, but I worry that nobody would then be able to read the code…

OK, I tried, but I was simply unable to implement all of the original mechanics (SSK version)  in 250 lines or less of pure-Corona.

I took out the SSK code and replaced it with the most compact code I could come up with in 50 minutes…

See the sub-folder ’ nossk/

The game is now 152 lines longer and doesn’t quite have the same functionality.  Some of the nice debug features were simply too much of a pain to reproduce.

Note: I will never do this again.  Long-hand coding sucks once you know how to use the power of SSK.  I’m way too lazy to do it the long way and I want my code to be easily maintainable and legible. 

Longhand code is soooo much work to write, maintain, and read.  Blech!

PS - Some lines I replaced w/o annotating, but for the most part I commented out the SSK code and then noted the NO SSK difference so you can see how much longer the code becomes.

@dodi_games: uhm, wow, way to overanalyze a small forum comment. Why would he need to do this? Why would he need to do it in 250 with SSK in the first place? He doesn’t need to do this.

But it’s a fun challenge! That’s why!

@thomas6

And it was also fun to capture your attention.
:slight_smile:

Okay, good, fun is important! Besides this, I do believe that the concept of coding a game or app in as little lines as possible becomes quite irrelevant if you don’t count the lines of code in submodules or -libraries.

My main.lua files typically only have 10 to 20 lines of code. I don’t really consider this to be much of a benchmark, since the rest of my code runs into the 10.000s of lines.

I hope that sheds some more light on my challenge to write this game without outside modules.

From the point of view of the topic, it is not really a game, it is the mechanics of the game, I would practically understand that it is the speed in which it is written using existing resources of the programmer, those external modules. But in this topic I think it’s more in the mechanics of the game where the magic is.

I think the main point here is that you can do a lot in Corona with far fewer lines of code than you might run into with other languages and APIs.

We used to market that it’s 1/10th of the code of doing things natively.

A polished, functional, marketable game, of course, will take more code, time and effort.

I think @roaminggamer is doing a great job of showing the power of Corona. How many other platforms can you test a game mechanic in such small amounts of code and see the results instantly? Try it, if it doesn’t work, try something else. It’s about iteration.

Rob

@roaminggamer I like the 250 challenge.  You essentially just held your own mini game jam of one  :)   Nice work!   Hows this for a game jam idea.  250 lines of code, as many libraries as you like, 72 hours?

Personally, what I love about Corona is that it is the closest programming experience I’ve found to making art (Flash coming in second).  The process, the discovery, the fast implementation that can be refined later - it’s great way to think openly and be creative while doing a very concrete activity - coding.  When I make art I’m constantly refining and adapting and changing my mind and that’s how I feel with Corona.  For example, I don’t have to get caught up with strict data-typing.  I can play it loose and let the model emerge instead of making concrete decisions during the phase of development that should be open and playful.

I for one have never ever been able to prototype a game as quickly as I can now, before using Corona. Most projects I do, the prototype is done in a day.

Well, my $0.02…

1)  If it’s main purpose is the lines-of-code metric, then it “cheats” that metric by relying on (and not counting) external code.  If you were to take that approach to the extreme, then why not just put the ENTIRE mechanic in a separate module, then call it with a single line of code from main (thereby allowing you claim just 1 LOC to implement), fe:

-- main.lua require("doodlejump"):run()

2)  If it’s main purpose is as a tutorial, then it suffers from over-complexity due to “can’t just run it”.  The linked zip won’t run as is (I just tried it) without apparently first obtaining and installing SSK… except for the “nossk” version.   That installation step isn’t covered or even mentioned within the code itself, so it’s hardly “beginner-friendly” as a tutorial.

3)  If it’s main purpose is as a “promotional tool”, then see 2) above - the SSK versions won’t work as-is, but the no-SSK version does.  Code that won’t run out-of-the-box doesn’t leave a great first impression.

4)  If it’s main purpose is as a “demonstration tool” (ie “see how SSK can shorten your development cycle”), then having a no-SSK version would be critical for that comparison.  (though the stated 152 line difference is “unfair” - if you remove all the “SSK/NOSSK” comment lines and otherwise dead SSK leftovers, the actual difference is around 80 lines)

Purpose Of Post

Sorry, but it was #5

#5 Satisfy my curiosity and creativity itch.

I saw a post the other day that made me think, “I bet I could make that game mechanic in less than 250 lines of code using SSK and Corona”.

I wondered if a game mechanic similar to doodle-jump could be done in a few lines of code.   (I wanted to test a theory I have; See below.)

Choice Of Limit (250 lines)

I chose 250-lines as a limit on of the off chance I’d do more of these.  That way I could be consistent in my goal/measure/limit.

My Theory On Game Mechanics and Corona + SSK

It is my theory/opinion that the core interaction  (the mechanic) of almost 90% of retro or hyper-casual games can be achieved in 250 lines or less.  This assumes using Corona and (for me) SSK. 

While SSK is not a requirement, I am way too lazy to implement anything even marginally complicated without it.  I hate re-coding solution to problems I have already solved.

 … without SSK I’d probably have to quadruple that limit to cover most mechanics.

Why Use SSK?

As far as the motivation for using SSK, I only use it for myself anymore.  It makes coding way easier and more legible than the long-hand equivalents.   I am, and always have been lazy.  I hate typing more code and reading more code than I need to.

What About The Noobs?

As for new folks… I didn’t give them much thought.  I think they should be able to browse through it and understand the main thrust of the mechanics.  I don’t intend this as a template, tutorial, or any kind of teaching device. 

Last Words

Again, at the end of the day this was about satisfying my curiosity.  Once I’d done it, I figured why not share.  Someone might get something out of it.  If so, great.  If not, oh well.

I think Corona is great and I absolutely agree with Rob’s statement:

You can do a lot in Corona with far fewer lines of code than you might run into with other languages and APIs.