You can save some space using double side layout, but this add complication to draw and specially for make - not impossible but much more difficult for DIY.
If size is issue, there option to use Shift Register board with CD4021B instead matrix, each handle 8 buttons connection, fo 32 buttons will be needed four.