Monday, December 26, 2011

Unity flash in a flash compo - challenge declined

Thanks to some guy on Ludum Dare I found out about Unity Flash in a Flash contest. I immediately thought, hey, them 20k dollarz would be nize! So I downloaded new 3.5 preview of Unity and started brainstorming. After sorting through few quite good ideas (which I thought I have chance to put together in two weeks and which could make pretty good and/or interesting game in the end) I fired up Unity and started checking the flash export...
At first I tried to export TMDR I made last week for Ludum Dare... and found out that flash export isn't going to be easy at all. A lot of stuff doesn't even compile (I was afraid that reflection wouldn't work, but some stuff from generic collection is missing too (Queue doesn't exist at all, for some strange reason Dictionary doesn't have Count defined...).
I ripped offending pieces from code and recompiled... It works! Well, sort of and very slowly... but it hangs after few seconds...

After some tests and attempts to start directly on a prototype for "A different shade of gray" (my favorite brainstorm child for compo) I found out that character controllers are the culprit. Having more then one in a very simple scene will kill framerate (like totally) usually in few seconds. Extremely simple scene (few boxes),  few char colliders means few seconds of existence. Seems physx rewritten in action script is not very stable beast. Strangely Angrybots (unity showcase/demo project) works even with (i think) char controllers... my guess is they debugged and fixed flash export just enough so angrybotz work.

This was pretty big discouragement. I've made few attempts to find out if I could maybe fix this... after I made a VERY simple script which just spawns more char controllers on mouse click... I found out that after few spawns (using Instantiate from prefab) flash build hangs with just red "Null pointer!" written in the corner.
Few more attempts to play with other stuff showed similar results... what works in unity might work in flash... for a while probably. And debugging using debug.log (which is usually only way to do some debugging in unity thanks to great stability of monodevelop) is even slower then normal because you have to wait for a long time for flash build...
So no fancy 3d gameplay? I thought about going back to another idea and doing mostly 2d game, but if you want to make 2d games, working directly in a flash is better idea then hacking unity to do it too.
Anyway I have my doubts about usefulness of flash export at all - flash is slowly declining after Steve Jobs said it's bad (one of the few things I ever agreed with him), unity web plugin has quite big penetration and it's rising (and whatever you do in unity, it will run much better / faster in unity web then in flash since action script was never fast and never will be).

So in the end it seems that flash in a flash is more of betatesting/hoping and praying coding compo then game compo... And I decided to decline this challenge. Going to lan party like every year and have some fun playing games instead of trying to make them.

My guess is that winner of this compo would be either someone insanely lucky / patient who puts together some nice game, or someone with a lot of nice 3d graphics without any gameplay :/



1 comment:

  1. "The file 'none' is corrupted!" - what a great error message!

    ReplyDelete