boyserk84 / zombie-real-time-strategy-game

Automatically exported from code.google.com/p/zombie-real-time-strategy-game
0 stars 0 forks source link

MapViewComposite not optimized #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This bug is in branches/marc.celani.

Although the map view is now virtualized, and can handle any size map, it is 
still (manageably) slow on scrolling, (manageably) slow on creating a first 
map, and (unmanageably) slow on creating a map when a scenario is currently in 
context.

What steps will reproduce the problem?
1. Create a 255x255 map.
2. Scroll
3. Notice that every time new cells are entered, there is a delay.
4. Create a second 255x255 map.

What is the expected output? What do you see instead?
Smooth scrolling, even if the UI doesn't appear immediately.  Creating the 
second scenario should take as long as the first.

Possible ways to improve:  

1.  TileUIs need to be disposed in order to release their hold on the cell that 
they are keeping track of, release the handle held by the view for drag drop 
(This will be a separate issue), and unregister from the cell events.  It may 
be possible that this disposal could happen on a background thread.  Instead of 
disposing all of the controls in the UI thread, its possible that we could 
remove them, add them to a separate list, and pass that list to the background 
thread that will dispose them.  Improving on this will improve on the second 
test case listed above.
2.  Find a way to improve the adding of TileUI pieces to the UI.  Research ways 
to optimize how to add controls to the UI.  The panel is already suspending its 
layout, which improves the time, but it is still slow.
3.  Creating/Adding UI on a background thread appears to be out - ui can only 
be added as a child Control if you are adding it on the same thread that 
created that piece of UI.  Because of this, we cannot create ui on a background 
thread - we would never be able to add ui to it.  We cannot add the tiles to 
the ui on the background thread either.  Unless you can research a way around 
this.

This probably needs profiling to determine exactly what is slow.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by marc.cel...@gmail.com on 20 Mar 2011 at 6:45

GoogleCodeExporter commented 9 years ago
See r146.

Original comment by marc.cel...@gmail.com on 21 Mar 2011 at 1:20