Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / DarkNOOBS Project 2: Tower Defense

Author
Message
Irojo
18
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 18th Dec 2008 02:51 Edited at: 25th Dec 2008 02:05
Quote: "Since they are all totally different types of data we should break them down into separate arrays; this doesn't cost any more memory."

*Dies*
No wait.

Do
*Dies*
sync
loop



I did that before Obese. Then I was told by Ashingda (90% sure it was him) to change it to what I have now!

BLEH!
--
@Ashingda
Quote: "REM Foe(index,8) = Spawn Interval"


What for? That array was supposed to be for one creature on it's own, not all of them.

Quote: " REM Foe(index,6) = Traveled , Default=0
REM Foe(index,7) = Targeted , Default=0
"


I don't get what these values would be. Please explain.

Quote: "I need to know exactly where the X,Y position of the Foe will be in the WayPoint at it's current Traveled value.
"

I think I get this. How will I know how far in the future you want it?

REM Foe(index,10) = Current Destination

Can we add that to the array? I need it for the creep destination calculations.
-
Oh and,
Quote: "REM Function FillCircle()
REM This function was aquired from a few challenges back. A very
REM fast 2d filled circle. I forgot who wrote it."

SvenB.


Time is money. I just ripped you off.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 18th Dec 2008 02:56
Ok ill will be more active in two days because of chirstmas break but it like hell trying to get all my homework done on time.

Ps. sorry for not posting for a long time. Good ideas everyone.

I was here.
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 18th Dec 2008 03:30
Quote: "I think I get this. How will I know how far in the future you want it?"


newXpos=Xpos+Time*Xvelocity
newYpos=Ypos+Time*Yvelocity

Aimx=TowerX+ShotSpeed*cos(angle)*time
Aimy=TowerY+ShotSPeed*sin(angle)*time

Set them equal:

Xpos+Time*Xvelocity=TowerX+ShotSpeed*cos(angle)*time
Ypos+Time*Yvelocity=TowerY+ShotSpeed*sin(angle)*time

solve for T

Time(Xvelocity-Shotspeed*cos(angle)=TowerX-Xpos

So:

Time=(TowerX-Xpos)/(Xvelocity-Shotspeed*cos(angle))

You WILL need to find the angle to shoot at (which would be based off of the newxpos and newypos values. Giving:

Angle=atan((NewYpos-Ypos)/(NewXpos-Xpos))

Revealing:

Angle=atan((Time*Yvelocity)/(Time*Xvelocity))

So:
Time=(TowerX-Xpos)/(Xvelocity-ShotSpeed*cos(atan((Time*Yvelocity)/(Time*Xvelocity)))

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 18th Dec 2008 03:44 Edited at: 18th Dec 2008 03:46
Quote: "
REM Foe(index,8) = Spawn Interval
"

This was something added by Jamesb for use in the Spawn AI.

Quote: "
REM Foe(index,6) = Traveled , Default=0
REM Foe(index,7) = Targeted , Default=0
"

"Traveled" is so I can know which Foe is further along the path as they will not all be Traveling at the same Speed. This is used in the Tower AI to prioritize shooting the Foe who's closer to the finnish line.

"Targeted" helps with the Tower AI so they dont waste Arrows all shooting one Green Face as it will die in 1 hit. The amount a face is allowed to be targeted is equal to it's Face Type, so a Green face which is 1 and will die in 1 hit is only allowed to be targeted 1 time as a Blue Face which is 6 and dies in 6 hits is allowed to be targeted 6 times by different Towers.

Quote: ""I need to know exactly where the X,Y position of the Foe will be in the WayPoint at it's current Traveled value.
"
I think I get this. How will I know how far in the future you want it?"

You dont need to know it but you do need to return the x,y position for the Foe that I request pinpointing how far it's traveled or WILL travel.
Quirkyjim
17
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 18th Dec 2008 22:01
I've got an idea!
Still in the works but...


~QJ
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 19th Dec 2008 08:35
Don't forget to delete the creep if they are off screen so that you don't lose 1 health for every monster off screen every iteration through the code.

also make sure it is: If enemyx>640 OR enemyy>480...

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 19th Dec 2008 17:34
Are there any new updates?
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 19th Dec 2008 20:24
For now, could everyone post a compiled executable to make it easy to see where we are exactly. Sorry for being so busy guys! With an exe it should be easier for me to see what has been done and what needs doing.

Thanks for your coop guys!

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 21st Dec 2008 15:50
Here's an EXE of TowerAI. Leftclick and Rightclick to set Towers.
Irojo
18
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 22nd Dec 2008 00:15 Edited at: 22nd Dec 2008 15:30
Cheers.

[REMOVED]


I download memory.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 22nd Dec 2008 03:38
@Irojo
What the heck is that?
Jamesb187
17
Years of Service
User Offline
Joined: 26th Nov 2008
Location:
Posted: 22nd Dec 2008 13:16
All,

Apologies guys, I'm going to have to drop out of the project for the time being. There's been a bereavement in my family and I need to focus on supporting my family for the time being. Hope you can understand - feel free to use or ignore the code that I submitted earlier as you choose. Hopefully I can reengage with things in a few weeks.

Thanks,

James
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 22nd Dec 2008 14:55


Here is the sub routine and i will make it into a demo exe in like 10 minutes. have fun

I was here.
Irojo
18
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 22nd Dec 2008 15:30 Edited at: 22nd Dec 2008 15:32
@Ashingda

I have no idea what the heck happened.

I'm suspicious of filefront now...

I'll try and get a -real- link back up.

Does this work?

It worked for me.

http://files.filefront.com/Enemy+ControlEXE/;12734

I think someone uploaded a file with the EXACT same name. So when downloading, check to make sure it's the right one.


I download memory.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 22nd Dec 2008 15:32 Edited at: 22nd Dec 2008 15:34
I need a little help with something. here it is:

ok I am trying to say that creep_postition$ is equal to creep_postitionx + "," + creep_postitiony

i know my mistake is stupid so please correct me


edit: never mind i forgot to add str$ before the floats.

I was here.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 22nd Dec 2008 15:55 Edited at: 22nd Dec 2008 16:11
Hey here it is a basic demo of my system:media attached



comments please

I was here.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 22nd Dec 2008 17:50 Edited at: 22nd Dec 2008 17:54
I 'm working on a waypoint editor we could use as soon as i get the save and load features done. Here is an exe using one of the faces. Click Q to change waypoint. it uses same media as the post above

I was here.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 22nd Dec 2008 21:09
Ok this is my waypoint editor. It can save and load. and currently has 3 waypoints set. I can make more if we need.

here is code without media:


I was here.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 22nd Dec 2008 21:58
@Stefan
Can you code it so the WayPoint will input from a mouseclick instead of typing it in?
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 22nd Dec 2008 23:55 Edited at: 23rd Dec 2008 01:09
ok it'll take a little bit time. Ha i guess i could make that into a option.

edit: It'll take time because im making make dbpro files that incorperate its on code. Some serious stuff.


By the way im sorry for my spelling, its not the greatest



Edit2: can some one help me learn how to use the mouse commands. Cause my method is not working at all here is what i came up


I was here.
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Dec 2008 00:00
@Ashingda:

For some reason the EXE won't run . It is probably my computer. Sorry for flip flopping AGAIN, but could you post the code for it.

@Stephan:
You code wont compile in DBC, since it uses some DBP commands (such as Move Sprite). If you could, correct it please.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 23rd Dec 2008 01:32 Edited at: 23rd Dec 2008 01:35
Glad to know that but instead of fixing i'll post an exe. And can anyone help me with my mouse problems so i can make my waypoint editor better.

I was here.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 23rd Dec 2008 02:21
@BN2
Ok here's the code It should work without any media.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 23rd Dec 2008 02:25 Edited at: 23rd Dec 2008 02:25
@Stefan
Use Mousex() and Mousey() and Mouseclick()

For MouseClick() if you leftclick = 1 and rightclick = 2.


[edit]
omg didn't even realize I double posted >.<
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Dec 2008 02:26
Bravo Ashingda! Very impressive.

@Stephan:
Couldn't really see any change while the program was running, it looked like the face just slid to the side. Try adding more useful feedback. For instance, instead of a number, make it display "Current Health:" then the number. Also, If you have the monster re-start at the left again, I can watch the changes occur every time.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 23rd Dec 2008 02:55 Edited at: 23rd Dec 2008 03:13
@ bn2 Youre spelling my name wrong and ok

@ Ashingda it still didnt work. here is the the code



My score up system redone exe. Things to know if the sprite passes 50 x then its hp is 0 and you gain moneyscore.money is 10 times the number of cycles lower then score.

I was here.
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Dec 2008 03:05
@Stefan

Sorry, didn't realize.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 23rd Dec 2008 03:11 Edited at: 23rd Dec 2008 03:11
@Stefan
MouseX() will return the x position of the mouse. Mx was just a variable to store it. You have to Mx = Mousex() or call MouseX() directly in your argument. Same for MouseY() and MouseClick().

You can use a variable to store the mouse values,


Or you can call the mouse Function directly.


If you're going to check the mouse values multiple times within one sub, it's better to use the Variables to store the mouse values because it's more consistant. You dont want to drop the mouse click and get a different resault halfway through the sub.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 23rd Dec 2008 03:17
Ok i get that but i already declared those variables at the start. I think my problem is that im overwrite the
destination(1,1) = waypoint_1_X
destination(1,2) = waypoint_1_Y
destination(2,1) = waypoint_2_X
destination(2,2) = waypoint_2_Y
destination(3,1) = waypoint_3_X
destination(3,2) = waypoint_3_Y

somewhere. well i goto go for today

I was here.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 23rd Dec 2008 15:39 Edited at: 23rd Dec 2008 21:04
Guys i got my waypoint editor to convert what you make in it into dbp/db code. Yay. Still need help with mouse part


Edit1: Can someone with dbp and dbc look over code to make sure its comptable with both. im talking about the code the exe produces. Also I need some one to write a sub routine for me that records The mouse's postition when it's clicked and converts it to a variable called waypoint_1_X (this is th x coordinate.)and waypoint_1_Y(this is th y coordinate.). Thanks if someone does i will also be working on it. Oh yea here is the exe.

Not @ dark noobs @ everyone who not in project Any code made using this editor must have my name in credits and my company. Stefan Stefan.co

Controls:


ctrl + a = make into db code
ctrl + s = saves into a format editor can read
ctrl + l = loads what you saved
q = set up waypoint 1
w = set up waypoint 2
e = set up waypoint 3
space = test waypoints you have to hold
ctrl + m = gets the backround.



edit2: I got it i found my problem. i was telling the compiler that mouse click coordinates are the coordinates to waypoint1 and all i had to was reverse it. By the way editor supports 20 waypoints.


edit 3: EXE updated. mouse can get waypoints now.

I was here.
Quirkyjim
17
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 23rd Dec 2008 19:12
Yeah, Stefan, I didn't exactly see the point of what you made. What does it do again?

~QJ
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 23rd Dec 2008 20:20 Edited at: 23rd Dec 2008 21:03
Makes waypoints on a map then converts it to dbp/db code.

I was here.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 23rd Dec 2008 21:14
Also guys do you have the maps done i can waypoint them. Make sure you draw a road for me to way point.

I was here.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 23rd Dec 2008 21:43 Edited at: 23rd Dec 2008 21:48
The map is done, you'll have to draw the road yourself using some kind of line command or function.


[edit]

We each have to keep some copy of what the other teams members are working on especially media, I don't want to re-post it over and over. If you see new media or updates on it, please save a copy of it in your current DarkNoob work folder.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 24th Dec 2008 01:12 Edited at: 24th Dec 2008 02:04
@ bn2 A couple questions is the backround/map going to be a sprite or what

@ Ashingda 27 It would be a lot easier if you drew in the roads so that I can see where to put waypoints

Ok I did an example so i can show a screen shot.

I was here.
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Dec 2008 02:58
Pasted image/sprite. Uses less resources

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 24th Dec 2008 04:37
@Stefan
I had a function that was supose to draw the roads, this way we can have different roads on the same background image.

For now draw a line that will connect the WayPoints for your editor and later that line will be replaced with the Function that draws the road.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 24th Dec 2008 16:15
@ Ashingda 27 I just drew the road in paint and saved with another name.

I was here.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 24th Dec 2008 18:21 Edited at: 24th Dec 2008 20:24
@Irojo
Haven't heard from you fro a while, are you still working on the WayPoint?


[edit]


@Stefan
Try making your editor without the use of the Input command. Try drawing a line from one WayPoint to another and print the WayPoint Number on that point.


[edit]


@BN2
I'd like to finnish this befor January, how's it going on your part?
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Dec 2008 20:28
Working on it, though things have been getting crazy. This time a year I end up working MUCH more than normal, since it is christmas and all. So far, ashingda, yours looks like it is working, but I really haven't seen anyone else's work.

I would like to finish it by January as well

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 24th Dec 2008 23:06 Edited at: 24th Dec 2008 23:19
I need the WayPointAI to be able to keep all of these values.





Each x,y position should be stored and able to be called back at will.


If the Foe has traveled 5 points then that foe will be at 6,5. We do not need to keep track of the Foe's X,Y anymore all we need is how much it's traveled and that will be used to call the WayPointAI to get the X,Y.

If the Foe's Speed is 2 or greater the traveled value will increase by that much, and finding the X,Y will still be just as easy.


When using the TowerAI, the position the arrow will shoot to is the current Foe's Traveled value plus the Distance/ShotSpeed*FoeMoveSpeed.

For example if the Foe is at Traveled 0 the tower will shoot at Traveled 3 by the time the arrow hit's it's mark, the Foe will arrive at Traveled 3.
Stefan p
17
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 25th Dec 2008 01:40
@ Ashingda 27 Quuestion: should i make it be able to go diagonaly and i get that i will try.

I was here.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 25th Dec 2008 02:10
@Stefan
The WayPoint should be able to go any direction.
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 25th Dec 2008 05:49
Quote: "The WayPoint should be able to go any direction. "


Definitely agree. The system should be versatile enough to handle any situation. Watch out for divide by 0 errors though .

Oh, btw, MERRY CHRISTMAS GUYS!! (And for all of you who don't, then don't have a merry christmas, have a happy 25th of December )

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 25th Dec 2008 13:55
What happens when the AI runs into a tower?
How are you going to get around it?
Is that what the waypoints are for?
I posted a simple solution to pathfinding in another thread titled "what is a waypoint?", have a look at it and see what you think.


Goke of the day: [Q]What's a coders' favourite part of an orchestra?
[A]The strings.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 25th Dec 2008 17:37 Edited at: 25th Dec 2008 17:40
@Obese
Yup I saw that, reminds me of the flood fill function from a while back.

And the AI will never run into the tower, because we are not suppose to be able to place a tower into the WayPoint in the first place.

And Merry Christmas Guys.

@Irojo
Are you still working on the WayPoint, It's a rather important part in this game, if not let someone else take on it?
Irojo
18
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 26th Dec 2008 00:46
Sorry Ashingda.

Someone else can work on it.

I just don't know what needs to be done for it, besides specifying the path.

If you can tell me that, I can make it.


Time is money. I just ripped you off.
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 26th Dec 2008 13:36
Quote: "And the AI will never run into the tower, because we are not suppose to be able to place a tower into the WayPoint in the first place."

What if the tower is in between the creep and the waypoint though?


Goke of the day: [Q]What's a coders' favourite part of an orchestra?
[A]The strings.
Irojo
18
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 26th Dec 2008 15:59 Edited at: 26th Dec 2008 16:00
Let me clear this up Obese.

There will be one set path.

|__.
.....|
.___
|...

.=nothing
_ and | = road

The creeps would follow only the road, and the towers could not be placed on the road.


Time is money. I just ripped you off.
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 26th Dec 2008 20:44
@Irojo
Ahh that is much easier!
We could have different levels with different terrain, would be good to have medieval invaders rather than just blobs, if someone wants to draw them that is.


Goke of the day: [Q]What's a coders' favourite part of an orchestra?
[A]The strings.

Login to post a reply

Server time is: 2026-07-13 21:40:40
Your offset time is: 2026-07-13 21:40:40