Author Topic: 2x2 unit drawing glitch (OXC and OXCE)  (Read 5340 times)

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
2x2 unit drawing glitch (OXC and OXCE)
« on: January 07, 2018, 11:32:40 pm »
EDIT: issue is also open on github: https://github.com/OpenXcom/OpenXcom/issues/1242

edit: I'm using OXCE+ but I dunno if this is OXCE+ specific.
I'll try to test it on OXC as soon as I can.

My 2x2 unit graphics "traverses" the north wall when it moves adjacent to it.
It happens during motion, a couple of frames of the animation are partially visualized inside the wall, see attachment.
The weird thing is it doesn't happen with the west wall, yet the animation is exactly the same (just reflected on the vertical axis; but I used Falko's online tool to crop the spritesheet, maybe it crop is not 100% precise? it looks precise though).
« Last Edit: February 12, 2023, 04:47:29 pm by Meridian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3346
    • View Profile
Re: visual issue (actually using OXCE+, but..)
« Reply #1 on: January 08, 2018, 02:08:46 am »
This is caused by draw order, if you change graphic you can only reduce this effect.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: visual issue (actually using OXCE+, but..)
« Reply #2 on: January 09, 2018, 08:25:58 am »
I've been seeing weird visual glitches like this in tanks ever since I switched to OXCE+.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3346
    • View Profile
Re: visual issue (actually using OXCE+, but..)
« Reply #3 on: January 10, 2018, 02:41:02 am »
I've been seeing weird visual glitches like this in tanks ever since I switched to OXCE+.
on same mod? This part should works same in OXC, OXCE and OXCE+, at least I do not remember changing draw order.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: visual issue (actually using OXCE+, but..)
« Reply #4 on: January 10, 2018, 08:14:28 am »
What I experienced was not quite the same. When I move tanks sometimes they suddenly have a graphical glitch while moving, then it goes away when they stop. It's not a draw order bug, it's part of the tank's graphic shifting upward.

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: visual issue
« Reply #5 on: January 14, 2018, 01:31:01 pm »
Alright I've tested a bit.
The issue with the 2x2 units graphics clipping the wall seems to happen on specific conditions:
- north wall only;
- both when the units moves west to east and east to west;
- presence of an object type mcd in the in the tile immediately before after (depending on the motion direction) the tile containing the affected wall.
The latter is a bit hard to explain.
I've attached a screenshot. If the unit moves west to east the clipping happens at point "I"; if the unit moves the opposite direction, the clipping  happens on point "II".

The clipping happens with both my custom unit and vanilla tank.
It also happens both on vanilla OXC and OXCE+.

« Last Edit: January 15, 2018, 09:56:23 pm by robin »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3346
    • View Profile
Re: visual issue
« Reply #6 on: January 15, 2018, 09:53:55 pm »
The clipping happens with both my custom unit and vanilla tank.
It also happens both on vanilla OXC and OXCE+.
This confirm my suspicion, this is draw order glitch. Hard part is that we need draw something like impossible perspective because we draw flat surface that try represents objects in 3d space. Especially this happens if things move around.

Probably easiest solution is split surface in halfs and draw them independently (right now in some move cycles we draw only half of sprite).