HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Best way to do this?

08-26-2009, 01:52 PM#1
Tastingo
I was just wondering the best way on how to do a custom projectile. At most on my map there will be 12 projectiles, one for each player.

Right now I have 2 periodic timers that go off every .01 seconds. One moves all the projectiles by using a loop and an array that holds the units/projectiles. The other uses a loop within a loop checking the distance between the projectile and the 12 other units that are not projectiles. I don't think I have a leak because I'm not using any type of location or etc, but because of the loops and a periodic timer.

Could anyone please help me?
08-26-2009, 02:21 PM#2
Anachron
Why not using a single timer and check them before moving?

A bad question but anyway: Are you triggering attacks?
08-26-2009, 02:29 PM#3
Tastingo
I did do that, but it would call a death function that would have a PolledWait2 on it. This would result in it getting messed up. But I will try it again. What do you mean by triggering attacks?
08-26-2009, 02:50 PM#4
Anachron
No, don't use polled waits.

Instead add a real to the struct (real, waittime) and decrease it everytime a timer is called. If time == 0 then destroy.
08-26-2009, 03:03 PM#5
Tastingo
Lol the only problem is that I have not learned VJass yet. Figured I would learn it after this though.
08-26-2009, 03:06 PM#6
Anachron
Lol, I thought you are using a vJASS struct to check the missles? :S
If you want I could make the engine for you.
08-26-2009, 03:39 PM#7
Viikuna-
Quote:
every .01 seconds

For projectiles you should use .025 or .03 second period. .01 is unnecessary fast.
08-26-2009, 06:04 PM#8
Themerion
Quote:
Instead add a real to the struct (real, waittime) and decrease it everytime a timer is called. If time == 0 then destroy.
Quote:
Lol the only problem is that I have not learned VJass yet. Figured I would learn it after this though.

You keep an array(12) for units. Make another array(12) for wait before death-time.
08-26-2009, 08:05 PM#9
Karawasa
Quote:
Originally Posted by Viikuna-
For projectiles you should use .025 or .03 second period. .01 is unnecessary fast.

That depends on the application. I'd argue that those should be minimum values, and if you have a lot of instances consider going up to 0.05 or even 0.07.

Did you say 12 at one time is possible? I'd go with 0.05.

If you're planning on learning vJASS, just do it now. It will make this a lot easier, since then you can use xe if you want (or do it yourself, either is easier than GUI).
08-28-2009, 06:46 AM#10
Viikuna-
12 projectiles aint that much.., but yea, it depends on many factors indeed.
08-28-2009, 12:37 PM#11
Anitarf
Quote:
Originally Posted by Karawasa
That depends on the application. I'd argue that those should be minimum values, and if you have a lot of instances consider going up to 0.05 or even 0.07.
I've never had a situation where 0.02 would be a problem. Also, 0.05 looks like crap. 0.07 is just batshit insane.

Quote:
Did you say 12 at one time is possible? I'd go with 0.05.
Are you serious? 12? You can run a hundred projectiles on 0.025 easily.
08-29-2009, 04:37 AM#12
Tastingo
Well, I'm running with .05 right now, and it actually looks just as great. But thanks for all the help :).
08-29-2009, 07:47 AM#13
Karawasa
Quote:
Originally Posted by Anitarf
I've never had a situation where 0.02 would be a problem. Also, 0.05 looks like crap. 0.07 is just batshit insane.

You're just talking without having tested it. I have tested it.

Quote:
Originally Posted by Anitarf
Are you serious? 12? You can run a hundred projectiles on 0.025 easily.

Is this supposed to be some kind of joke? Perhaps if absolutely nothing else is going on, but even then I wouldn't believe it without a demo.

Quote:
Originally Posted by Tastingo
Well, I'm running with .05 right now, and it actually looks just as great. But thanks for all the help :).

Smart man, glad it worked out for you.
08-29-2009, 10:35 AM#14
Anitarf
Yes, it will depend on hardware. A computer that barely meets the minimum WC3 requirements will have issues, but such a computer would also have issues with a 3v3 melee game. My experience comes from running the game on a P4 2.8, sure it considerably exceeds WC3 requirements but it's also considerably slower than most modern hardware.

The xecollider comparison is unfair, since it was designed for usability, not speed. If you need to run a hundred projectiles, you write a dedicated engine. It's a moot point in this case anyway since you could easily run 12 projectiles even with xecollider on any processor with more than one GHz.

I really do know what I'm talking about because I've done stress tests before. 100 projectiles may be an extreme case that's possible only under ideal conditions (simple projectiles, dedicated engine, not much else going on in the map), but 12 projectiles definitely doesn't require a 0.07 timer.
08-29-2009, 03:55 PM#15
Karawasa
Quote:
Originally Posted by Anitarf
I really do know what I'm talking about because I've done stress tests before. 100 projectiles may be an extreme case that's possible only under ideal conditions (simple projectiles, dedicated engine, not much else going on in the map), but 12 projectiles definitely doesn't require a 0.07 timer.

Who said anything about a 0.07 timer for that scenario? Please re-read my post. Also, if your 100 projectile quote is only for the most unrealistic conditions then why do we care?