Screen jolt at tech jump

Screen jolt at tech jump

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Screen jolt at tech jump

Post by Caydr »

When you or your opponent jumps to tech level 2, there is a sudden jolt of the screen as the game suddenly lags for a second. I imagine this is caused by cacheing a bunch of new buildpics and unit-whatevers for all the new stuff that's now buildable. This doesn't only happen when a factory is built, but also when a construction unit is built which hasn't been built before. That last bit is important - it only happens the first time each player builds their tech level 2 lab, or tech level 2 constructor, or tech level 3 gantry, and so on. Even just level 1 construction units/factories do this.

Anyway, if you get it down to a science, it's probably quite easy to ascertain "where" your opponent is, tech-level speaking, but counting the number of jolts you experience. This is especially true in 1v1 games, where there is only one other possible person who might be jumping tech. Furthermore, it completely ruins the surprise factor that the first L2 units entering a battlefield can have.

This needs to be fixed very badly. I don't know how this sort of thing is handled by the engine, but it seems that it only caches data as it needs to, which makes sense, but if it is so easily detected as happening, it's a game-breaker.
User avatar
Masse
Damned Developer
Posts: 979
Joined: 15 Sep 2004, 18:56

Post by Masse »

maybe it should cache all the data at the loading ?
alik83
Posts: 82
Joined: 08 Sep 2004, 15:32

yes

Post by alik83 »

Yes, you're right about that, there are two things happening:
1)When someone builds any unit that hasn't been build before the screen kind of blinks for a moment.(but no noticable spike in activity with "b" debug view)
2)When a new unit is created there's a big spike in activity and maybe a little pause, but no screen blinking.
It would be nice to optimize the functions happening at 2) and also if it wouldn't take too much memory it would be ok to load all unit definitions in the beginning to eliminate 1) but all those things are pretty minor compared to other things that need to be done.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I wodner where all this stuff about loading build menus came from, from what i see in the UnitDef* structures that all this data is held in, the unit build menus are stored as a map<int,std::string> pair, and are loaded at gamestartup, so they're not causing the slowdowns.......
Chocapic
Posts: 556
Joined: 16 Oct 2005, 03:35

Post by Chocapic »

AF wrote:I wodner where all this stuff about loading build menus came from, from what i see in the UnitDef* structures that all this data is held in, the unit build menus are stored as a map<int,std::string> pair, and are loaded at gamestartup, so they're not causing the slowdowns.......
but prolly when you build a plant the unitdefs from the units the plant can build are then dinamicly loaded (they are not all loaded at startup, only loaded when needed)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

that isnt true either, the unitdef's are stored as an array UnitDef** by the engine, when the AI asks for one of these data structures providing a unit name or the id of that unit type the action done by the callback interface is equivilant to return unitdefs[unitid_thataiaskedfor], it isnt dynamically loaded, it's all loaded at startup when the unit is laoded and the game has yet to start, along with all the models and the map and pathfinding is calculated/loaded.

That and I do not believe that loading that data structure would causes the slowdowns that I've experienced in the past, maybe if it where loading 100+ units at once
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

When a unit is built, all the info for the units it can build is loaded upon the beginning of its construction. in CZTA, several units have bad/incorrect MoveCategories (mainly because I can't be bothered changing them), but the console warnings for this only appear upon their respective factories construction
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

In that case the untidef's containing a pointer to a movedata structure which details a unti movement class which does not exist.

It's not that the data is being laoded, it's that it's being used and cannot be found.
Chocapic
Posts: 556
Joined: 16 Oct 2005, 03:35

Post by Chocapic »

AF wrote:that isnt true either, the unitdef's are stored as an array UnitDef** by the engine, when the AI asks for one of these data structures providing a unit name or the id of that unit type the action done by the callback interface is equivilant to return unitdefs[unitid_thataiaskedfor], it isnt dynamically loaded, it's all loaded at startup when the unit is laoded and the game has yet to start, along with all the models and the map and pathfinding is calculated/loaded.

That and I do not believe that loading that data structure would causes the slowdowns that I've experienced in the past, maybe if it where loading 100+ units at once
you are wrong and zaphod told me so in the past.
Thats why loading the all the unitdef table at the start of my ai gives me an extra 10 seconds wait or so (in mods with a lot a units its even more!).
Because it only loads them when it needs them (goes to the fbi file a reads them and so).
Post Reply

Return to “Engine”