This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Exerro's profile picture

NightFall - Tower Defence Game

Started by Exerro, 18 January 2015 - 06:04 PM
Exerro #1
Posted 18 January 2015 - 07:04 PM
Hello,

Having taken a little break from Nova (and CC altogether), I decided to come back and create a game. After some brainstorming with a friend, we decided I should make a tower defence game.

The game is in a really basic state at the moment, so don't be too harsh. I'm mainly posting this so I can get some feedback so I don't have to do any drastic changes further in the game's development.

Screenshots:
Spoiler





The 3 waves I've programmed in aren't too creative, just demos really to show a couple of different units. I'll probably be spacing them out a bit more too. I've also just realised that your health can go below 0 without anything happening… oops.

If you want to create your own maps, use the map creator. Just make sure there is a full path from the start block to the end one, and you also need to place a path block at the start block.

You can download this from pastebin:
pastebin run v4ZQBHyh
You can then run the game by typing ".nightfall/launcher" into the shell.

Any feedback is greatly appreciated. I also need a lot of artwork done (as you can probably see) so if you'd like to help out with that, just say.

Have fun!
InDieTasten #2
Posted 18 January 2015 - 07:44 PM
Bug:
[NightFall] gameUI:40 Attempt to index ? (a nil value)

Reproduction:
Launch game
Create or load game
Click on basic turret
Click on the "place"
Game crashes


Great game though. Would love to see people generating more content to it.

EDIT: fixed :)/>
Edited on 18 January 2015 - 06:54 PM
Exerro #3
Posted 18 January 2015 - 07:48 PM
Oh, sorry, thought I fixed that. Can you try downloading it again? If it still doesn't work, it should print a traceback (saying "in …" etc) and it would be useful to know what caused it.
InDieTasten #4
Posted 18 January 2015 - 08:00 PM
Yeah, it works great now :)/>
It's a little… slow. The step-rate is inconsistent on my computer, even though I have fix 60 FPS.

I like the graphics and different projectiles you implemented.

I'll see if I can mess with the pathfinding in the map editor :3
Exerro #5
Posted 18 January 2015 - 08:04 PM
Yeah I'll be working on new waves and performance updates for the next version. For the rendering, it goes through a long process of drawing to an image which draws to another image which draws to a buffer which draws to the screen. I'll be trying to take the map and units etc away from the UI library to speed things up.

Also, the pathfinder should be perfect. It calculates all possible routes to the destination then selects the shortest one (slow I know but it doesn't need to be fast as it's only computed once).
InDieTasten #6
Posted 18 January 2015 - 08:14 PM
I'll see if I can mess with the pathfinding in the map editor :3
Well, having no path available as AI, the enemies won't show up. You could implement a check that executes at every change in the map and displays its validity in the menu on the right, so at least one know, that the map I'm editing is at it's current state not valid.

Also as a feature request:
Why not different terrain types, so that enemies can walk through everything, as long as it doesn't cost more "movementpoints" as the "regular path" which has a much lower movement cost.
Then you wouldn't have to deal with invalid maps, as the enemies could walk through the grass too, only much slower ;)/>

Also, the pathfinding behaves strange to me, when there are multiple paths. all enemies follow the same path, but not the shortest. they take weird routes until they finally arrive at my base
Edited on 18 January 2015 - 07:15 PM
InDieTasten #7
Posted 18 January 2015 - 08:19 PM
Pathfinding at it's best:
Exerro #8
Posted 18 January 2015 - 08:21 PM
Hmm, weird, I'll have to take a look at the algorithm. If I were to implement the open terrain idea, I'd need a better pathfinding library. Any ideas what I could use?
InDieTasten #9
Posted 18 January 2015 - 08:24 PM
Hmm, weird, I'll have to take a look at the algorithm. If I were to implement the open terrain idea, I'd need a better pathfinding library. Any ideas what I could use?
A* fast and allows for different costs between tiles.
I don't know, whether there are "libraries" for that, but the implementation is quite simple.
I've seen people referencing good material for learning how the algorithm works.
Exerro #10
Posted 18 January 2015 - 08:26 PM
Ok, any comments on the graphics? Anything I can improve?
InDieTasten #11
Posted 18 January 2015 - 08:32 PM
Ok, any comments on the graphics? Anything I can improve?
No man, I don't think you can do much better without making the game unplayable performance-wise.
The game feels nice with the amount of animation/sliding. I think you hit it perfectly. It's like playing a real game, as supposed to playing a "hakeliges" game within a mod of a game.
Exerro #12
Posted 18 January 2015 - 08:35 PM
Awesome, thanks! I need to change the costs of the turrets at some point, it's way too easy to get set up early on.

Current todo list:
  • Performance improvements.
  • New waves (probably about 10, with increasing and logical difficulty increases).
  • Better costs and rewards for killing units.
I'll get to the pathfinding/new map structure later.
Edited on 18 January 2015 - 07:35 PM
ByteMe #13
Posted 18 January 2015 - 11:33 PM
It's awesome, I love that time went into the look such as menus and homescreen.
oeed #14
Posted 18 January 2015 - 11:45 PM
Wow, this looks really awesome. I'll try it out soon!
TheOddByte #15
Posted 19 January 2015 - 06:36 PM
This is really awesome, tried it and it was better than I expected. Love the GUI and the animations, sprites and just everything!
You did a really good job on this! :D/>
cdel #16
Posted 21 January 2015 - 12:19 PM
looks awesome, the menu image just looks spot on :)/>
Geforce Fan #17
Posted 05 April 2015 - 08:02 AM
This deserves more attention. It's pretty cool.
The animations are VERY smooth, and they game plays quite well. I am bypassing the window API, but even then it's hard to get animations that smooth.
10/10, good work.

I did get an error, but I'm fairly sure it was my own OS's fault. It errored out and said access denied, meaning it tried to access a file it did not have permission to – it will only error when doing this through write mode. Running it will admin permissions fixed this, but what files do you write to?
And nice error tracing system.
The game's actually pretty small, too.164KB(the APIs are 112KB) on a fresh install. For what it does, that's pretty small.
Edited on 05 April 2015 - 06:12 AM
Exerro #18
Posted 05 April 2015 - 09:49 PM
Thanks, people keep commenting on my animations (which don't bypass the window API), and I really can't take credit for it - tween.lua by kikito. Anyway, the files it writes are in the /saves folder, which it does every time you use money, complete a wave, or get money. The error tracing system, again, isn't me, and is mainly due to lbphacker's traceback() function which returns a table like { "blah:10", "blah2:20" } etc. The APIs should be minified, hence the size, although I may have wrote this long enough ago that I wasn't using a minifier.

Anyway, I'm going to rewrite this as soon as I finish my new UI library. I wrote a little preprocessor and I'm dying to test it out on something like a game, I think it will really help. With the new version, I'll be able to use the glorious mouse_up events (thanks Dan!) which will drastically improve the gameplay, although I think I'll keep the layout/graphics pretty much the same, just a bit faster hopefully.
Creator #19
Posted 14 April 2015 - 07:20 PM
Really good, alittle bit laggy, but else excellent. get a +1
CrazedProgrammer #20
Posted 18 April 2015 - 04:31 PM
Can you make it so that the files don't have to be in .nightfall?
I'm currently making a Steam-like game distribution program and I would like to include this game, but because it has hardcoded paths I can't include it.
Lignum #21
Posted 18 April 2015 - 04:54 PM
Can you make it so that the files don't have to be in .nightfall?
I'm currently making a Steam-like game distribution program and I would like to include this game, but because it has hardcoded paths I can't include it.

Can't you put the game in a directory and trick it into thinking it's in root? You should be able to do that easily with os.run or setfenv. Do avoid the latter though, it'll be removed soon.
CrazedProgrammer #22
Posted 18 April 2015 - 05:48 PM
Can you make it so that the files don't have to be in .nightfall?
I'm currently making a Steam-like game distribution program and I would like to include this game, but because it has hardcoded paths I can't include it.

Can't you put the game in a directory and trick it into thinking it's in root? You should be able to do that easily with os.run or setfenv. Do avoid the latter though, it'll be removed soon.
Nope, it's impossible without changing the code.
It has nothing to do with os.run or setfenv, it only has to do with that awsumben13 made everything into an absolute path, and not for example: fs.getDir(shell.getRunningProgram()).."/file"
I hope it gets fixed soon.
MKlegoman357 #23
Posted 18 April 2015 - 06:01 PM
What Lignum was suggesting was that you could sandbox the fs API for the games when you run them so that they would think they are in the root directory.
Creator #24
Posted 18 April 2015 - 06:26 PM
Oh, it does not work, at least for me, if it is in .nightfall so I made it extract in nightfall. The paths are not hardcoded, it uses shell.getRunningProgram()
Exerro #25
Posted 18 April 2015 - 07:07 PM
I've stopped working on this, sorry. Waiting to make a new UI library, which is waiting on a new graphics library and the completion of NovaScript. The language has a pretty much finished parser, just working on the type checker and compiler. After that, the UI library will be my priority, followed by this game.

Oh, it does not work, at least for me, if it is in .nightfall so I made it extract in nightfall. The paths are not hardcoded, it uses shell.getRunningProgram()

What's not working? The game? Or is this just when you have it installed under "nightfall"?

Can you make it so that the files don't have to be in .nightfall?
I'm currently making a Steam-like game distribution program and I would like to include this game, but because it has hardcoded paths I can't include it.

Can't you put the game in a directory and trick it into thinking it's in root? You should be able to do that easily with os.run or setfenv. Do avoid the latter though, it'll be removed soon.

Yeah, technically, you can, but I don't feel like writing it any time soon. The new version, however, won't use relative paths, and I think the game itself will be a single file.
Creator #26
Posted 18 April 2015 - 07:17 PM
Well, it does not install under .nightfall, dunno why. However under nightfall it works
CrazedProgrammer #27
Posted 18 April 2015 - 07:56 PM
I've stopped working on this, sorry. Waiting to make a new UI library, which is waiting on a new graphics library and the completion of NovaScript. The language has a pretty much finished parser, just working on the type checker and compiler. After that, the UI library will be my priority, followed by this game.

Oh, it does not work, at least for me, if it is in .nightfall so I made it extract in nightfall. The paths are not hardcoded, it uses shell.getRunningProgram()

What's not working? The game? Or is this just when you have it installed under "nightfall"?

Can you make it so that the files don't have to be in .nightfall?
I'm currently making a Steam-like game distribution program and I would like to include this game, but because it has hardcoded paths I can't include it.

Can't you put the game in a directory and trick it into thinking it's in root? You should be able to do that easily with os.run or setfenv. Do avoid the latter though, it'll be removed soon.

Yeah, technically, you can, but I don't feel like writing it any time soon. The new version, however, won't use relative paths, and I think the game itself will be a single file.
I will add this game when the next version is released then :D/>
クデル #28
Posted 06 May 2015 - 08:32 AM
Oh my, the animations are so awesome, kudos! :)/>
Creator #29
Posted 06 May 2015 - 10:39 PM
The game is a little bit short, but else great game.
Exerro #30
Posted 07 May 2015 - 05:08 PM
Yeah, never got round to finishing it. I have something in the works that should hopefully improve this. Might even get round to making some other games with it.