• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Reduce lag with mass Unit Creation?

Status
Not open for further replies.
Level 18
Joined
Sep 2, 2005
Messages
1,029
OK. For one of my projects we need to spawn stuff all over the map. Like. They're diggable dirt tiles. They literally need to cover the whole map. that's 32400. I have reduced the models to a really low vert count (like 100), and shrunk the textures in an effort to save ram, but it still lags like all hell.

Presently they're neutral passive units. As units that means they store a whole bunch of crap we don't need, but if we make them destructibles would that really save much ram? and what would be the drawbacks? Does anyone have a 3rd optoin we could use?
 
Level 3
Joined
Aug 24, 2007
Messages
77
You could just make a dummy ability which can target the ground and then create the effects/deformations needed at the targeted area using triggers. Posting your idea would be VERY helpful...

P.S. welcome back grim
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Even if you use destructibles, 32400 is too much. But yes, destructibles tend to lag less then units.

Well, the lag was caused by something else...
For warcraft 3 standards, I'm on a pretty high end computer, and there's no longer any real lag for me. Well, I only tested how warcraft 3 runs with those 32k units, so I don't know what happens if any *real* units enter the map and start doing actual stuff...
I do realise 32k units is like... 32... thousand..., and it's probably a large burden, but I personally don't think we can do otherwise.
Generating them during the game is - in my opinion - no option, because I can't think of any "realistic" algorithm that creates those units on spots that are *about* to be seen, but not on spots that were digged already...

Since people hold me responsible for the digging system, I'm considering alternating it to work with destructibles anyway...
 
Maybe if you explain exactly what you are doing there is a smarter way to do it.

For example, import this artwork as a tile and cover the map when it, then have a ground-targetable ability. Handle everything else through code.

What about that? Best solution so far. And there is no "real" units. All units have all stats (well heroes take much more memory though). My wc3 lags after 2000 of the units are on the map.
 
Level 18
Joined
Sep 2, 2005
Messages
1,029
they're dirt walls that are being dug into tunnels, so using an image won't work. And you can select more than one, it won't use wc3 selection. like, you select it, it adds itself to an array, then reselects the only unit you can "select" like .1 seconds after.

If I made it tiles then it would have an unchangable height. Height needs to be able to go down to floor level when dug. (effectively like destroying walls).



hrmmm.


I may have found a solution to this problem by using tiles and then generating the dirt/gold based on how close to the tile they are. that way it won't likely have to load more than 100.
 
Level 3
Joined
Aug 24, 2007
Messages
77
I don't really get your idea but if you tried my idea (selecting the ground with an ability will created the needed deformation, eg down one, up one, ramp, ect) and then have another ability which creates roof tiles this would be very efficient, easy to implement, quick to implement and very userfriendly

Edit: If you want I could make a demo of my system for you.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Preloading them would reduce for some
kinda Game - Preload (Map initialization = more loading time, Time Expired 0 seconds = lag on map start)
but not for that much units
 
Level 18
Joined
Sep 2, 2005
Messages
1,029
I don't really get your idea but if you tried my idea (selecting the ground with an ability will created the needed deformation, eg down one, up one, ramp, ect) and then have another ability which creates roof tiles this would be very efficient, easy to implement, quick to implement and very userfriendly

Edit: If you want I could make a demo of my system for you.

I'd like to see it, I'm not sure how it would help, but maybe it would.

My idea is you dig tunnels out of rock and dirt walls. Like in the game dungeon keeper.
 
Level 18
Joined
Sep 2, 2005
Messages
1,029
Well I created the map generate system(Eleandor polished it) and it seems to work pretty much something I would call "ok" because I use a very good, fast and stable computer.

I have a gig and a half of ram and a decent processor and it was lagging for me. and my computer is only a year old. Maybe there's a new version I haven't tried yet. The one I tried the dirt took like a minute to load, and then when you moved your mouse, every 10 seconds or so it would pause for 2 seconds due to lag.
 
Level 18
Joined
Sep 2, 2005
Messages
1,029
I know you can rais and lower terrain but I dunno about cliffs.

Oh. I believe we have a solution to this problem. Instead of initializing all the units at map creation (we decided on units because our other scripts would have a hard time working with destructibles), We're going to make a multidimensional integer array which stores values for all the squares on the grid, and then places the units as necessary (when a tile is dug) on the grid, instead of all at once - to save ram.
 
Last edited:
Level 11
Joined
Aug 25, 2006
Messages
971
Ok the idea to lower terrain is smart. This is what I would do. When a player casts an ability at the place you want them to 'dig' the terrain would be lowered. (Not by one large deformation, but by a bunch of mini deformations to make a good almost flat bottom) Then create (invisible) units at the edges of the place which has been 'dug out'. This prevents units from moving over the edges. When a unit digs a location out, remove all walls in the 'dug out' location so the unit can walk through. Not only does this look good, its much smarter then a bunch of destructables.
 
Level 18
Joined
Sep 2, 2005
Messages
1,029
Ok the idea to lower terrain is smart. This is what I would do. When a player casts an ability at the place you want them to 'dig' the terrain would be lowered. (Not by one large deformation, but by a bunch of mini deformations to make a good almost flat bottom) Then create (invisible) units at the edges of the place which has been 'dug out'. This prevents units from moving over the edges. When a unit digs a location out, remove all walls in the 'dug out' location so the unit can walk through. Not only does this look good, its much smarter then a bunch of destructables.

Nifty Idea. I'll run it by the rest of the crew and see what they have to say.
 
Status
Not open for further replies.
Top