Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

How to use altercollision tiles

Share questions and tutorials related to the map editor. Share you maps in the Superfighters Deluxe Custom Maps section.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
Posts: 84
Joined: Sat Mar 19, 2016 12:55 pm
Title: Jarate Yellow Belt
Started SFD: PreAlpha 1.1.4
Location: France

How to use altercollision tiles

Post by gwendalaze » Thu Aug 25, 2016 5:39 pm

Some people asked for help on discord, so here I go.

I'm going to speak about maskbytes, categorybytes and abovebytes. The disable collision between objects thing and disabling melee hits and shot collision is really straightforward anyway.

Those will allow you to change the behavior of tiles : You can disable collisions between a player and a crate for example.


1) Learn how hexadecimal works

to make it simple, Hexadecimal is a way to translate easily long binary numbers into short numbers.
Digits in hexadecimal range from 0 to F, as digits in decimal (normal numbers) range from 0 to 9.
Digits in binary range from 0 to 1 and are called bytes.

Those digits, and their translation in binary are :

0000 : 0 | 1000 : 8
0001 : 1 | 1001 : 9
0010 : 2 | 1010 : A
0011 : 3 | 1011 : B
0100 : 4 | 1100 : C
0101 : 5 | 1101 : D
0110 : 6 | 1110 : E
0111 : 7 | 1111 : F

Altercollisiontiles use four-digit hexadecimal numbers, ranging from 0000 to FFFF

2) Check the binaries

go to C:\Program Files (x86)\Superfighters Deluxe\Content\Data\Tiles\collisionGroups
open the .sfdx in your notepad

Those are the binary values for the maskbytes, categorybytes and abovebytes of different items.
In our example, we want to disable the collision between players and a crate.

Take note of the maskbytes and categorybytes of the player and of the crates

3) Disable the collision

When do collide two different objects ?
they collide when one byte in the categorybyte of the first object is to 1 while the same byte of the maskbytes of the second object is to 1.
Note that it apply reversally, with categorybytes from the second object and maskbytes from the first object

for coders out there, the method is bool collision = (filterA.maskBits & filterB.categoryBits) != 0 &&(filterA.categoryBits & filterB.maskBits) != 0;

So, what do we do ?
First, check the categorybytes of the crate(dynamic_g1) :
0000 0000 0000 1000
as you can see, the fourth byte (starting from right) is 1; meaning that if the player's fourth maskbyte is at 1 too, then there will be a collision.

The player's maskbytes are :
0000 0000 0000 1011
the player's fourth maskbyte equals 1, that mean that players collide with crates.

As you may have noticed, altercollisiontiles disable category and mask bytes
so, if we want to make so that the crate can't hit players, we will have to either
- disable players fourth maskbyte
- disable crate's fourth categorybyte

It's easier to handle the crate, then we will go for the second solution

link your atlercollisiontile to the crate, and disable the bytes you want to disable.
for instance, you want to disable the fourth byte of the crate's categorybytes
that translate to 0000 0000 0000 1000 in binary

But, since altercollisiontiles use hexadecimal rather than binary, you have to translate the binary number into a hexadecimal one :
0000 0000 0000 1000 in binary = 0008 in hexadecimal,
since 0000 : 0 and 1000 : 8

Now write 0008 into the 'disable categorybytes' section of the altercollision tile

However, your crate still collide wih players.
Why ?

check the categorybytes of players :
0000 0000 0000 0100
and maskbytes of crates(dynamic_g1) :
1111 1111 1110 1111

can you see it ?
Third bytes on both number are set to 1.
Thus, we want to set to 0 the third (and only the third) byte on the crate's maskbytes :
0000 0000 0000 0100
that translate in hex to 0006
now, put it in the 'disable maskbytes' section

et voilà ! You cannot collide with the crate anymore !

4) Summarizing

You will have to do these few steps to disable the collision between two objects :
  • Check and take note of the categorybytes and maskbytes of both object
  • Find the conflicting bytes in first object's categorybytes and second object's maskbytes
  • Disable the category byte(s) of the object that is easier to manipulate according to the previous step
  • Repeat : Disable the maskbyte(s) of the same object, depending of conflicting bytes between first object's maskbytes and second objectt's category bytes
  • gg ez
5) Bonus

Here are some tips :
  • In the .sfdx file, there are listed the position of the category bytes of the different type of objects;
  • If you are too lazy to check, and only manipulate objects from the same type, you can just write FFFF in the disable categorybyte section
  • Abovebytes act the same way as maskbytes, but they only come in action when an object land ON THE TOP of another one. That allows small objects and debris to pass under covers such as crates and barrels.
  • You can only disable collisions, not enable them. Think about it before trying something.
6 x
- Gwendalaze, failing at being fun, just like this signature

User avatar
Posts: 271
Joined: Mon May 09, 2016 7:35 am
Title: Superfighter Royale
SFD Account: Motto73
SFD Alias: Motto73, Pack-Man!
Started SFD: Multiplayer Test Demo
Location: Sunny City
Age: 18

Post by Motto73 » Fri Aug 26, 2016 7:39 am

Wow Gwen, thank you! This is very helpful!
0 x

User avatar
Lead Programmer
Lead Programmer
Posts: 1018
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Age: 28

Post by Gurt » Fri Aug 26, 2016 8:52 pm

For info:
No support today to enable bits. You can only disable them. Might be some future thing to complement the disableAlterCollisionTile.
2 x

User avatar
Posts: 271
Joined: Mon May 09, 2016 7:35 am
Title: Superfighter Royale
SFD Account: Motto73
SFD Alias: Motto73, Pack-Man!
Started SFD: Multiplayer Test Demo
Location: Sunny City
Age: 18

Post by Motto73 » Tue Apr 24, 2018 6:55 pm

Bumping into an old thread, but having an important question: How do we know which layers are the objects on? If we make a static tile dynamic is it in dynamics_g1 or dynamics_g2 or like is it still in static_ground?
1 x

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest