Page 1 of 1

BEP-mod grafic tank problem

Posted: Tue Nov 15, 2016 2:56 pm
by BlackEagles
BEP-mod grafic tank problem

Hello Community, we have a problem with our mod and need help. We work since a year now on our Projekt. We try to expand the game with some warfare things like tanks and miniguns. But we have problems with the massive artwork bundle we would like to make. So here is one of the main problems:

The tank spin arround proberly but the tower isnt in the right place and i dont know what to do. All Sprites are taken from models. turret and base, hase both 64 pictures and all are cutten of by us and put to gehter with a web sprite sheet maker.

Here the problem pictures:
http://steamcommunity.com/sharedfiles/f ... =800263048
http://steamcommunity.com/sharedfiles/f ... =800263112
http://steamcommunity.com/sharedfiles/f ... =800263179
http://steamcommunity.com/sharedfiles/f ... =800263257

Download Code:
http://www.mediafire.com/file/3mo8neuaz ... 4.0.12.rar
Download Modpack to play and test
http://www.mediafire.com/file/rttj8uuaenuudm3/mods.rar

There is a problem at BEP>prototypes>entity>tank.lua [--panzer-3--]
pictures you will find under grafics>entity>tanks

Can you help us with some hints?
SIrWillam, from Black Eagles

Re: BEP-mod grafic tank problem

Posted: Tue Nov 15, 2016 4:27 pm
by aubergine18
Uploading mod to github would make it lots easier for people to see what's actually going on.

Re: BEP-mod grafic tank problem

Posted: Tue Nov 15, 2016 5:12 pm
by Arch666Angel
Moving entities are a bit fiddly, make sure that you rotate the sprite around the center of the frame. Then there is a "shift" value for each "turret_animation" layer which will position the sprite in relation to the"selection_box".

Re: BEP-mod grafic tank problem

Posted: Tue Nov 15, 2016 6:01 pm
by BlackEagles
aubergine18 wrote:Uploading mod to github would make it lots easier for people to see what's actually going on.
I try to uploud it tommorow.

Re: BEP-mod grafic tank problem

Posted: Tue Nov 15, 2016 6:02 pm
by BlackEagles
Arch666Angel wrote:Moving entities are a bit fiddly, make sure that you rotate the sprite around the center of the frame. Then there is a "shift" value for each "turret_animation" layer which will position the sprite in relation to the"selection_box".
I use the shift command but it seem that the pictures within the animation are not all at the same center. But that is not possible, because the object lay the whole time at the same point.

Re: BEP-mod grafic tank problem

Posted: Tue Nov 15, 2016 6:06 pm
by Arch666Angel
If the turret is wobbling around when you drive in a circle with the tank, then the turret is not centered on the entity. Position the car/tank in the initial position = facing north and shift the turret up/down to see which direction the wobbling gets less. shift = {0, 0.5} would move the center of the sprite half a tile downwards, shift = {0, -0.5} half a tile upwards.

Re: BEP-mod grafic tank problem

Posted: Tue Nov 15, 2016 6:21 pm
by aubergine18
Remember that the grid within tiles has a maximum resolution of 32 px / 256, so it will always snap to increments of 0.003921568627451 (or 0 if less than that number). (source)

Re: BEP-mod grafic tank problem

Posted: Tue Nov 15, 2016 6:44 pm
by Arch666Angel
Could you post a single frame of the turret sprite?

Re: BEP-mod grafic tank problem

Posted: Tue Nov 15, 2016 11:55 pm
by BlackEagles
Arch666Angel wrote:Could you post a single frame of the turret sprite?
It is uploading right now. The Mod-PAck we use to play the tank and show his error.
And only BEP-mod with the code for debbuging ;)

Re: BEP-mod grafic tank problem

Posted: Wed Nov 16, 2016 12:07 am
by BlackEagles
http://www.mediafire.com/file/3mo8neuaz ... 4.0.12.rar
http://www.mediafire.com/file/rttj8uuaenuudm3/mods.rar

There is a problem at BEP>prototypes>entity>tank.lua [--panzer-3--]
pictures you will find under grafics>entity>tanks

Re: BEP-mod grafic tank problem

Posted: Wed Nov 16, 2016 7:23 am
by Arch666Angel
The red dot indicates the middle of the frame, the blue dot the (eyeballed) rotation point of the turret. They should best be on top of each other, so either you shift the picture ingame or go to your picture editor and move the sprite over.

Two other things, even if this produces bigger frames with empty pixels: It's much easier to deal with these if you size the frames to a multiple of 32/16 so in your example I would have chosen a size of 96 width and 80 height. Another thing is that in my experience you need some space between the last non empty pixel and the border of the frame, because factorio wont draw them. 16px is enough in some cases, I make most frames with a 32 pix empty border to be save.

Resized the picture to 200%:
single-frame.png
single-frame.png (7.6 KiB) Viewed 5347 times

Here is an example from one of my renders, the blue dot is the rotation point for the turret and also the center of the frame.
heavy-tank-turret-example.png
heavy-tank-turret-example.png (14.5 KiB) Viewed 5346 times

Re: BEP-mod grafic tank problem

Posted: Wed Nov 16, 2016 10:49 am
by BlackEagles
Hey thank you. That is an excelent anwser, but how you make the blue and red dot? I need this tool too ^^

Re: BEP-mod grafic tank problem

Posted: Sun Dec 04, 2016 10:27 pm
by aubergine18
@Arch666Angel - with the transparent border autocropping that factorio does, have you noticed any variance in entity orientation?

When I was working with the wooden bridge sprites, the horizontal ones always worked fine... however the vertical ones would be cropped in strange ways and I often had to manually shrink down the transparent borders manually in the png images to prevent that from happening.

Re: BEP-mod grafic tank problem

Posted: Mon Dec 05, 2016 1:14 am
by Arch666Angel
aubergine18 wrote:@Arch666Angel - with the transparent border autocropping that factorio does, have you noticed any variance in entity orientation?

When I was working with the wooden bridge sprites, the horizontal ones always worked fine... however the vertical ones would be cropped in strange ways and I often had to manually shrink down the transparent borders manually in the png images to prevent that from happening.
I usually make the transparent frame bigger if factorio crops the images, in most cases this fixes the problem. But there seem to be entity related restriction on how big a frame/sprite can be. For example an assembler can be almost any size you want, where a loader entity will be cropped if it is outside of the 2x1 area. So yeah your observation might be correct and it is an issue related to entities using orientation.