axx0/Civ2-clone

Unit shields

Closed this issue · 11 comments

Currently the units have no shields, this should be interface dependent since they are different in civ2 and TOT. Perhaps some sort of GetUnitTexture method on the active interface

Unit shields should be displayed correctly, but only for civ2. I'll try to set it up for TOT but I'm having trouble testing it since that interface is understandably throwing a bunch of errors when trying to run it.

Are you still working on the TOT shields?
I was starting on the supported units view for cities and these areas overlap. If you're working here I'll hold off and find something else to look into.

axx0 commented

Go ahead. I was planning to but I'm bogged down by TOT load and new game logic stuff.

I've merge my changes in this area, we should probably move the actual shield image code to the interface so we can implement differently for TOT and MPG.

axx0 commented

There's the part for reading shields in UnitLoader and there's the part for drawing them.
So both should be separate methods in the TOT and MGE interfaces?
Ok, I'll see what I can do since this part is actually preventing me from loading TOT games.

Yes since TOT doesn't care about flag locations etc I think these need to be seperate

axx0 commented

I've managed to get TOT shields working.
A couple of things left to do: draw TOT shields on top of units (unlike mge) and shield colouring (it's not as simple as in mge).

Question - I left GetUnitTextures method in RaylibUI and haven't moved it to interfaces. I can do this but it would require referencing RaylibUI in interfaces. Do we want to do this or in general try not to put UI into Core/Interfaces, so they only communicate through Model?
I hope you understand what I mean.

I think the question has to be how generic GetUnitTextures is, Is it something a hard code modder would want to implement a different version of in order to support some really funny civ variant(Such as Call To Power) or is it a core part of the render pipeline?

I think there is very little chance anyone would ever need to mod GetUnitTextures beyond the flexibility you've just introduced. It's probably fine to leave it in the RaylibUI.

I definitely want to keep UI stuff out of core at some point I'd like to implement multiplayer via a pitboss server.

It would probably be okay to reference RaylibUI from an interface although I think that would be a code smell so we should probably avoid it.

axx0 commented

There's a general dissatisfaction the way shields are implemented in TOT. For instance you can't easily change the colours of front/back shields since the game automatically darkens them.

I'll try to refine what I did by enabling as many parameters to be changed in the interface. For instance whether the shields should be rendered in front or in back of unit, etc. But the GetUnitTextures will be in the UI and communicate with the interface only through Model parameters.

And in the future I'll try to keep Raylib_cs & RaylibUI out of interfaces (if it's possible).

I think Raylib_cs is probably okay in interfaces some things need to be drawn interface specific, but it's better to define params and draw in UI as it will make it more reusable and modable

axx0 commented

Ok, that's what I did, shield drawing params can be easily changed in the interface now, the drawing itself is done only in UI.

Shield drawing is now done.