Change the heightmap without repathing

Change the heightmap without repathing

Requests for features in the spring code.

Moderator: Moderators

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7031
Joined: 16 Nov 2004, 13:08

Change the heightmap without repathing

Post by zwzsg »

I've been told heightmap changes are so slow because of the repathing.

I had those awesome ideas of fighting over an ever-changing ground, but sadly, this it not possible because even when:
- using the SetHeightMapFunc thing to speed thing
- changing only every 8 distance unit and every 3s
- only on the area of 4x4 map
The strain on the CPU is felt heavily.


So, if re-pathing is the bottleneck, I'd like an option to disable repathing when changing heightmap.

I have understood and agree that units might do stupid agree, but I don't care about that right now. First I want to play on smooth wave. Only at a later stage I'll come back to complain about how my terrain changes were not taken into account by units.

Quantum told me posting this picture would be a motivator:

Image
Last edited by zwzsg on 07 Apr 2009, 18:40, edited 1 time in total.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Change the heightmap without repathing

Post by Pxtl »

omgwtfbbq.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Change the heightmap without repathing

Post by Argh »

Yet another valid reason to tell the pathfinder to not choose the "efficient" route for a given unitID via Lua. +1
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Change the heightmap without repathing

Post by Auswaschbar »

Do not believe rumors. Do some profiling instead (or let someone do it for you).
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Change the heightmap without repathing

Post by Argh »

If the pathfinder's not the problem, then what is it then? There surely is a big hit when maps start getting deformed. Is it just the engine having to re-tessellate the heightfield?

If you're saying it's not very, very costly to do large-scale heightmap stuff, I don't buy that, specially not for something like zwzsg wants to do.

That's a lot of very heavy math there. IDK how he's supposed to make that work quickly enough for players even if the pathfinder isn't an issue at all. But I digress.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7031
Joined: 16 Nov 2004, 13:08

Re: Change the heightmap without repathing

Post by zwzsg »

Auswaschbar wrote:Do some profiling instead (or let someone do it for you).
I'm indeed looking for a profiler. Or at the minimum someone who can port me the existing profiling tool. Do you volunteer?
User avatar
Peet
Malcontent
Posts: 4382
Joined: 27 Feb 2006, 22:04

Re: Change the heightmap without repathing

Post by Peet »

Argh wrote:Is it just the engine having to re-tessellate the heightfield?
Your latest buzzword does not work for every situation...perhaps you should find a new one.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Change the heightmap without repathing

Post by Kloot »

I've been told heightmap changes are so slow because of the repathing.
There is much more that needs to be updated when the heightmap changes (the heightmap itself, the height _texture_, the normal-map, the slope-map, the terrain LOS states, unit positions, feature positions, ...), so you've not been told the full story.
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Change the heightmap without repathing

Post by Auswaschbar »

zwzsg wrote:
Auswaschbar wrote:Do some profiling instead (or let someone do it for you).
I'm indeed looking for a profiler. Or at the minimum someone who can port me the existing profiling tool. Do you volunteer?
  • compile spring with profiling information
  • run your test case
  • let gprof generate some tables
  • (mak nice graphs eventually)
  • profit
Or give me your wobbling widget.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7031
Joined: 16 Nov 2004, 13:08

Re: Change the heightmap without repathing

Post by zwzsg »

Actually, it's the mod as I whole that I'd like to profile. May I have a copy of a Win32 Spring.exe with profiling on and gprof?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Change the heightmap without repathing

Post by Argh »

Your latest buzzword does not work for every situation...perhaps you should find a new one.
But the warranty period hasn't expired yet?

Moreover, there is no short way to describe how a not-quite-done ROAM implementation (or whatever's being used for mesh decimation in SMF) works.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7031
Joined: 16 Nov 2004, 13:08

Re: Change the heightmap without repathing

Post by zwzsg »

Argh wrote:ROAM implementation
He found his new one, Peet! :wink:
Auswaschbar wrote:give me your wobbling widget.
Attachments
Analog_Wave.lua
(1.44 KiB) Downloaded 111 times
Last edited by zwzsg on 08 Apr 2009, 04:58, edited 1 time in total.
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Change the heightmap without repathing

Post by Auswaschbar »

Code: Select all

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls   s/call   s/call  name    
 34.84      8.38     8.38 85894454     0.00     0.00  streflop_libm::__ieee754_sqrtf(float)
 12.35     11.35     2.97  3896129     0.00     0.00  CBasicMapDamage::RecalcArea(int, int, int, int)
  7.86     13.24     1.89 34857289     0.00     0.00  CSmfReadMap::GetLightValue(int, int)
  6.82     14.88     1.64   130125     0.00     0.00  luaV_execute(lua_State*, int)
  2.29     15.43     0.55 40723693     0.00     0.00  luaV_gettable(lua_State*, lua_TValue const*, lua_TValue*, lua_TValue*)
See? Nothing even related to pathing in the top 5 CPU time consumer.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Change the heightmap without repathing

Post by Argh »

Code: Select all

12.35     11.35     2.97  3896129     0.00     0.00  CBasicMapDamage::RecalcArea(int, int, int, int)
Isn't MapDamage triggered any time a heightmap square changes at all?

And doesn't that feed back into the pathfinder every SlowUpdate?

Not that that would save this idea, which has to involve a ridiculous number of very complex calcs per frame.
User avatar
smoth
Posts: 22306
Joined: 13 Jan 2005, 00:46

Re: Change the heightmap without repathing

Post by smoth »

you are too fucking awesome zwzsg
User avatar
Jazcash
Posts: 5302
Joined: 08 Dec 2007, 17:39

Re: Change the heightmap without repathing

Post by Jazcash »

zwzsg wrote: Quantum told me posting this picture would be a motivator:
Image
Quantum. At 0.8MB/s. I hate you.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7031
Joined: 16 Nov 2004, 13:08

Re: Change the heightmap without repathing

Post by zwzsg »

Argh wrote:Not that that would save this idea, which has to involve a ridiculous number of very complex calcs per frame.
How so? Which "very complex calcs" are you talking about? The lua performing the 66049 sinuses does not cause any slow down, I tested. It's only when I use the Spring.LevelHeightMap instruction that it kills the CPU. What in the changing the heightmap cause slow down, I don't know, deciphering Auswaschbar's profiling result is too hard for me.
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Change the heightmap without repathing

Post by Auswaschbar »

simplified for zwzsg:
CPU hooks:
  1. map damage recalculation (dunno what it does)
  2. Lightmap calculation (for shadows and stuff I suppose)
  3. lua
BaNa
Posts: 1562
Joined: 09 Sep 2007, 21:05

Re: Change the heightmap without repathing

Post by BaNa »

Damn if this could be made to work properly we would be in for so much FUCKWIN it is not even funny.
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Re: Change the heightmap without repathing

Post by koshi »

Post Reply

Return to “Feature Requests”