Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: ElementCoder on January 02, 2013, 11:05:53 am

Title: Eat Nethams Lua Edition
Post by: ElementCoder on January 02, 2013, 11:05:53 am
My first game in Lua has been released :D
You control a lobster hungry monster omnom (for which I really need a better sprite :P) who must stop the lobster army from invading his calculator :) It has an animated title screen and lots of lobsters.

Screenshots and tns attached below :)

Controls:
Movement: left/right or 4/6
Eat lobster: automatically :P
Reset: ESC
Start: enter
Increase/decrease lobster spawning: +/-

Changelog
1.0 - Initial release
1.01 - Changed timer from 1/30 to 0.03
1.02 - Fixed issues with monster hitbox. Changed lobster spawning. Fixed a few bugs (starting with lobster filled screen, having <100 lives, having >0 lobsters eaten).

To do:
* Improve the hitboxes for eating
* Get a decent sprite for the lobster eating monster

The lobster sprite is made by yeong, I plucked them from a topic which I can't seem to find anymore, I hope it's ok? :)

New version is up which hopefully fixes the crash.Crash is fixed, new version changes the spawn rate to a more playable state :)

Source code: https://github.com/ElementCoder/Eat-Nethams-Lua-Edition
Download: https://www.dropbox.com/s/abtt0bl32beapxd/EatNethams.tns
Title: Re: Eat Nethams Lua Edition
Post by: lkj on January 02, 2013, 11:35:08 am
My Nspire student software almost instantly says "not enough memory" :(
Title: Re: Eat Nethams Lua Edition
Post by: ElementCoder on January 02, 2013, 12:46:03 pm
That's weird, it runs just fine on mine. Maybe Java is going crazy, have you tried a reboot?
Title: Re: Eat Nethams Lua Edition
Post by: Nick on January 02, 2013, 01:17:35 pm
I tried it too. It said:

"Insufficient Memory

This applicaton was stopped because of insufficient available memory."

It was taking 418MB of RAM, but never actually worked. I wasn't able to control anything (in the time it didn't show insufficient memory, I couldn't do anything either)

If I analzed the code correctly, you are adding a new lobster every 1/30 (0.033) seconds? that is quite much, since once image takes a whole lot of place in memory, that kinda makes sense.

And another thing. I don't really know if it's such a good idea to take 1/30 as timer interval. I'd rather take something like 0.03 instead, because i don't think it handles that kind of intervals good.
Title: Re: Eat Nethams Lua Edition
Post by: ElementCoder on January 02, 2013, 01:54:19 pm
I tried it too. It said:

"Insufficient Memory

This applicaton was stopped because of insufficient available memory."

It was taking 418MB of RAM, but never actually worked. I wasn't able to control anything (in the time it didn't show insufficient memory, I couldn't do anything either)
Well that is very strange, I just tested the TNS I distributed and it works fine for me on both TINCS and handheld (CX, 3.1)

If I analzed the code correctly, you are adding a new lobster every 1/30 (0.033) seconds? that is quite much, since once image takes a whole lot of place in memory, that kinda makes sense.

And another thing. I don't really know if it's such a good idea to take 1/30 as timer interval. I'd rather take something like 0.03 instead, because i don't think it handles that kind of intervals good.
Every time the timer ticks (so yes every 0.03 seconds I'll change it to decimal) it runs addLobster which has a certain chance of spawning a lobster. I'll upload a new version in a few minutes to see if it fixes it.

[edit] After testing the uploaded one, it indeed doesn't work for me too. Let me know if the new one works (first post will be updated).
[edit2] New version uploaded.
Title: Re: Eat Nethams Lua Edition
Post by: Nick on January 02, 2013, 02:40:52 pm
It works now, but it's sooooo hard to catch :) i never played an actual Eat Netham game, but it looks like it's good

The only thing i would change/add is escape as reset button too. A lot of people use [esc] as first try to get to the menu (so did I).
Title: Re: Eat Nethams Lua Edition
Post by: Sorunome on January 02, 2013, 04:35:54 pm
Eat nethams is getting so popular :P
Looking nice btw :D
Title: Re: Eat Nethams Lua Edition
Post by: DJ Omnimaga on January 02, 2013, 06:10:56 pm
Lol now there are 2 Lua Eat Nethams clone :P. I wonder if this one runs as fast as the original? :P
Title: Re: Eat Nethams Lua Edition
Post by: Levak on January 02, 2013, 06:26:43 pm
Actually, you can eat lobsters in NyanCat (http://levak.free.fr/ftp/nspire/NyanCat/) when you reach score 1000 :p
Title: Re: Eat Nethams Lua Edition
Post by: epic7 on January 02, 2013, 08:28:05 pm
Looks nice :)

Did you get the idea from me, or did we both get the idea at the same time? :P
Title: Re: Eat Nethams Lua Edition
Post by: ElementCoder on January 03, 2013, 05:25:31 am
Lol now there are 2 Lua Eat Nethams clone :P. I wonder if this one runs as fast as the original? :P
Probably not :) Lua is quite slow with images (especially when you start drawing a lot of them :P).

Looks nice :)

Did you get the idea from me, or did we both get the idea at the same time? :P
I thought it was time for me to create and release my first game, then I saw your topic of Eat Nethams II for ndless, so I thought I'd do one in Lua :P

Uploading a new version probably today, it'll add ESC as a menu button instead of 'r' and make the lobsters move a bit slower (or perhaps adjustable/increasing over time)