Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: Adriweb on June 24, 2012, 11:33:07 am

Title: [Contest] LuaTowerDefense
Post by: Adriweb on June 24, 2012, 11:33:07 am
Hi there,

I've decided that I should try (only try...) to participate with the game I'm writing right now, a Tower Defense one :)

People that know my GitHub may have noticed there some bits of it already, but if you look closely, it's only the Screen Manager library, not a single line for the game itself :)
(So it's good according to the rules :P)

The GamePlay should be "basic", like a simple TD you can find anywhere in Flash...
I hope I have some time to make it work well before the contest ends... but it should be good enough at least if I dont make everything I would have wanted, for some entry-level game.

Here are some alpha-version screenshots...

(http://i.imgur.com/cjDOls.jpg) (http://i.imgur.com/ouSVMs.jpg) (http://i.imgur.com/Dnvp8s.jpg) (http://imgur.com/a/7VYub#0)

As you can see, I have also focused on "quality" dialogs (I mean, like native), thanks to ETK (EEPro ToolKit (https://github.com/adriweb/EEPro-for-Nspire/blob/master/Global%20Libraries/widgets.lua), a GUI lib by Jim Bauwens), maybe to try to popularize GUI libs among the un-standardized Nspire-Lua programs :P

But don't worry about the design of towers (circles) and enemies, that's just for debugging :P)

The game grid is "active", meaning, you can mouse over the cells to get info, as well as interact with the keyboard (arrows) to move the selected cell.
There are 4 types of towers and enemy types : water, earth, fire, and air. The towers will do more damage to the corresponding enemy, obviously.
I haven't programmed yet the attacking part (:P) but I plan to make it so that you get points for each kill, which makes you also earn money to buy/upgrade towers.
I haven't really decided yet but the wave system will probably be something like ...  "more difficult each time because of the health increase of the enemies". Maybe more enemies too, each wave, idk :P
The AI part is probably the one handling enemies' moves : they auto adapt to the map, not with a hardcoded path :) While it's not much of an advanced AI (idk exactly :P), I still find that part pretty cool :D

I make it with the 3.2 SDK but I think it should work with 3.x if I just "compile" it with Luna :)

More soon !

Also, if you have any ideas for a feature etc... :)

Byebye :)


EDIT : Update (30/06/12) :
Some update(s) :

- Path algorithm/AI fort he enemies optimized and complete ! (works with any map, and with some "flawed" ones  (thanks to AI ))
- Wave system completely done and quite optimized I think
- Attacking done but not animated (no shooting animations for example... will see later)
- Range of a tower displayed on mouseover
- I still need to do :
   -- money system
   -- better menu(s)
   -- score + stats management
   -- level selection (more maps)
   -- multilanguage


Anyway, I won't have much time (at all ?) until the end of the contest, sadly, because TI-India is giving me an enormous amount to do x)
I'll see what I can do.
But after the 15th anyway (it's a deadline), I can improve it, even if it's too late
Title: Re: [Contest] LuaTowerDefense
Post by: cyanophycean314 on June 24, 2012, 11:38:32 am
This will be an awesome game when you finish it! Good luck. Now there are two Nspire Lua entries.  :)
Title: Re: [Contest] LuaTowerDefense
Post by: Jim Bauwens on June 24, 2012, 11:42:18 am
Nice Adriweb ! Looks like it will be a fun game :D
(Also, cool that you are using ETK)

Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 01, 2012, 09:55:15 am
Some update(s) :

- Path algorithm/AI fort he enemies optimized and complete ! (works with any map, and with some "flawed" ones :D (thanks to AI :P))
- Wave system completely done and quite optimized I think :P
- Attacking done but not animated (no shooting animations for example... will see later)
- Range of a tower displayed on mouseover
- I still need to do :
   -- money system
   -- better menu(s)
   -- score + stats management
   -- level selection (more maps)
   -- multilanguage


Anyway, I won't have much time (at all ?) until the end of the contest, sadly, because TI-India is giving me an enormous amount to do x)
I'll see what I can do.
But after the 15th anyway (it's a deadline), I can improve it, even if it's too late :P
Title: Re: [Contest] LuaTowerDefense
Post by: cyanophycean314 on July 01, 2012, 03:53:46 pm
Nice job. At least you got the AI done.  :D
Title: Re: [Contest] LuaTowerDefense
Post by: annoyingcalc on July 01, 2012, 04:23:27 pm
:w00t: I can not wait to see the final result, Great job so far
Title: Re: [Contest] LuaTowerDefense
Post by: DJ Omnimaga on July 01, 2012, 11:15:54 pm
Looks pretty nice so far. Will you update the graphics to use actual sprites in the future or is it out of the question (or Lua capabilities for that kind of game)?

Also is this the only Omni Nspire contest project? If so, then you win by default. O.O

EDIT Nvm there appears to be others, although one is in Ndless or BASIC.
Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 02, 2012, 03:46:03 am
Looks pretty nice so far. Will you update the graphics to use actual sprites in the future or is it out of the question (or Lua capabilities for that kind of game)?
Thanks.
Also yes, I plan to add real sprites. If its not too heavy/slow (it might be good) with images I'll do with images, but if it is, I'll do pixel art :P

Also is this the only Omni Nspire contest project? If so, then you win by default. O.O
EDIT Nvm there appears to be others, although one is in Ndless or BASIC.
Nick has done a Lua game too :)
Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 06, 2012, 02:08:00 am
Little Update before last day ! (:o)

So, the game is almost finished for its core, but I haven't found the time to make a more beautiful GUI than right now... I wonder if I'll just go with an image or something, for the menu :P

Anyway, the game should be crash-safe, and now has a save ability (but since you're supposed to finish/lose the game in one time (no multiple gaming sessions for a single map, I mean, as I've seen on flash TD), your game will resume (if wanted) with the same money you had and at the same level, but you'll have to re-place your towers muhahaha).

Anyway, I may have time to add another map (but then I'd have to code a lvl selection thing...) and to spice if the difficulty / decrease money earnings as it's a bit easy right now.

I also made the tower upgrades (improves its range) and improved the gamescreen's statusbar.

Screenshots in a few hours.
Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 07, 2012, 04:48:57 pm
Latest (and last before contest) update :

I fixed a few bugs, finished some stuff etc. made it 3.x compatible (:D), wrote the french&english docs etc.
And also made the whole thing a bit prettier overall... I didn't have time to put a new map / lvl selector ... :(
Will be done after the contest though.

Also, it runs on PCSpire :P

Some GUI screenshots :

(http://i.imgur.com/baFX3.jpg) (http://i.imgur.com/NvAmm.jpg)
(http://i.imgur.com/sebRx.jpg) (http://i.imgur.com/gMdmW.jpg)
Title: Re: [Contest] LuaTowerDefense
Post by: annoyingcalc on July 07, 2012, 04:57:21 pm
Cool!, this is looking awesome!


and btw the one on githhub it only says Hallo! and nothing else
Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 07, 2012, 04:58:06 pm
Cool!, and btw the one on githhub it only says Hallo! and nothing else
yes, because we can't publish the source code :P

I'll put the latest version on GitHub as soon as we are allowed to :)
Title: Re: [Contest] LuaTowerDefense
Post by: annoyingcalc on July 07, 2012, 04:58:44 pm
Ah, thats right this is for the contest
Title: Re: [Contest] LuaTowerDefense
Post by: lkj on July 08, 2012, 05:41:41 pm
It's a bit easy because you get much money and the difficulty doesn't increase very much. Also I think there's a bug, because sometimes there doesn't come a new wave if you click, just nothing happens, even if you save, quit and load again.
It's a bit strange that in the pop-up to buy a tower you can only navigate with the up/down arrow keys and in the tower upgrade pop-up only with left/right arrow keys.

You could probably make the towers a bit weaker and more levels of upgrade.

Apart from that it's quite addictive ;)
Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 09, 2012, 05:04:44 am
It's a bit easy because you get much money and the difficulty doesn't increase very much.
Yes, I didnt have time to think about a nice difficulty-increase formula, but I will change that soon.

Also I think there's a bug, because sometimes there doesn't come a new wave if you click, just nothing happens, even if you save, quit and load again.
This happened to me a while ago but I thought I fixed it... I never got it since :o
Any condition on making it do that again ?

It's a bit strange that in the pop-up to buy a tower you can only navigate with the up/down arrow keys and in the tower upgrade pop-up only with left/right arrow keys.
Weird, will fix that, thanks.

You could probably make the towers a bit weaker and more levels of upgrade.
Yes. For now, the update improves the range. I will think about something else to improve.

Apart from that it's quite addictive ;)
Thanks :) It will be even more with the more maps I'll include soon and the map editor too ;)


BTW : I could only test recently on 3.2, so maybe I couldn't have some bugs only in 3.1....
Title: Re: [Contest] LuaTowerDefense
Post by: lkj on July 09, 2012, 09:03:27 am
I haven't really found out under which conditions the bug occurs, it just happens in about 10% to 20% of the times I play.
And if it happens I have to close the document, just quitting the game and starting a new one doesn't solve the problem.

I only tested it on a non-cx with 3.1.

Edit: I tested it on nspire_emu with 3.2 and had the same bug.
Title: Re: [Contest] LuaTowerDefense
Post by: AzNg0d1030 on July 09, 2012, 06:16:29 pm
Every single time I've ran the game, it's gotten an error midgame.
Haven't managed to die without an error. Farthest was wave 5 since wave 6 had an error.
Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 19, 2012, 01:56:16 pm
v1.1 : Small but important update (stability + features) …
- Probably killed an annoying "ghost" tower bug causing crashes
- Upgrading a tower checks for money (duh…)
- Fixed the GameOver popup
- Adjusted a bit the overall difficulty

https://github.com/adriweb/LuaTowerDefense/raw/master/LuaTowerDefense.tns (https://github.com/adriweb/LuaTowerDefense/raw/master/LuaTowerDefense.tns)

Soon adding *new* features :)

btw, I still can't make it crash :P
Title: Re: [Contest] LuaTowerDefense
Post by: DJ Omnimaga on July 19, 2012, 02:01:38 pm
By the way are you planning to replace graphics with sprites in future versions like Chockosta's Bobby Carrot clone? That might actually get the game to become more popular.
Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 19, 2012, 03:06:52 pm
By the way are you planning to replace graphics with sprites in future versions like Chockosta's Bobby Carrot clone? That might actually get the game to become more popular.
Yes :D
Title: Re: [Contest] LuaTowerDefense
Post by: Deep Toaster on July 20, 2012, 01:06:48 am
Tower Defense with AI... Sounds (and looks) like a really fun game. Would it run in TI's online simulator? I want to try it out later, but I don't actually have the calculator and my Nspire Student Software license expired :/
Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 20, 2012, 05:34:55 am
Tower Defense with AI... Sounds (and looks) like a really fun game. Would it run in TI's online simulator? I want to try it out later, but I don't actually have the calculator and my Nspire Student Software license expired :/
The .tns file I think, should be perfectly openable in the online doc player, and I made the lua script controllable fully with mouse when you can't do anything (doc player, for example)....
It should be good :D
Title: Re: [Contest] LuaTowerDefense
Post by: lkj on July 20, 2012, 05:08:59 pm
Now that it's more difficult it's much more fun to play :)

This version didn't crash (yet :P)

But why do the enemies die even if they're outside the ranges of towers?
Title: Re: [Contest] LuaTowerDefense
Post by: AzNg0d1030 on July 20, 2012, 05:48:38 pm
Where can we get the updated version? I can't seem to find it :(


EDIT: Thanks lkj I found it
Title: Re: [Contest] LuaTowerDefense
Post by: lkj on July 20, 2012, 05:58:02 pm
Just open the link in this post (http://ourl.ca/16459/310902) :)
Title: Re: [Contest] LuaTowerDefense
Post by: Adriweb on July 21, 2012, 02:53:31 am
But why do the enemies die even if they're outside the ranges of towers?
Uhhh ? Do you have any specific conditions for making that happen ?