2D Toolkit Forum

2D Toolkit => Support => Topic started by: Jefemcownage on July 20, 2012, 09:37:23 pm

Title: MultiPlatform Toolkit integration
Post by: Jefemcownage on July 20, 2012, 09:37:23 pm
Has anyone had any experience integrating 2D toolkit into the multiplatform toolkit (http://smuggletruck.com/multiplatform/). If not how are people handling multiplatform with 2d toolkit?

Thanks!
Title: Re: MultiPlatform Toolkit integration
Post by: Jefemcownage on July 21, 2012, 06:28:03 pm
Any thoughts from the dev on this?
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on July 21, 2012, 08:01:01 pm
Haven't had the time to write my thoughts down. I will do sometime soon.
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on July 22, 2012, 10:11:09 am
I haven't used multiplatform toolkit, but it is clearly very capable as they did SmuggleTruck and that works on many platforms (really well I might add). From the preview videos their approach lets you do a LOT, i.e. reposition, rescale things, use different atlases for different platforms, etc. Having not used it, I can't really say much more about it which you can't learn from the videos, etc.

What I can talk about though, are my plans with 2D Toolkit.

2D Toolkit 1.80 will add the ability to load different atlases depending on platform. Its about 50% done and it does work with VERY minimal overhead, the biggest problems holding it back so far are:

1 - Increased memory overhead building multiple atlases simultaneously. I might work around this for 1.80 by not doing the automatic atlas building part for this version - still undecided about it at the moment.

2 - Resource directory management. Its really hard to manage this as Unity detects ALL resource directories in a project, and we don't really want many "resource" directories - it makes managing builds much much more complicated than it should be.

In terms of workflow, its all done in the asset build stage, and everything else just happens transparently. You need to call tk2dSystem.SetAssetPlatform(...) when the game loads, preferably before loading in any sprites, to tell it which resources to load.

Hope that helps. Feel free to ask if you've got any further questions.
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on July 22, 2012, 10:13:18 am
I should also say I don't see why 2D Toolkit wouldn't work with Mulitplatform Toolkit. I suggest asking the Owlchemy guys if they have tried using 2D Toolkit with it if you want confirmation.
Title: Re: MultiPlatform Toolkit integration
Post by: OwlchemyLabs on July 24, 2012, 05:29:27 pm
Multiplatform Toolkit dev here.

2D Toolkit and MPTK work very well together. See the "Compatibility and Known Issues with 2D Frameworks" section on the documentation page for more info - http://smuggletruck.com/multiplatform/

@Unikron - PLEASE move forward with a Resources.Load solution for platform-specific atlases! (And don't lose the auto-atlas build process! My most important feature is being able to save from Photoshop, tab over to Unity, and see the assets (atlases) update, in-game, while playing. If anything, you could set a checkbox for which platform's atlases are generated by default, then build the others when you hit 'rebuild all atlases' from the menus.

We built a manual solution in code with no GUI, outside of MPTK, to handle resources.load()'ing the proper atlases per platform, but it was certainly a pain in the arse, and all materials needed to be cleared of any texture reference so you get a bunch of white squares in your scene before you hit play, which is pretty rough.
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on July 24, 2012, 11:45:54 pm
@OwlchemyLabs

The Resources based solution is coming along really well. The back end systems are getting completed one by one, and my next area of focus will be the tools. I want to make this as seamless and non-intrusive as possible. Also the way its set up currently, you can switch "targets" from within the editor to see how it'd look on any platform too.

None of the current features will be lost, that's for sure - especially the auto-atlas build. The way I'm planning it currently, each "target" gets its own automatically managed spritecollection, and only that only the dependent ones will get built when a particular texture changes.
Title: Re: MultiPlatform Toolkit integration
Post by: atmuc on November 09, 2012, 06:00:12 pm
i make a game for both web player and for ios platforms. so 1x,2x,4x is not suitable for me. i want to make different sprite collections for per platform. how can i switch them?
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on November 09, 2012, 06:16:19 pm
One for iOS and completely different one for webplayer? So the one in IOS doesn't get included in the webplayer?
Title: Re: MultiPlatform Toolkit integration
Post by: atmuc on November 09, 2012, 06:19:35 pm
yes 2 different atlasses. for ios i can use 1x,2x,4x. for webplayer i will use 760px x 570px or different.
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on November 09, 2012, 06:22:38 pm
What size atlas would you use on webplayer though? You'd want it to be power of two anyway won't you?
Title: Re: MultiPlatform Toolkit integration
Post by: atmuc on November 09, 2012, 06:25:53 pm
no problem with atlas sizes. what i try to do is to make all pixel perfect. i will have 4 different screen size; iphone 3gs, iphone 4, ipad3, web player. for example i have a background and i dont want to resize it improper way.
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on November 09, 2012, 06:32:27 pm
If you want arbitrary background sizes, it'll be easier to simply load the necessary texture and use tk2dSprite.CreateFromTexture(...).

The atlas swapping is for when you need to swap up & down on one platform. Maybe in a future version there will be selective atlas exporting for platforms - the system fundementally supports it, but it isn't implemented yet.
Title: Re: MultiPlatform Toolkit integration
Post by: atmuc on November 09, 2012, 06:35:24 pm
i have mptk. i think it doesn't support your atlases. also it doesnt support collider size.
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on November 09, 2012, 06:51:01 pm
You use colliders for the backgrounds? I need to understand a bit more about what you're doing before I can suggest anything.

The atlas swapping thing isn't trying to do what mptk does - what you're wanting looks more like what mptk does. You could swap entire sprite collections using mptk though couldn't you?
Title: Re: MultiPlatform Toolkit integration
Post by: atmuc on November 09, 2012, 06:58:23 pm
1. i need to use different images/atlasses for different platforms.
2. because 2dtk camera adjusts sprite size to make it pixel perfect i also need to change the size of collider. maybe i quit to use 2dtk camera and adjust sizes by myself.

i am looking solutions to use 2dtk with mptk for multiplatform deployments. 2nd problem has workaround. of course there is code solution for everything :-) i need a gui solution for the first problem. :-)
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on November 09, 2012, 07:13:26 pm
1. This really needs to be a hybrid solution with tk2d and mptk - I do have plans to do basic sprite collection filtering for platforms, but not anywhere near as complex as mptk. I'll email the mptk guys to see if maybe we could work together on a solution. I don't want to lose focus too much with tk2d, and this sounds a lot more like mptk domain.

2. tk2dCamera doesn't touch any sprite sizes, just rescales the camera to fit the sprites. The sprite / collider size won't change.
Title: Re: MultiPlatform Toolkit integration
Post by: atmuc on November 09, 2012, 07:28:54 pm
1. yes i need a simple feature with this integration just atlas change.

2. my problem was;
i had a camera and a sprite as its child. sprite scale is 1,1,1. sprites collider scale is 10,10,10. for different platform i changed my images. for some reason i set collider type as user defined. when i change sprite images sizes i also have to change collider size because it is in manual mode. i need z scale for collider so i have to use user defined.
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on November 09, 2012, 07:57:02 pm
1. This isn't such a simple feature :) The whole atlas switching thing is really quite complicated due to how Unity works, but at least its not impossible to do it.

You can change collider depth in the sprite collection editor settings panel.
Title: Re: MultiPlatform Toolkit integration
Post by: atmuc on November 09, 2012, 08:08:20 pm
1.i want it on design time. mptk should change your collection drop down :-)

2.it as depth for all sprites.can you add depth feature for box custom. so it will be full custom :-)
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on November 09, 2012, 08:38:22 pm
2. Easily done. I've put in TODO.
Title: Re: MultiPlatform Toolkit integration
Post by: atmuc on November 09, 2012, 08:51:05 pm
thanks. one thing more; will your camera be platform compatible? mptk has nothing about camera. if only platform chooser is mptk and it has full integration with 2dtk's camera and atlas chooser it will be perfect. i hope you both make this integration :-)
Title: Re: MultiPlatform Toolkit integration
Post by: unikronsoftware on November 09, 2012, 09:08:36 pm
That is a question for the mptk guys as much as it is for us :)