Computer Science Canada

Turing Tower Defense

Author:  fishtastic [ Fri Feb 29, 2008 8:51 pm ]
Post subject:  Turing Tower Defense

This is a remake of Desktop Tower Defense in Turing
Insturctions are at the top of the code.

featuring :

3 Difficulties
4 different towers
5 levels of upgrade
6 different enemy types
up to 75 waves
blood effect
and many more

All comments are welcome.


I have spent too many hour making this that I dont feel like working on this anymore.
If you want to see a cleaner version of my code please PM me.

If will try to update if there is a major bug/imbalance.

Posted Image, might have been reduced in size. Click Image to view fullscreen.

Author:  LaZ3R [ Fri Feb 29, 2008 10:51 pm ]
Post subject:  RE:Turing Tower Defense

It's neat but why on earth is all the code on a single line... I hope to god that's not how you program heh...

Game is fun, goodjob on the blocking detection and placement of towers along with tracking of enemies and such.

Fun Smile

Author:  DanielG [ Sat Mar 01, 2008 2:42 am ]
Post subject:  RE:Turing Tower Defense

Great game, good job fishtastic

Author:  michaelp [ Sat Mar 01, 2008 9:51 am ]
Post subject:  RE:Turing Tower Defense

Very good game. I'm playing it now. Very Happy
And I hope you don't put all code on a single line either. Neutral

edit: Final score of 1970. Lost on the last level. Razz

Author:  fishtastic [ Sat Mar 01, 2008 10:40 am ]
Post subject:  Re: RE:Turing Tower Defense

LaZ3R @ Fri Feb 29, 2008 9:51 pm wrote:
It's neat but why on earth is all the code on a single line... I hope to god that's not how you program heh...
i made another program that reads all the codes and put it to another file in one line along with the instructions.

BTW, had any one found a bug yet? There was a horrible bug in my path finding.
IF you find any problem or imbalance please post here.

Also, the hard mode was added because my friend told me there were too little levels, but i don't think hard move can be easily beaten.

thanks for all the nice comments so far Mr. Green

Author:  MichaelM [ Mon Mar 03, 2008 5:43 pm ]
Post subject:  Re: Turing Tower Defense

Great Game! If you put it in turing and press control i it doesn't have enough memory to indent it haha

Author:  BigBear [ Mon Mar 03, 2008 6:07 pm ]
Post subject:  Re: Turing Tower Defense

I would like to see program to convert code into one unreadable line.

Author:  fishtastic [ Mon Mar 03, 2008 10:49 pm ]
Post subject:  Re: Turing Tower Defense

BigBear @ Mon Mar 03, 2008 5:07 pm wrote:
I would like to see program to convert code into one unreadable line.
here you go

you can use this to shorten any of your code into one line(may not always work for some comments), i just love visuals Smile
Turing:
var IN, OUT : int var line := 0 var name : string put "file name w/ .t" get name : * open : IN, name, get open : OUT, "output.t", put var wtf : array 1 .. 100000 of string var total := 1 wtf (1) := "" proc drawP (p : real)     drawfillbox (maxx div 2 - 200, maxy div 2 - 10, maxx div 2 + 200, maxy div 2 + 10, red)     drawfillbox (maxx div 2 - 200 + (ceil (p * 400)), maxy div 2 - 10, maxx div 2 + 200, maxy div 2 + 10, cyan)     drawbox (maxx div 2 - 200, maxy div 2 - 10, maxx div 2 + 200, maxy div 2 + 10, black) end drawP View.Set ("offscreenonly") loop     line += 1     if line mod 29 = 0 then        cls     put "reading: "         put line        View.Update     end if     exit when eof (IN)     var s : string     get : IN, s : *     for i : 1 .. length (s)        if s (i) = '%' and i > 1 and (s (i - 1) not= '\'' and s (i - 1) not= '\"') then             exit        else        wtf (total) += s (i)        end if     end for     wtf (total) += " "     if length (wtf (total)) > 50 then         total += 1      wtf (total) := ""     end if end loop for i : 1 .. total     put : OUT, wtf (i) ..     cls     put "Putting "     locate (12, 40)     put i, "/", total     drawP (i / total)     locate (15, 40)     put (i / total) * 100 : 2 : 2, "%"     View.Update end for   


if you find any problem in my game please report here.

Author:  Sur_real [ Tue Mar 04, 2008 5:43 pm ]
Post subject:  Re: Turing Tower Defense

Nice game fishtastic, beat the last level with score of 2872 (on easy though) : )


PS: Just started laughing when I saw the variable wtf.

Author:  darkangel [ Wed Mar 05, 2008 7:11 pm ]
Post subject:  Re: Turing Tower Defense

I shortened your suppress to one line program fishtastic Razz
no need for big bulky array. (Although I did laugh when i saw it)

code:

var line : string
var IN, OUT : int
var nameIN, nameOUT : string

put "name of input with extension"
get nameIN
put "name of output with extension"
get nameOUT

open : IN, nameIN, get
open : OUT, nameOUT, put

loop
    exit when eof (IN)
    get : IN, line : *
    put : OUT, line," " ..
end loop


No visual thou, i would have put it in but for it to work my program would have to look through the entire file first which wouldn't be too efficient.

Author:  fishtastic [ Wed Mar 05, 2008 8:33 pm ]
Post subject:  Re: Turing Tower Defense

Sur_real @ Tue Mar 04, 2008 4:43 pm wrote:
Nice game fishtastic, beat the last level with score of 2872 (on easy though) : )


PS: Just started laughing when I saw the variable wtf.


When i cant think of a good variable name, i just use something really stupid.(var wtf:array 1..maxint of string / var omg:int)

not a bad score.
I almost beat hard mode in school during lunch hour.
school rule allow you to play your own game.

I might try to re balance just to make sure hard mode is beatable.

darkangel @ Wed Mar 05, 2008 6:11 pm wrote:
I shortened your suppress to one line program fishtastic Razz
no need for big bulky array. (Although I did laugh when i saw it)
code:

.
.
.
loop
    exit when eof (IN)
    get : IN, line : *
    put : OUT, line," " ..
end loop


haha nice!

what you did is shorter and faster, that is what i did first too. then it turn out that i had comments start with "%"
then everything after "%" became comment.
...
then it didn't work.

Author:  Mackie [ Wed Mar 05, 2008 8:42 pm ]
Post subject:  RE:Turing Tower Defense

Just use /* multi-line comments */. You can put them in weird places and still have them work. Like:

code:
put /*RAWR*/ "foo"

Author:  Clayton [ Wed Mar 05, 2008 8:46 pm ]
Post subject:  RE:Turing Tower Defense

fishtastic wrote:
I might try to re balance just to make sure hard mode is beatable.

It is, you just have to be careful. I did it.

Author:  Michael516 [ Thu Mar 13, 2008 2:51 pm ]
Post subject:  Re: Turing Tower Defense

great game, its really fun, but why does it say that there is not enough memory when you try to make it into more than one line? how many kbs was it before you compressed it to one line?

Author:  fishtastic [ Thu Mar 13, 2008 6:30 pm ]
Post subject:  Re: Turing Tower Defense

Michael516 @ Thu Mar 13, 2008 1:51 pm wrote:
great game, its really fun, but why does it say that there is not enough memory when you try to make it into more than one line? how many kbs was it before you compressed it to one line?
around 50 KB, 1.8k lines

Author:  petree08 [ Wed Mar 19, 2008 1:31 pm ]
Post subject:  RE:Turing Tower Defense

YOU ARE 1337 CODER!!!

this is probalby one of the best game systems i've seen on compsci. A+

not much lag even with using drawcommands, sweet

Author:  CodeMonkey2000 [ Wed Mar 19, 2008 2:47 pm ]
Post subject:  RE:Turing Tower Defense

1.8 K lines? Wow I didn't think this game would be that big.

Author:  Sean [ Wed Mar 19, 2008 2:59 pm ]
Post subject:  Re: Turing Tower Defense

Good work, I enjoyed it.

Author:  CodeMonkey2000 [ Wed Mar 19, 2008 3:01 pm ]
Post subject:  RE:Turing Tower Defense

@petree08 you obviously haven't played Forces Wink

Author:  fishtastic [ Wed Mar 19, 2008 11:07 pm ]
Post subject:  Re: RE:Turing Tower Defense

Thanks for all the comments. Mr. Green I will probably update the game to fix some of the new problems i found. Also I have few new idea that i wish to add.

CodeMonkey2000 @ Wed Mar 19, 2008 1:47 pm wrote:
1.8 K lines? Wow I didn't think this game would be that big.

yes. it is much bigger than i expected. i was expecting the to be under 1k lines. but by the time i finish pathfinding ,one type of creep moving. and one tower. it was already 1k lines. Crying or Very sad

Author:  Kharybdis [ Wed Mar 26, 2008 12:09 pm ]
Post subject:  Re: Turing Tower Defense

Good game....!

If i cheat, its easy to beat the last level, but even then... some times are hard... damn blobs..

Author:  Doug101 [ Tue Apr 01, 2008 8:02 am ]
Post subject:  Re: Turing Tower Defense

awsome game this game puts all other turing games to shame i wish i make games like this.

Author:  repsoccer16 [ Wed Apr 02, 2008 8:14 am ]
Post subject:  Re: Turing Tower Defense

simply the best it gets for turing. Smile

Author:  Doug101 [ Wed Apr 02, 2008 8:15 am ]
Post subject:  Re: Turing Tower Defense

for some reason this game will only work on some computers can somebody explain why direction is an error.

Author:  fishtastic [ Wed Apr 02, 2008 5:06 pm ]
Post subject:  Re: Turing Tower Defense

Doug101 @ Wed Apr 02, 2008 7:15 am wrote:
for some reason this game will only work on some computers can somebody explain why direction is an error.

can you post the error message? so i can try to fix it. Rolling Eyes

I am still working on a update on my spare time. (i am usually busy doing random stuff:shock: )
this will probably my last big turing project. since i have to use c++ in my class.

Author:  Doug101 [ Wed Apr 02, 2008 5:32 pm ]
Post subject:  Re: Turing Tower Defense

i think its just the version of turing we have a school it dosnt reconize "distance".

Author:  Michael516 [ Wed Apr 02, 2008 7:23 pm ]
Post subject:  Re: Turing Tower Defense

its strange, it will work on some of the computers but not others.

Author:  fishtastic [ Wed Apr 02, 2008 7:50 pm ]
Post subject:  Re: Turing Tower Defense

Michael516 @ Wed Apr 02, 2008 6:23 pm wrote:
its strange, it will work on some of the computers but not others.

can you also post the error message you are getting.
because if the problem is just Math.Distance then all i have to do is make my own distance funtion
or i can just pre-compile the program in my update.

Author:  Michael516 [ Thu Apr 03, 2008 7:15 am ]
Post subject:  Re: Turing Tower Defense

i'm not sure what it is because i am on one of the computers that it works on but i think that it sais something about Math not being a measure on distance.

Author:  Doug101 [ Thu Apr 03, 2008 7:17 am ]
Post subject:  Re: Turing Tower Defense

ya Math.Distance is the only problem other than that its fine.

Author:  DaveAngus [ Thu Apr 03, 2008 10:17 am ]
Post subject:  RE:Turing Tower Defense

Wow man.
GREAT job!!!!!
Loving the game.

Author:  ashiphire [ Tue Apr 08, 2008 8:27 am ]
Post subject:  RE:Turing Tower Defense

amazing game, i can't think of any advice that hasn't already been said

Author:  DaveAngus [ Tue Apr 08, 2008 8:46 am ]
Post subject:  RE:Turing Tower Defense

Oh I have a 'request'.
For the triangular planes that can fly over top of all of the weapons...maybe create a "Anti-aircraft" weapon to make it easier to take them out.
Already they arent to hard to take out just it would add a bit to the game.
Also, I really like the upgrades that are available.

DO you have any more games?

Take care

Author:  Tallguy [ Thu May 01, 2008 9:56 am ]
Post subject:  RE:Turing Tower Defense

3156 - final score

u should make it an infinite lvls

Author:  death bringer [ Mon May 05, 2008 10:57 am ]
Post subject:  RE:Turing Tower Defense

Can you make more levels I beat this on hard
very good game though
add this if you want a loading bar lol


type RGBColor:
record
r,g,b:real
end record View.Set ("graphics:max;max")


proc DrawBar (x1_, y1_, x2_, y2_, BorderThk_, BackColor_, TrimColor_, Value1_, Value2_ : int, Col1_, Col2_ : RGBColor)
const percent : real := Value1_ / Value2_
const width : real := abs ((x2_ - 2 - BorderThk_) - (x1_ + 2 + BorderThk_))
var FinalColor : int
var ColFactor : RGBColor
ColFactor.r := ((Col2_.r - Col1_.r) / 100)
ColFactor.g := ((Col2_.g - Col1_.g) / 100)
ColFactor.b := ((Col2_.b - Col1_.b) / 100)
if BackColor_ not= -1 then
Draw.FillBox (x1_, y1_, x2_, y2_, BackColor_)
end if

for i : 1 .. BorderThk_ %%Draws the border between the black outlines.
Draw.Box (x1_ + i, y1_ + i, x2_ - i, y2_ - i, TrimColor_)
end for
Draw.Box (x1_, y1_, x2_, y2_, black) %%Outermost black line.
Draw.Box (x1_ + BorderThk_ + 1, y1_ + BorderThk_ + 1, x2_ - BorderThk_ - 1, y2_ - BorderThk_ - 1, black) %%Innermost black line.

if Value1_ > 0 then %%The inner fill bar color.
FinalColor := RGB.AddColor (
Col2_.r - (percent * 100 * (percent * ColFactor.r)),
Col2_.g - (percent * 100 * (percent * ColFactor.g)),
Col2_.b - (percent * 100 * (percent * ColFactor.b)))
Draw.FillBox (
x1_ + BorderThk_ + 1,
y1_ + BorderThk_ + 1,
x1_ + BorderThk_ + 1 + floor (min (percent, 1) * width),
y2_ - BorderThk_ - 1,
FinalColor)

end if
end DrawBar
View.Set ("offscreenonly")
var col1, col2 : RGBColor
col1.r := 1
col1.g := 0
col1.b := 0
col2.r := 0
col2.g := 0
col2.b := 1
for i : 0 .. 100
cls
DrawBar (0, 50, 800, 0, 0,white , grey, i, 100, col1, col2)
View.Update ()
delay (80)
end for

Author:  CodeMonkey2000 [ Mon May 05, 2008 3:57 pm ]
Post subject:  RE:Turing Tower Defense

Why would anyone want to add a fake loading bar? Do you enjoy loading times?

Author:  death bringer [ Wed May 07, 2008 10:37 am ]
Post subject:  RE:Turing Tower Defense

also add this at the end it's neat

setscreen ("graphics:max;max,offscreenonly,nocursor")
colorback (7)
process Bump_Sound2
var Font1 : int
Font1 := Font.New ("Arial:30")
Font.Draw ("Hope you had fun playing Turing TD!",250,250, Font1, 0)
sound (500, 200)
end Bump_Sound2
process Bump_Sound
sound (1000, 1)
end Bump_Sound
procedure Blur_Screen (I, C : int)
Blur_Screen (100, 9)
for B : 1 .. I
drawline (Rand.Int (1, maxx), Rand.Int (1, maxy),
Rand.Int (1, maxx), Rand.Int (1, maxy), C)

end for
end Blur_Screen

const size := 100
const fireLength := 400
var decay := 0.93
var gravity := 0.1
var pixel : array 1 .. size, 1 .. 2 of real
var velocity : array 1 .. size, 1 .. 2 of real
var px, py : real

procedure newFire (x, y, vx, maxV : real)
var ang : int
for i : 1 .. size
pixel (i, 1) := x
pixel (i, 2) := y
ang := Rand.Int (500, 30000)

velocity (i, 1) := cosd (ang) * (Rand.Real * (2 * maxV) - maxV) + vx
velocity (i, 2) := sind (ang) * (Rand.Real * (2 * maxV) - maxV)
end for
end newFire

procedure moveFire (c : int)

for i : 1 .. size
pixel (i, 1) += velocity (i, 1)
pixel (i, 2) += velocity (i, 2)
velocity (i, 1) *= decay
velocity (i, 2) -= gravity
velocity (i, 2) *= decay

drawdot (round (pixel (i, 1)), round (pixel (i, 2)), c)
end for
end moveFire

procedure launch (x, ang, spd, c : int)
px := x
py := 0
var pvx, pvy : real
pvx := cosd (ang) * spd
pvy := sind (ang) * spd
loop
delay(3)
fork Bump_Sound2
exit when pvy < 0

px += pvx
py += pvy
pvx *= decay
pvy -= gravity
pvy *= decay
drawfilloval (round (px), round (py), 2, 2, c)
View.Update
cls
end loop
newFire (px, py, pvx, 20)
for i : 1 .. fireLength



moveFire (c)
View.Update
cls
end for
fork Bump_Sound
end launch

loop
launch (Rand.Int (100, maxx - 100), Rand.Int (70, 110), 40, Rand.Int (0, 255))
end loop

Author:  death bringer [ Wed May 07, 2008 10:51 am ]
Post subject:  Re: Turing Tower Defense

This is the file i have that i've upgraded

Author:  Clayton [ Mon May 12, 2008 4:53 pm ]
Post subject:  RE:Turing Tower Defense

death_bringer, you absolutely have to credit code to the original author (of which you have not done). For now this thread shall be locked. If you have any issues, please PM me.

This thread is locked


: