Help - Plants vs Zombies

Sabretooth

New Member
Reaction score
0
Heya!

So i'm currently working on a project i call Ancient vs Undead based on the popular mini-game Plants vs Zombies
Basic plot:
Zombies spawn - Zombies walk down their lane - You kill sombies by constructing towers and walls that will stop them from destroying your farm.
pvzh.png


This is my first REAL project and everything have worked out fine... until now.

Problem:
I want my towers to only attack the zombies on their own lane.
pvz2.png

At the moment, towers do attack closest zombie and dosen't care if it is on its own lane or not.

I can't solve this problem on my own, so i ask you for help. Do you have a tip or a solution?
Please and thank you :)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
the zombies of each lane have to belong to different players.
it would be better to do it this way not just because of the towers but because of the standard wc3 ai which will bug if more then 200 units belong to the same player.
 

X-maul

AKA: Demtrod
Reaction score
201
you could do that simply by addin pathing blocker line of sight ;)

EDIT:
misread - you can trigger it to shot a missile (dummy unit) to the right every X second, and when they get in 50 range of an enemy unit, make it deal damage to the unit.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
you could do that simply by addin pathing blocker line of sight ;)
this wont work if you can see the lane of the other players in any way. however, if you couldnt see it i doubt there would be alot of sense playing multiplayer td maps.

EDIT:
misread - you can trigger it to shot a missile (dummy unit) to the right every X second, and when they get in 50 range of an enemy unit, make it deal damage to the unit.
and this would be such an overkill in a tower defense that his map most likely wouldnt be played much longer then 5 minutes because of the extensive lag it will cause if houndres of towers are shooting thousands of dummy missles.
 

Laiev

Hey Listen!!
Reaction score
188
use regions... (5)

then check the region of attacked unit if is different then attacking unit, order to attack random unit in the current region and stop if has no unit in region
 

Sim

Forum Administrator
Staff member
Reaction score
534
How many players are actually going to be "Defending" in your TD?
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
assume that each lane is a region

how about:
- add "worker" class to all your tower so they won't auto-acquire targets
- for each tower, periodically pick a nearest enemy within its attack range and in the region that's its lane
- order it to attack this enemy

this is un-tested but it's worth trying ;)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
use regions... (5)

then check the region of attacked unit if is different then attacking unit, order to attack random unit in the current region and stop if has no unit in region
this will glitch the towers attack, they will not always attack the right way and most probably screw the gameplay. cause nobody wants his towers in a td map to "stop" every now and then when re-quiring a new target. (after a unit is ordered the "stop" order it will take a little time until it auto-aquires a new target)

assume that each lane is a region

how about:
- add "worker" class to all your tower so they won't auto-acquire targets
- for each tower, periodically pick a nearest enemy within its attack range and in the region that's its lane
- order it to attack this enemy

this is un-tested but it's worth trying ;)

will 1). make a pretty ugly worker icon for every tower and 2). it might cause lag depending on the amount of towers, it will drop the performance for sure.
 

Sim

Forum Administrator
Staff member
Reaction score
534
The solution is located somewhere in post #2.

Have a maximum of 6 players defending, and 6 players (computer players) controlling the zombies. Make every defending player the enemy of the zombie player corresponding to his lane. Make every defending player allied with all the other zombie players.
 

Mahrloc

New Member
Reaction score
5
the thing i would do is to make every tower shoot dummy units, which are moved by triggers. i think the performance should be fine if you don't move them too often...
 

Sim

Forum Administrator
Staff member
Reaction score
534
> i think the performance should be fine if you don't move them too often...

It's the dummy units themselves that create lag, not the fact that they move. The game has an odd way of handling units. A mass of dummy units almost always lags.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
> i think the performance should be fine if you don't move them too often...

It's the dummy units themselves that create lag, not the fact that they move. The game has an odd way of handling units. A mass of dummy units almost always lags.

daxtreme is right, but not just that, creating a unit is the most slowest function of all in wc3. units just have this incredible amount of information they need. all those values they save. its just heavy overkill to use them in the very most circumstances and it should be avoided at any cost.
 

Bogrim

y hello thar
Reaction score
154
For missiles, make your units cast a cone type of spell (e.g. Shockwave) instead of attacking. You can use an invisible non-damaging attack if you want the attack to trigger the spell and order the unit to cast the spell in the appropriate direction whenever it attacks. But I would suggest making some form of combat trigger that auto-casts the spell while "combat" is active.
 

Sabretooth

New Member
Reaction score
0
I tried this:
1) For every square on map i created a "building" based on Circle of Power that wont efect the walking zombies and named it Plant. You then upgrade this "building" to a tower.

2) I created 3 types of towers, and 3 types of zombies.
Tower1
Tower2
Tower3

Zombie1
Zombie2
Zombie3


3) I set the "target" and "targets as" to:
Tower1 - Target -> Ward
Tower2 - Target -> Ground
Tower3 - Target -> Neutral

Zombie1 - Target as -> Ward
Zombie2 - Target as -> Ground
Zombie3 - Target as -> Neutral


4) I then created 2 more types of Plant buildings.
Plant1 - Upgrades to Tower1
Plant2 - Upgrades to Tower2
Plant3 - Upgrades to Tower3


5) Then I set:
Lane1 - Has Plant1 and spawn zombies of type Zombie1
Lane2 - Has Plant2 and spawn zombies of type Zombie2
Lane3 - Has Plant3 and spawn zombies of type Zombie3
Lane4 - Has Plant1 and spawn zombies of type Zombie1
Lane5 - Has Plant2 and spawn zombies of type Zombie2



This worked out pretty good except that Tower2 doesn't target its type of Zombie. So i tried to set "Target" and "Target as" to diffrent but it still doesn't work.
pvz.png
Do you think this is solvable problem and will this solution work later on?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
how many players / lanes are in your game? because if possible i would really advice you to give each lane an own zombie owning player.
 

Sabretooth

New Member
Reaction score
0
how many players / lanes are in your game? because if possible i would really advice you to give each lane an own zombie owning player.

At the moment there's only 1 player. But once i get this thing going, there is going to be 2 playfields so 2 players can compete against each other.
So, 1 player for each gamefield.

Zombies that spawn are Neutral Hostile atm while i'm still testing, but is suposed to spawn for the other team later on.
Player1 - Playfield 1 - Zombies belongs to Player2
Player2 - Playfield 2 - Zombies belongs to Player1


Edit: Picture added to last post
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
then why you dont use player 3 for the zombies at player 1's lane and player 4 for the zombies at player 2's lane? then make player 1 and 4 allies and player 2 and 3. make your towers only able to attack enemys (not allies) and you are done. i dont see why you need those complex overkill systems for a thing as easy as this.
 

Sabretooth

New Member
Reaction score
0
I'm afraid i don't understand or that we are misunderstanding :eek:
I think that it might have worked if the zombies could choose what ever path they wanted.

This is my vision:
pvzwant.png


This is the problem:
pvzis.png


This is where I am atm (I feel that it is unnecessary to add other players yet, when all i need to to is to do is copy-paste when this is fixed):
pvzcurrent.png


And this is what i need help with to accomplish my vision:
pvzhelp.png



I'm sorry if i don't understand ^^ But i just want make sure (and show of my paint skills :cool:)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
well, look. if you just say that the zombies of each lane are owned by a particular computer player you can always know to which lane which zombie belongs.

more over, you could make each player allied with the zombie computer players which are NOT on his own lane.

furthermore you could make the towers only be able to attack enemy units, and no allies.

that means, the towers of each player could only target those zombies which are owned by an enemy computer. and because ALL computers exept ONE are allied with you it means that your towers can only target the zombies owned by ONE computer player. and that computer player is exactly that one which is spawning zombies on your lane.

that means its absolutely impossible that either your towers attack zombies at an other lane and that those zombies from an other lane attack your tower.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top