-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactoring]: Split up ZoneRenderer to enable an easier transition to other rendering implementation #3691
Comments
Currently my GdxRenderer lives on Top of the ZoneRenderer. It delegates Stuff to the ZoneRender. ZoneRenderer skips drawing when GdxRenderer is visible. I also would like to see that split. But hopefully after the experimental renderer is merged ;) My gdx-Renderer is currently stuctured like the ZoneRenderer. I would rather not have to rewrite it completely. It nearly works now. (Lights have problems still). If you like feel free to pull my feature-gdx branch. Any help is very much welcomed. I think the renderers should only render the zone. Macros and everything should work even if you use a DummyRenderer that does nothing. I would also like to have only one instance of the "ZoneManager" oder "ZoneEngine" class if possible. Not sure if macros need it for every possible Zone. I also would like to see the drawing code of various Grids and Drawables separated. |
For 3 I think an interface to notify the renderer that it should rerender + changes for scale etc should suffice IMO. |
Sorry I kind of left this, life got in the way and then I didn't have time for such a big change like this.
I would say before the merge, or as part of it. There's a lot of duplicated logic between the two, and (as someone who touches vision now and then) I don't want to have to make sure the two stay in sync.
This is very well put. I agree that there should be a separate decision-making component that decides things like token visibility, etc., and that should be independent of the renderer itself. Focusing on that will help a lot while being way simpler than my layered proposal (that can be done in the future if at all). I'm going to try put a change together that splits the current |
I'm going to have a go at this at a very basic level. This is the plan.
|
Seems some graphics settings are not being consistently applied to the notes at the top (e.g., "Map not visible to players"). On a new empty campaign: Bisected to 4938b03 |
Narrowed that down to whether a label is present on the map. A blank campaign is fine, but add one label and the rendering gets messy. I think this is a bug with some caching in |
Having a look at pulling out |
https://discord.com/channels/296230822262865920/494598206626463755/1184546002728914954 If we generate the path area like this it can be used elsewhere. |
Describe the problem
The
ZoneRenderer
class is both large and too interconnected with itself. Making changes to it is always risky as it's not clear which parts of theZoneRenderer
will be affected and which will not. On top of that, large and fundamental changes such as moving to different renderers (e.g., libGDX) are particularly difficult, at least not without duplicating core logic and bringing associated clutter.The improvement you'd like to see
I'd like to see the
ZoneRenderer
broken down into parts that can work together but are much more managable.ZoneRenderer#paintComponent()
/ZoneRenderer::renderZone()
is split up into separate render layers.ZoneRenderer
has less state.ZoneRenderer
would have much less logic in it, and the rendering operation would be simplified to drawing each render layer in turn.ZoneRenderer
s nature as a Swing component is removed. Instead, theZoneRenderer
can expose a reference to some Swing component, but which component is determined by something other than theZoneRenderer
.ZoneRenderer
would only be responsible for providing an interface to the visible zone, while the Swing components would be responsible for effecting renders.Graphics2D
, while a libGDX implementation could do whatever it needed to do.Graphics2D
or any libGDX stuff.Grid#draw()
andGrid#drawCoordinatesOverlay()
and instead make that the responsibility of a render layer.The end result (if all my ducks are in a row) is that:
ZoneRenderer
defines some core logic, such as what order to render things in, what actually needs to be rendered, etc.Expected Benefits
The main benefit, regardless of a move to libGDX or anything else, is that the
ZoneRenderer
will be more manageable. This is mainly offered by point (1) above, but the other points could also help with that.The secondary benefit is that it would be relatively easy to add a libGDX renderer:
ZoneRenderer
.Additional Context
This refactoring suggestion is motivated by the hope of achieving a libGDX renderer as in #3468.
The text was updated successfully, but these errors were encountered: