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
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 11th Dec 2008 23:01
Good job, keep it up cause what you're working on is pretty much the core of this game.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 11th Dec 2008 23:15
Good Irojo! Are they supposed to speed up in that second segment?

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 12th Dec 2008 00:25 Edited at: 12th Dec 2008 00:25
Quote: "pretty much the core of this game. "

True, but not the hardest part. I don't envy you tower control people.
Quote: "Are they supposed to speed up in that second segment"

Huh?
They are supposed to remain the same speed. That's how it runs in my DB. Perhaps it speeds up, because you just started the program, and DB lags for a second when you start a program.


I download memory.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 12th Dec 2008 00:28 Edited at: 12th Dec 2008 00:30
Right I forgot about that. Was getting about 100fps at first then it would jump to 700+ so you can imagine how surprised I was when it suddenly shot off screen.

Think you can make it continue for infinity?

Congrats guys! In 3 short days we have a Red icon for this thread doesn't really mean much, but that was a fast 50 posts.

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
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 12th Dec 2008 00:34
@BN2
Sinani doesn't seem to be very active atm, can I go ahead and take the Tower AI Task? The background image maps are done for now, they're posted up there.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 12th Dec 2008 00:39
Be my guest

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 12th Dec 2008 00:59 Edited at: 12th Dec 2008 00:59
Quote: "Think you can make it continue for infinity?"

I'm saying alot of these;
Huh?
Quote: "Was getting about 100fps at first then it would jump to 700+ "


Wow.

Now there's an FPS I could live with.


I download memory.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 12th Dec 2008 01:02
I didn't think it was fps at first myself

By infinity, I mean the enemies keep spawning till infinity.

This would involve:
deleting enemies as they leave the screen and re-using the sprite numbers (or whatever you are using)

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 12th Dec 2008 01:08
Okay that would be as simple as all heck. But wouldn't that make it a constant wave?

Or are you saying keep on sending them until they are dead?


I download memory.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 12th Dec 2008 01:09
Well, if you can make a system that would do that, then we could just specify a number to send and it could continue till it is done if there would be more than could fit on the screen.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 12th Dec 2008 01:13
Quote: "huh?"


Boy do I feel schtupid.


I download memory.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 12th Dec 2008 01:43
@Irojo
For testing purpose you can have it so every time you press a key a creep will spawn.
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 12th Dec 2008 02:04 Edited at: 12th Dec 2008 02:12
I'll see what I can do Ashingda.

[EDIT]

A few issues-

The values would have to be recreated entirely.

The arrays would have to be undimed, values reset, and altogether make it impossible for testing.

Feel free to tweek it below:
[IMPORTANT]

While I am willing to make more changes to make the path, I am going to be busy for a bit, so feel free to play around with it.

Hopefully the code is well rem'ed out.

Going down is the priority for the creeps.



I download memory.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 12th Dec 2008 03:17
@Irojo
If you want to wipe or clear an array you can make a little loop that will set the values in that array to zero.

When a creep dies or reaches the finnish line you can reset that creep's value in the array to zero.
Jamesb187
16
Years of Service
User Offline
Joined: 26th Nov 2008
Location:
Posted: 12th Dec 2008 03:21
@ BN2

Let me know if there is a specific task that you'd like me to pick up. I'm raring to go!
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 12th Dec 2008 04:05 Edited at: 12th Dec 2008 07:39
I wrote something that will draw the Path of the WayPoint. I uses my DrawLine Function, I swap the Box command into a FillCircle Function when drawing the line and it looks much better.

I experimented with double space in between sections and it doesn't look too bad.




[edit]

OK, here's my update on the Tower AI and I finaly learned how to get the damn distance, speaking of which, I recall learning this back in math class, guess I'll only learn it when I actually really need it.

[edit]

Ok lots of updates so I just got rid of the other code snippets I posted. Left click to set the towers the enemies will be comming non-stop from left to right.

BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 12th Dec 2008 08:18
@Jamesb

Could you try your hand at creating the spawn management system? Basically, it is what will control WHICH enemies get spawned, and how often. This data can be passed to Irojo's creep control system, which will control the creeps.

Things that need to be considered:
-Higher level=harder level. So, it could mean MORE enemies or the same number, but harder enemies. I believe there are 8 enemy types or so.

-Timing. Obviously, you can't have them spawn to quickly or too slowly, but you would have to take into account their speed as well.

-Order that they will be spawned.

-Fewest possible conditions sent to it.

We want as little hardcoded as possible. Why? So that the levels can go to infinity, which is always a plus, since beating these games kinda kills it. I will let you come up with a method of determining the enemies that spawn, but try to do it with as few values passed TO the function/subroutine as possible. Ideally, it could just pass a number that could be interpreted (idk if that is really possible in this case). Perhaps a value and a difficulty value? Just an idea.

See what you can come up with.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Jamesb187
16
Years of Service
User Offline
Joined: 26th Nov 2008
Location:
Posted: 12th Dec 2008 10:24
Will do.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 12th Dec 2008 12:12
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 12th Dec 2008 16:02 Edited at: 12th Dec 2008 19:10
@All working with the Enemy

We need to be in sync when keeping track of the enemy. We will be using the array below with those values so everyone must change your current values and usage accordingly.




@Irojo
When a Foe move you must add it's speed onto the Traveled element. I need that to know which is further down the road and prioritize shooting.

[edit]

Tower AI Updates. Left Click to set the Tower and Right Click to set the Fort.



@BN2
Since I made the images shall I write the loading process for them as well?
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 12th Dec 2008 20:29
Quote: "so everyone must change your current values "


...

...

But I made my array using the array you gave me. I also posted my program before yours. :S

Quote: "I need that to know which is further down the road and prioritize shooting."


That would be the first one spawned. What can I have it output that will help the most?


I download memory.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 12th Dec 2008 20:43 Edited at: 12th Dec 2008 21:03
Quote: "That would be the first one spawned. What can I have it output that will help the most?"


What happens if the first one spawned is slowr and the ones that comes after that is faster? This is why I though checking how much they've traveled is the better solution.

@Irojo
Your Target() array contains the coordinates for the WayPoint correct? If so would you mind renaming it to WayPoint(). Also when refering to the position or coordinates in the WayPoint use the term Node as I've just learned.

I appologize if I've made it hard on you for renaming arrays, I know it's a hassel, but it's needed.

[edit]
Hey if you happen to come up with additional elements that you need I'll be forced to add it too.


@BN2
For download, the #include Function "LoadMediaImages.dba" and the folder containing the Images.

Attachments

Login to view attachments
Jamesb187
16
Years of Service
User Offline
Joined: 26th Nov 2008
Location:
Posted: 13th Dec 2008 06:08
Hey all, need some advice on the creep spawning subroutine.

The coding itself shouldn't be any bother - where I'm getting stuck a little is on the range of difficulty that our current setup will allow.

First, some background on how I'm approaching the creeps and their relative strength/toughness, based on what I've read on the thread so far:

1. Assuming 8 different types of creep, based on the face images
2. Assuming that we are not using hitpoints, but that each face "downgrades" when it is hit ie if we are using the most "evil" face of the 8 as the hardest, then when this is hit once it will downgrade to the level 7 face, then down to 6 etc until the creep is destroyed.

The problem is this. Based on the above assumptions, the toughest creep that we can spawn will be destroyed after 8 hits, and the weakest will be destroyed after 1. Assuming that we never produce less than 20 creeps per level, and never more than 40 (just a general assumption, we could vary this a bit) that puts our range of damage to be taken in every level in the game from 20 (20 * the lowest level face ie 1) to 320 (40 * the highest level face ie 8).

Assuming that you want to increase the difficulty of the levels by a reasonable amount each time ie 20%, that doesn't give you many levels. If you start with 20 "faces" to be destroyed, and increment by 20% each level (displaying a mix of the lower and higher level faces at each level to an appropriate overall amount of downgrades to be shot off) you'll only have 17 levels before you max out at displaying 40 top-level faces for a total of 320 downgrades. That stops us from producing the "infinite" game that we want. You can play around with speed etc to vary the difficulty some more but we're still really restricted.

So my questions are:
1. Are we happy that after 20 levels or so our difficulty is going to max out, short of just upping the speed of the creeps each level?
2. If not, are we happy to allow me to introduce a hit-point style system so that I can vary the toughness of the creeps on the fly?

Any thoughts? Hope the above makes sense.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 13th Dec 2008 06:20
I know I'm not in this project, but if you'd allow me to butt in in an effort to toss an idea out there...

There is this game called FATE... a dungeon crawler like game... and you progressively go to deeper and deeper dungeons.. and what happens is that each dungeon level seems to have "higher" level monsters and the "algorythm" or whatever seem to be endless as creatures repeat for example on floor one of dungeon... a Level 1 blob takes X hit points to kill... on floor 5 you might see a "level" 2 blob that twice as hard to kill.

I woner if every 20 levels... you multiply the damage needed to "knock a face" down a notch... you might get more "stretch" and game play.

HitPoints_ForCreep = (CurrentLevel / 20) * CreepHitStartingHitPoints

(Where 20 is the value you stated maxes out your difficulty... so every 20 levels double or whatever the strength of the creeps?)

Just a thought
--Jason

Jamesb187
16
Years of Service
User Offline
Joined: 26th Nov 2008
Location:
Posted: 13th Dec 2008 06:36
@ Jason

Sure, that's the kind of idea I had - but we'd previously specified that we weren't using hitpoints. Hence my post...happy not to use them, but I think it will limit the longevity of the game somewhat.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 13th Dec 2008 06:37 Edited at: 13th Dec 2008 06:42
@Jamesb
I believe that an array of Foe(50,7) is more than enough to create an infinite loop. When a Foe dies then it's vairables should be reset to zero and thus be reused for a new Foe.

When creating a new Foe check for it's Face-Type. That should be the first element in the Foe() array. The following will check all the available element in the Foe() array and find one that's unused and set it's value then break out of the For..Next by setting it's value to max (Loops = 50) or something like that.


When a Foe is hit by the Tower AI, the first element Foe(number,0) which is "FaceType" will be subtracted by one until it's zero. Zero meaning it's dead and taken off the screen. This is how the Tower AI will handle the array. When a Foe goes off the screen or finnish line it's element is also reset to zero.

All the other elements in the Foe() array does not need to be nulled because when checking if a Foe() is alive only needs to check the first element as above.

Therefore you can create an infinite flow taking into consideration that the amount of faces on the screen does not exceed it's current max capacity. If the faces WILL exceed the max then that means one of two things, the Player already died, or your Spawn AI must know to pause creation.
Jamesb187
16
Years of Service
User Offline
Joined: 26th Nov 2008
Location:
Posted: 13th Dec 2008 07:53
@ Ashingda,

Ok, so if I read you correctly, you are proposing that to get around this issue we just keep spawning new creeps up to an unlimited amount to increase the difficulty? And then hold the ones who move off-screen until all of the original creeps have been created, before re-releasing them. Can't help thinking hit points would be neater, but whatever the team decides on, I'm happy to produce.

So to recap the options:

1. Add hit points
2. Have an ever-increasing number of creeps, holding those that exit off-screen until there is space to let them back on
3. Have a limit on the difficulty ie a level that you hit that doesn't get any harder in terms of the creeps, and just increment speed from there on

Let me know preferences chaps. Ashingda's for number 2 I guess.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Dec 2008 08:02 Edited at: 13th Dec 2008 08:11
Hitpoints would be harder for the player to keep track of. What makes addicting games, well, addicting, is their SIMPLICITY to play, but their difficulty to win (within reason). In my mind, hitpoints would just take away from the experience (not to mention the fact that since they can only be shot while within range of a tower, that could make it nearly impossible to win without a completely outrageous number of towers everywhere).

The ever increasing number is what I am leaning towards. Also, to increase the difficulty, the TIME BETWEEN SPAWNS can be lowered, and from their, the time between more difficult enemies can be lowered (on level 5 you don't want to spawn 5 of the hardest enemies at the same time, you want them spaced out with easier ones). So there are other variables we can manipulate to give us an almost completely unlimited difficulty variance.

Factors:
How many creeps
How often they spawn
How long between spawns of more powerful enemies
How long between spawns for each type of enemy


Think, 100 creeps, with 10 of everything and an extra 20 randomly distributed all spawning instantly would be quite difficult wouldn't it? But 100 creeps with the same conditions in which the next would only spawn after the one before it was destroyed or it reached the end would be a lot easier.

Ok guys, I think we should vote on this one, since it IS a big part of the game. Go onto the team forums. I created a new post with a poll. Vote there and we will see what happens.

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
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 13th Dec 2008 16:43 Edited at: 13th Dec 2008 16:51
@Jamesb
I dont think you quite understand what I was getting at. I'll explain again.


Imagine our Foe() array just have a max index of 5 -> Foe(5,7). All the value of the index are zero by default. When you spawn a creature, you'll first locate an index that has zero as it's value by using the following:

Set the Values such as X,Y coordinates and Destination then "Loops = 50" is to break out of the FOR..NEXT command. If you can no longer find an available index to use, then that means all 6 Foe are on the screen and you have to cease creating until one or more of them dies. There should be a max of 6 Foes (0,1,2,3,4,5).


When a Foe dies or goes offscreen it's value in the array gets set to zero. Since Foe(loops,0) is the only element the above codes checks to see if it's available, that's the only element we need to set to zero. Now going back to check on the available index, the Foe who died or went offscreen well be reused and set with new values and coordinates.


Take this for Example as a max index of 5 can create an infinite flow as long as we continue to kill it or it goes offscreen.

This is why I said 50 for max index was more than enough. If you exceed that then the Player is for sure already doomed.


The Spawn AI used in the example was just a simple timmer and thats not exactly what we're going for, and it's your task to make the sequence cooler.
Jamesb187
16
Years of Service
User Offline
Joined: 26th Nov 2008
Location:
Posted: 13th Dec 2008 17:07
@ Ashingda

Sure, I understand what you're saying. I'm not going to have any problem writing code that can keep an infinite stream of creeps coming on to the screen as previous creeps are killed.

My question is around how we handle different levels and the required increase in difficulty. From your post, it sounds like you are saying we have a single level that just continually spawns creeps - that wasn't my understanding. I'm designing the spawn system to be called once per level that generates an array of creeps that can then be loaded into the map as required - once they are all killed, the spawn function is called again to generate the next level's creeps. Each time the level increments, the difficulty will increase - hence I need to find a way to increase difficulty in a linear (or exponential) fashion by varying the different categories as laid out by BN2 - the number of creeps, the toughness of the creeps, the interval between them and their speed.

Let me know if your understanding is different as we'll need to iron this out so I can design the code right
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Dec 2008 17:30
I think the speed of the creatures should remain constant based off of their type. MAYBE speed everything up at lvl 15 or 20 or something like that.

It is your choice exactly how you want to make it work. Here is an idea: you determine a value which acts as a controller for which enemies based off of the level you are on. Then that acts as a max value, where the types of all the enemies are subtracted from it (so if it is 40, to spawn a lvl 8 creep, you subtract 8)

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
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 13th Dec 2008 17:31 Edited at: 13th Dec 2008 17:44
Ok, that's taken care of, I might have read somewhere that the max index used for the Foe might be higher than 50, as I'm doing the Tower AI, the second tower that hits in 8 different ways has to check each Foe once for each arrows to see if it's hit. That's a loop of 8x50 comming from one of the second tower. If that value of 50 was to increase that'd be quite bad.

Anyways, since we're doing leveling down as the Foe gets hit, as the stage level increase the higer level facetype will apear more often and the overall flow of Foe will increase.

The speed the Faces travel should be based off of it's face level. So a Face Level 1 "the green face" will move at 1.1 as a Face Level of 7 "the black face" will move at 1.7 or something like that. This is Irojo's part.

BN2 we need to playtest this. The Tower AI is ready to be tested, the WayPoint is still being worked on so we can use a temporary one that just makes the Foe move from the left side of screen to the right in a straight line.

[edit]

The following is my entry for TowerAI and TowerAISetup subroutine. It uses the media images so you have to load the media.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Dec 2008 18:23
Quote: "the second tower that hits in 8 different ways has to check each Foe once for each arrows to see if it's hit"


Not so. You can write a function that will fill an array with only the enemies that are within range (which should be no more than 10). Write in the 0 section of the array (arrayname(0,...)) the total number, so that we don't check any empty slots. We can then use the enemy numbers in the array to check for collision.

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
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 13th Dec 2008 19:00 Edited at: 13th Dec 2008 21:28
But BN2 there are multiple Towers and Multiple arrows going different ways, would this require another array such as Arrows(50,50), or another element into the Tower() array?

I'll have to digg deeper into this as looping exactly 50 times per arrow is not going to help in the long run.

[edit]

Ok I understand what you mean now, I'll work on that function.


[edit


Updates to the Tower AI concerning the 8-way shot Tower.

1) The Tower now only checks through 50 loops once to record the Foes within range then checks only that many for each arrows.

2) When an arrow hits a target then that arrow is exhausted.

3) Befor when this tower shot all 8 arrows and a Foe was close enough, multiple shots from this single Tower would hit the Foe downgrading it multiple levels. Now only one arrow of the 8 that are shot can hit an individual Foe at a time. So if there are 3 Foe all around this tower, when it shoots each will get hit only onces.

Im trying to get the catapult to work but that Tower relies on predicting the Foe's movement along the WayPoint, but that part isn't done yet.

Tower AI Code

Note: you have to call TowerAISetup when the code is loading up stuff.


[edit]


Made a WayPoint Editor, but it doesn't save yet.
Jamesb187
16
Years of Service
User Offline
Joined: 26th Nov 2008
Location:
Posted: 14th Dec 2008 04:13
Ok chaps, bearing in mind that it looks like there's no appetite for hitpoints, I've had a crack at the spawning subroutine. It's pretty crude and needs some work but wanted to see if anyone had any better ideas than mine before progressing it further.

The way I've approached this is to have a difficulty points score for each level, which starts low and then increments by a set amount each level. For the first level, this is 24, and in the current code, this increments by 20% each level - this can be varied if so desired. The different elements that determine difficulty - number of creeps, type of creep (ie tough or weak face), creep speed and creep spawning interval, are assigned points depending on their relative strength. This is where it becomes pretty crude - I've done the following:

- There are 3 creep speed levels - a standard speed of 10, and then speed increases of 20% and 40% for speeds of 12 and 14.
- There are 3 levels of creep spawning interval - standard one of 10, then decreases of 20% and 40% for intervals of 8 and 6.
- The subroutine does a random check each time it is called (for a new level) to see if either the speed is increased, or the interval decreased. If so, a proportion of the available difficulty points for the level is pre-assigned to this change ie if the speed goes up 20%, then 20% of the diff points are spoken for.
- Then the subroutine fills up the rest of the diff points for the level by randomly picking from the available facetypes until all the diff points are used up. Facetypes take diffpoints based on their strength ie a 1-downgrade face (the weakest) takes 1 pt, an 8-downgrade face (the toughest) takes 8 pts.
- As levels get higher and the difficulty climbs, more types of face are made available for selection. This is hardcoded at present.
- The number of creeps is therefore determined by which facetypes are picked and the overall remaining diff points.

There is scope in the code for the number of creeps to go up to 10,000, many more than we should need. There are some obvious problems with this approach, mainly that as the level difficulty increases pretty soon you end up with hundreds of creeps, but I haven't been able to come up with a cleverer way to do this.

I would also like to add some code that orders the CreepArray so that facetypes of differing strengths are spaced out equally, instead of the current random ordering, but thought I would get feedback on the attached first.

Let me know your thoughts.

Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 14th Dec 2008 06:07 Edited at: 14th Dec 2008 06:54
Good job that sequence was better than what I had in mind.
It's important that we keep our CreepArray() consistant because it's going to be shared amongst the different subroutines.


May I ask you to rename the CreepArray() to Foe() because that's what Irojo and I have it as, and to use the following elements for it.


I added the SpawnInterval into the 8th element and the TravelSpeed into the 9th. Another thing, there are actually 10 different Face Types not 8.


Quote: "dim CreepArray(CreepCounter,3)."

This line will become a problem for the game over time. I'd like to ask you to keep the first index at a maximun of 50. Reason being, a Tower will check all Foe onces to see if it's within shooting range. Imagine later in the game when there are 25 or more Towers and the CreepCounter is 200+. That'll be over 5000 loops just for the towers to check what's within range, there's also other loops to reset values/etc that will compound along with it.


I'm not saying that the amount of creeps to spawn per level should be limited to 50, your TempCreepArray(10000) has a max of ten thousand, but the array for CreepArray() or should be renamed Foe() should be maxed at 50.


If you can make some of the changes we can test it out.


[edit]


See if you can insert your codes into this test. Download.

Attachments

Login to view attachments
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 14th Dec 2008 10:21
Even 50 checks doing the distance formula shouldn't give us too much trouble, at least I wouldn't imagine so.

While I don't think we should exceed 50 creeps (since it IS a lot of people), I don't want to limit ourselves unless we absolutely have to.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 14th Dec 2008 17:04 Edited at: 14th Dec 2008 17:43
Sorry guys, I have been loaded with school. Here's just a basic bit of the shop.


Edit:

Here's it with the media:


~QJ

Attachments

Login to view attachments
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 14th Dec 2008 18:12 Edited at: 14th Dec 2008 18:25
@Irojo
Are there any updates on the WayPoint AI? I need it for calculating the catapult AI.


[edit]


My though on how the WayPoint AI should work is that of a function.
The AI is supose to calculate where the position of the Foe would be depending on how far it's traveled.


You call the function asking what the x or y coordinates would be providing it with the Foe's current traveled value.


For example if we call CreepX = WayPoint(Traveled,0) that'll return the x position in the WayPoint that the creep would be at if it traveled that distance. For the Y position it'll be CreepY = WayPoint(Traveled,1).


To use this with the Tower AI, I would call CreepX = WayPoint(Traveled+TravelSpeed*ShootingDistance,0) and same for CreepY to predict where the Foe would be when the arrow/catapult actually hits it.


Note: CreepX and CreepY and etc, does not exist in the codes it's just for example.


If anyone's got other ideas lets hear it.
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 15th Dec 2008 06:00
Quote: "Are there any updates on the WayPoint AI?"

No. I've been extremely busy. Would you do me a favor, and write a list of what you want me to do with it, so when I have the time, I know?

Thanks.


I download memory.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 15th Dec 2008 10:18
Wow, now I don't feel like such a let down for being so busy as of late. Haven't been able to test any code, just been bogged down with work and such. Will see what I can do in the next couple days with no work.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 15th Dec 2008 22:51
Here's the shop as a function or a sub (to be used in a main loop)


~QJ
Jamesb187
16
Years of Service
User Offline
Joined: 26th Nov 2008
Location:
Posted: 16th Dec 2008 08:14
My turn to hand in my excuses Sorry all, I've had to fly back home longhaul after to help with some family business so not sure how much time I can give this in the next couple of days. Should be able to reengage with my tasks in a day or two though.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 17th Dec 2008 07:03 Edited at: 17th Dec 2008 07:05
@Irojo
If you make a WayPoint Maker/Editor first that could help you code that AI.

BTW
This project's not going to last another 3 months cause no one's beeing active is it?
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 17th Dec 2008 11:56
This has been a very inactive project. I don't even know where everyone is with their respective parts. Not to mention the fact that I think that everyone kind of started going their own way with things.

Alright everyone. Before you make any further progress, lets get our current code compiled. I want EVERYONE to make their code into a standalone code demonstration that utilizes their functions/subroutines, with comments explaining what part it is.

Post the code and the media required for it here within the next day or so. I don't want anything fancy, just something that shows that it works and how to use it for what we need.

In your post include a list of what is complete and what has yet to be completed as well as any questions you have regarding your particular part. If you just posted a couple posts back, please RE-POST. I have been crazy busy as of late, so please help me out and just post it again please.

Thanks guys!

PS What do you guys say next time we don't do projects so "soon" after each other in the future. Perhaps split it up with personal projects that are a little bit longer than just a week. Here's an idea: everyone makes the game that they want to work on next as a team. The team votes and that person manages the development of the winning project, since they already know how it is done. Just an idea, it will help keep things interesting too.

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
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 17th Dec 2008 16:21 Edited at: 17th Dec 2008 19:09
@BN2
Yeah I think that's also a good idea. I'll post my codes in just a bit.


[edit]


Ok here's my part of it in a stand alone format. Download the zip that includes the media, LoadMediaImages function, and the TowerAI.

Attachments

Login to view attachments
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 17th Dec 2008 21:29 Edited at: 17th Dec 2008 21:30
I've been really unreliable. Sorry about that. I'm going to try and fix it.

I agree BN2, I like that voting alot.

On my code, I plan on making a waypoint editor, so you can make your map. Ashinda- I need to know what other data results you want. Anyhow, here ya go:




I download memory.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 18th Dec 2008 00:13
@Irojo
I need to know exactly where the X,Y position of the Foe will be in the WayPoint at it's current Traveled value.

For the Tower AI to work correctly I have to be able to pinpoint exactly where the Foe will be by the time the arrow is shot and hits it's target.

This is the current Foe() array If you can adjust to this I'd appriciate it.


Something came to mind that if you're AI can tell the X,Y position of any Foe provided with it's Traveled Value then the index 1,2,3,4,5 aren't needed at all.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Dec 2008 00:41 Edited at: 18th Dec 2008 01:14
@Irojo

I used to do arrays like that!
It's bad practice though because it's really hard to keep track of which field does what (even you make label variables).
Since they are all totally different types of data we should break them down into separate arrays; this doesn't cost any more memory.

much easier to keep track of.

@Ashingda + Irojo
Quote: "Something came to mind that if you're AI can tell the X,Y position of any Foe provided with it's Traveled Value then the index 1,2,3,4,5 aren't needed at all."

Firstly this comment highlights my first point as I had to check the code to see what "1,2,3,4,5" where.

When coding the AI you'll want to know the Creeps' x and y positions and their x and y velocities. You don't need to know waypoints or any other mumbo-jumbo, those things are just for the Creeps' guidance.
I'm working on a small example to show you what kind of maths you're going to need.

[edit]

This is where I wish I'd done A-level physics.
Here's what I have but the maths isn't quite right, the line shows the aim of the tower, there is not arrow being fired yet.


A small program that works is better than a large one that doesn't.

DBC Challenge Rank: Rookie
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 18th Dec 2008 02:17
I started to make a WayPoint Maker/Editor and stumbled upon something that could pass as a WayPointAI.

Remember that function I wrote that drew a line using dots, as the dots are drawn I recorded it's x,y coordinates into an array named WayPointAI(index,1). If I give it a Travel value it returns the x,y position of how far it's traveled into the path.

The zip contains the Editor, saved WayPoint, and Tester.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2025-05-18 22:51:39
Your offset time is: 2025-05-18 22:51:39