Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: hoffa on November 04, 2011, 01:37:03 pm

Title: [Lua] Tactical Wars CX
Post by: hoffa on November 04, 2011, 01:37:03 pm
I've been working for some time on a game I named "Tactical Wars CX" (CX as in TI-Nspire CX, as it is targeted for colored displays), a two-player turn-based strategy game. Frankly, it is still missing quite a few things and there are stuff that needs to be changed. There is no AI for the moment, and although I cannot promise you anything, I'll see if I can add some sort of AI in a later version (and considering the fact it's a field I find interesting, there might very well be one in the future), as soon as I have dealt with more important issues. You may find it is lacking in features and everything might not be well-balanced, and I fully agree, and as I said earlier, I'm going to work on them later.

The first thing each player does is choose his or her military units, and then places those units on the map. Right after the units have been placed, the HQ (that spiky tower you can see on one of the screenshots) needs to be built somewhere. If during the game the HQ is destroyed, the player who destroyed it automatically wins. If all of the soldiers of an army are killed, the remaining army (i.e., player) wins. Each army has a certain morale, and that morale evolves during the game based on different actions and variables. The said morale can affect the amount of damage each unit inflict. Every unit--along with an attack, defense, and range value--also has a certain fatigue- or fuel-level, which both replenish if the unit is let to rest (tanks and helicopters get more fuel thanks to the magical Fuel Fairy™), which affects the range of that unit. Special units ("Spetsnaz Team" or "SAS Team") are not visible by the enemy as long as they do not shoot or are not shot. Just to make it clear, that "0 +0" thing you can see in the primitive HUD on the right, shows how much damage you've done during the game and the amount of damage you did on your last hit.

You can download the current version here, but be aware that it's an early version that requires some further developing:

Tactical Wars CX 0.2 (http://hoffa.franceserv.fr/twcx/tactical_wars_cx_0.2.zip) (older versions & source code (http://hoffa.franceserv.fr/twcx))

Changelog:

And finally, a few screenshots: (if you're as anal as me about stuff not being aligned perfectly, well every drawn string is actually one pixel too low on the emulator)

(http://webgel.net/bf/32/1.png) (http://webgel.net/bf/35/1.png)
(http://webgel.net/bf/31/2.png) (http://webgel.net/bf/21/3.png)
(http://webgel.net/bf/10/4.png) (http://webgel.net/bf/8/5.png)

If you want to know how to return to the menu after a game, read this: http://ourl.ca/13814/260412 (http://ourl.ca/13814/260412)
Title: Re: [Lua] Tactical Wars CX
Post by: Stefan Bauwens on November 04, 2011, 01:42:37 pm
Wow, these screenshots are amazing. I don't know this game but it looks awesome.
Title: Re: [Lua] Tactical Wars CX
Post by: Adriweb on November 04, 2011, 02:02:04 pm
They indeed look awesome, but I am scared in advance at the .tns size, since these are all TI.Images .... :o

Good Luck :D
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 04, 2011, 02:05:49 pm
They indeed look awesome, but I am scared in advance at the .tns size, since these are all TI.Images .... :o

Good Luck :D
Yes it will be bigger than usual, but I don't feel like settling for a dull white background, especially when I'm targeting it for machine that has a color screen.
Title: Re: [Lua] Tactical Wars CX
Post by: Adriweb on November 04, 2011, 02:14:04 pm
Oh, I perfectly understand you you're probably right :D
Title: Re: [Lua] Tactical Wars CX
Post by: Hayleia on November 04, 2011, 02:44:02 pm
:O
Those screenies look awesome :thumbsup:
This is going right into my CX CAS when it's done :P
Title: Re: [Lua] Tactical Wars CX
Post by: Yeong on November 04, 2011, 03:02:10 pm
holy crap it's epic! O.O
Now all we need is StarCraft
Title: Re: [Lua] Tactical Wars CX
Post by: aeTIos on November 04, 2011, 03:05:31 pm
Wow the graphics. O.O O.O
Title: Re: [Lua] Tactical Wars CX
Post by: Eiyeron on November 04, 2011, 03:08:20 pm
Why didn't you used the AW2 sprites? I give you using the animated tileset like a challenge!
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 04, 2011, 03:20:20 pm
Why didn't you used the AW2 sprites? I give you using the animated tileset like a challenge!
Because they are too big and I wanted the user to be able to see the whole map at once.
Title: Re: [Lua] Tactical Wars CX
Post by: Chockosta on November 05, 2011, 08:22:01 am
This looks nice, but the memory consumption... ><
And it is quite slow to open isn't it ?
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 05, 2011, 09:22:35 am
This looks nice, but the memory consumption... ><
And it is quite slow to open isn't it ?
Haven't looked at the memory consumption nor have I had any issues with it yet (EDIT: of course if it becomes or is a bigger issue, I'll look into and deal with it). To open it, it takes about two seconds, but it's understandable considering the number of images there are. Oh, and those few seconds won't kill anyone; it's no issue as far as I can see.
Title: Re: [Lua] Tactical Wars CX
Post by: aeTIos on November 05, 2011, 10:19:55 am
do you have to load the images yourself or does the prog do that (if yourself, you can display something before loading it)
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 05, 2011, 10:27:47 am
do you have to load the images yourself or does the prog do that (if yourself, you can display something before loading it)
What do you mean by "load the images yourself"? What images? I'm only talking about the visual stuff the game is made of.
Title: Re: [Lua] Tactical Wars CX
Post by: Levak on November 05, 2011, 10:33:13 am
I think he doesn't know about TI-Image.
Title: Re: [Lua] Tactical Wars CX
Post by: Chockosta on November 05, 2011, 10:35:37 am
I suppose you put ti.images at the top/bottom of your code.
But you could do something like that :
Code: [Select]
imagesLoaded=false

function on.paint(gc)
 if not imagesLoaded then
  gc:drawString("Loading",0,0,"top")
  loadImages()
 else
  --Game displaying
 end
end

function loadImages()
 img1=image.new("...")
 imagesLoaded=true
end

I don't know if this trick would work...
Title: Re: [Lua] Tactical Wars CX
Post by: Levak on November 05, 2011, 12:08:11 pm
+platform.window:invalidate()
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 05, 2011, 12:22:40 pm
I suppose you put ti.images at the top/bottom of your code.
But you could do something like that :
Code: [Select]
imagesLoaded=false

function on.paint(gc)
 if not imagesLoaded then
  gc:drawString("Loading",0,0,"top")
  loadImages()
 else
  --Game displaying
 end
end

function loadImages()
 img1=image.new("...")
 imagesLoaded=true
end

I don't know if this trick would work...
Well all the images are loaded when the game is started (or more precisely, as soon as an instance of the game class is created), and TI's own little loading thingy is good enough.

BTW, I added two screenshots, both are from the info windows of two units.
Title: Re: [Lua] Tactical Wars CX
Post by: AzNg0d1030 on November 05, 2011, 06:37:25 pm
Wow I can't wait for this!  Best graphics for a TI game yet!  (I NOMINATE YOUUUU!)

Who cares if the .tns file is too big?  It may take longer to save and open, but the CX has so much memory it doesn't even matter  ;D
Title: Re: [Lua] Tactical Wars CX
Post by: AzNg0d1030 on November 05, 2011, 06:38:24 pm
About how big is it currently with the percent you have finished?

And

About how big do you think it might end up to be?


Oohh, and might I suggest that tanks have a range of 4 or 5 instead of a measly 3... even soldiers have a 2! :P
Title: Re: [Lua] Tactical Wars CX
Post by: DJ Omnimaga on November 06, 2011, 02:14:41 am
Wow that looks great. I hope it's not too complicated to code (seeing it's a strategy game). Does the CX calculates fast in Lua?

I really hope this gets finished.

They indeed look awesome, but I am scared in advance at the .tns size, since these are all TI.Images .... :o

Good Luck :D
Yes it will be bigger than usual, but I don't feel like settling for a dull white background, especially when I'm targeting it for machine that has a color screen.
Yeah I agree. Almost every Nspire CX game so far simply uses white/black background with squares or very simple sprites (no offense intended to the authors. The Lua language for the Nspire series was still very new at the time and many games were limited by contest deadlines), so it's great to finally see some more complex stuff. That might show what Lua is capable of even more.

Also glad to see you're still around Hoffa :)
Title: Re: [Lua] Tactical Wars CX
Post by: annoyingcalc on November 06, 2011, 02:16:18 am
wow but how is your fps for the cx?
Title: Re: [Lua] Tactical Wars CX
Post by: Alex on November 06, 2011, 08:06:17 am
have you a .tns file?
Title: Re: [Lua] Tactical Wars CX
Post by: annoyingcalc on November 06, 2011, 10:39:52 am
yes he does but you should pm him if you want a demo
Title: Re: [Lua] Tactical Wars CX
Post by: mdr1 on November 07, 2011, 10:44:06 am
Wow, it looks awesome !
I hope this game to be coded fastly, since it looks great !
Title: Re: [Lua] Tactical Wars CX
Post by: annoyingcalc on November 07, 2011, 10:53:36 am
yeah it is looking great
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 07, 2011, 02:23:25 pm
I've changed the layout and sprites slightly:
(http://bb.xieke.com/files/34/1.png)

Wow, it looks awesome !
I hope this game to be coded fastly, since it looks great !
Yeah, I will have to code like there was no tomorrow if I want to have a playable version tonight. I need to have finished something by midnight and I still have loads to do.
Title: Re: [Lua] Tactical Wars CX
Post by: Adriweb on November 07, 2011, 02:32:10 pm
You still have ≈ 3.4 hours, so make sure you do the most important things :)

Also, don't worry about speding too much time for the translation, use google translate for the often used words ;)
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 07, 2011, 02:43:17 pm
You still have ≈ 3.4 hours, so make sure you do the most important things :)

Also, don't worry about speding too much time for the translation, use google translate for the often used words ;)
Yeah, I'm pretty sure I'll have the time. What translation are you talking about? Have I missed something?
EDIT: Shit, just reread the rules. I'll  translate what I can, then.
Title: Re: [Lua] Tactical Wars CX
Post by: Jim Bauwens on November 07, 2011, 02:46:21 pm
Quote
The only requirement is that your program is suitable for a French user. If your program displays text, use single common words in a foreign language is tolerated.

Thats what you need to do :)
Title: Re: [Lua] Tactical Wars CX
Post by: hellninjas on November 07, 2011, 02:47:50 pm
Wow! Good luck with this!
It looks awsome, i love those kind'ove text based and tile layered games!
Next page!!!
Title: Re: [Lua] Tactical Wars CX
Post by: critor on November 09, 2011, 08:13:56 am
Tactical Wars CX is online on TI-Planet:
http://tiplanet.org/index.php?mod=archives&ac=voir&id=3767

Have fun ;)
Title: Re: [Lua] Tactical Wars CX
Post by: Yeong on November 09, 2011, 08:35:32 am
It would've been better if it had AI D:/me was the first to download XD
Title: Re: [Lua] Tactical Wars CX
Post by: Alex on November 09, 2011, 11:29:01 am
comment puis-je retourner au menu après un partie quand ça dit: "blue is victorious"
Title: Re: [Lua] Tactical Wars CX
Post by: Yeong on November 09, 2011, 11:29:31 am
Bug report: if red wins, the game crashes O.o
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 09, 2011, 12:09:11 pm
Alrighty I've updated the first post, check it out. (note that I removed the background image, as it was painfully slow to navigate in the menus)

comment puis-je retourner au menu après un partie quand ça dit: "blue is victorious"
For non-French speakers: "how do I return to the menu after a player wins the game?"
Well, I have to admit I was in a hurry when I submitted the game for the TI-Planet contest, and had at 23:45 (it was due for midnight) still not written any code for when a player won a game. I decided to deal with it a very quick and dirty way ("player won? Accept no further input, stop everything, just show the goddamn win screen and make sure it takes up the whole display!") and consequently you cannot do anything once a player won. It's like when you finished Super Mario Bros., you get that fancy "The End" screen and all you can do is press the reset button. Press Ctrl+w to close the document, and you should be able to open it again. I will fix it in a future version, don't worry.

Bug report: if red wins, the game crashes O.o
Thanks for reporting that, I'll look into it.
EDIT: Oh wait, it's probably what Alex just asked (it may seem like it crashed, but it's the dirty way I implemented it, for now). Read my answer above.
Title: Re: [Lua] Tactical Wars CX
Post by: Yeong on November 09, 2011, 12:40:28 pm
no. It was definitely a crash.
It said there was an error in code #1028 or something (or number little bit over 1000)
Title: Re: [Lua] Tactical Wars CX
Post by: Scipi on November 09, 2011, 02:41:30 pm
Amazing game Hoffa! I know that the code to show where the units are able to move to must have been a nightmare. (I once tried to remake a fire emblem game and I tried to understand that part. It's what killed the project before I even started) :P
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 09, 2011, 02:46:18 pm
Amazing game Hoffa! I know that the code to show where the units are able to move to must have been a nightmare. (I once tried to remake a fire emblem game and I tried to understand that part. It's what killed the project before I even started) :P
Don't tell anybody, but it actually uses a very dumb way of detecting where a unit can move or not. Actually a unit can magically jump over water and shoot through a mountain, but it rarely happens in the game as the range of the units is fairly small. I'm working on it though, there will be a real algorithm for finding the positions a unit can move to soon.
Title: Re: [Lua] Tactical Wars CX
Post by: epic7 on November 09, 2011, 03:09:28 pm
I want an nspire now
Title: Re: [Lua] Tactical Wars CX
Post by: DJ Omnimaga on November 09, 2011, 03:10:26 pm
Tactical Wars CX is online on TI-Planet:
http://tiplanet.org/index.php?mod=archives&ac=voir&id=3767

Have fun ;)
w00t time to try it now :D

Also thanks to whoever split the off-topicness from this topic.
Title: Re: [Lua] Tactical Wars CX
Post by: Deep Toaster on November 09, 2011, 03:59:42 pm
That is amazing. I need to try this as soon as I can (and I don't even care about the filesize, since I use an emu :D).
Title: Re: [Lua] Tactical Wars CX
Post by: AzNg0d1030 on November 09, 2011, 04:37:26 pm
Amazing game and graphics!  Hope you fix the bugs soon.  Is it possible to implement an AI  or is that kind of much?  D:
Title: Re: [Lua] Tactical Wars CX
Post by: Adriweb on November 09, 2011, 04:41:24 pm
I guess that AI for this kind of games are pretty hard to make :P
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 09, 2011, 04:47:06 pm
Amazing game and graphics!  Hope you fix the bugs soon.  Is it possible to implement an AI  or is that kind of much?  D:
Yeah as adriweb said, making an AI for such a game is pretty hard. As mentioned in the first post, I certainly will look if I could implement at least some kind of single player that eventually uses some sort of AI. I haven't really looked into that yet; it'll come later.
Title: Re: [Lua] Tactical Wars CX
Post by: AzNg0d1030 on November 09, 2011, 05:05:29 pm
Amazing game and graphics!  Hope you fix the bugs soon.  Is it possible to implement an AI  or is that kind of much?  D:
Yeah as adriweb said, making an AI for such a game is pretty hard. As mentioned in the first post, I certainly will look if I could implement at least some kind of single player that eventually uses some sort of AI. I haven't really looked into that yet; it'll come later.
Ok that's okay. It will make for a great two player game though :P
Title: Re: [Lua] Tactical Wars CX
Post by: Adriweb on November 09, 2011, 05:06:39 pm
Once we figure out a way to have a two-calc multiplayer system, it will be even more awesome :P
Title: Re: [Lua] Tactical Wars CX
Post by: Nick on November 09, 2011, 05:09:10 pm
well, i was looking for that link system, isn't it possible in any way in lua?
Title: Re: [Lua] Tactical Wars CX
Post by: Adriweb on November 09, 2011, 05:12:44 pm
Nope, but I'm going to request that :)
Title: Re: [Lua] Tactical Wars CX
Post by: njaddison on November 10, 2011, 04:42:02 pm
You guys, this game is pretty awesome. The only problem is that blue's turn lasts for about an hour. I may just not be doing something right.
Title: Re: [Lua] Tactical Wars CX
Post by: Adriweb on November 10, 2011, 04:43:24 pm
hmm yeah, since *you* are supposed to play ? :D
Title: Re: [Lua] Tactical Wars CX
Post by: njaddison on November 10, 2011, 04:44:37 pm
Please help! and, I have no clue what i can attack!
Title: Re: [Lua] Tactical Wars CX
Post by: DJ Omnimaga on November 10, 2011, 04:51:27 pm
Yeah it's a 2 player game right now and you just lend the calc to a friend so he plays as blue.

As for linking, I hope TI doesn't do it like on the 83+. In BASIC, linking is rather unreliable because the other calc can't receive variables if the sending calc is busy.
Title: Re: [Lua] Tactical Wars CX
Post by: BrownyTCat on November 11, 2011, 01:32:44 pm
This looks like one of the most polished games I've seen on nSpire so far.
Title: Re: [Lua] Tactical Wars CX
Post by: hoffa on November 11, 2011, 03:00:13 pm
Voilà, there's 0.2 with a few fixes and stuff. I fixed many small things and added some basic things that were missing, so the changelog is really a lot of text for not that much. The better updates will come in the following versions (A* pathfinding for unit moves (and the range thing for shooting), saves, maybe some basic AI for single player, etc.).
Title: Re: [Lua] Tactical Wars CX
Post by: Jim Bauwens on November 12, 2011, 06:23:31 am
Nice, should try it out one day :)
Btw, do you have a CX?
Title: Re: [Lua] Tactical Wars CX
Post by: Adriweb on November 12, 2011, 09:20:22 am
Too bad the AI wasn't there for the contest (too bad ... :(  )

It's going to be really awesome when it has it !!
Title: Re: [Lua] Tactical Wars CX
Post by: DJ Omnimaga on December 25, 2011, 10:01:46 pm
AI would definitively be great for those who don't have any friend that play calc games :P