Archive for the ‘Misc’ category

TexturePacker Extension for ShiVa 3D

January 14th, 2013

UPDATE: TexturePacker 3.0.6 comes with a separate Shiva 3D output format. I updated the post to reflect these changes as well as some other workflow optimizations.

My first product got published on the ShiVa Asset Store: an extension to support the awesome program TexturePacker by Andreas Löw. If you don’t know of it yet, check it out at http://www.codeandweb.com/texturepacker. Here is a screen shot of the supplied demo, showing off all the supported features:

demo

Features

  • No need to build your atlas by hand, TexturePacker does the work for you :)
  • Texturize Models
  • Texturize HUD Components

Usage

texturepackerExport

  1. Create your atlas with TexturePacker:
    • Data Format is “Shiva3D“.
    • Texture Format is TGA.
    • Allow Rotation” is only supported for texturing Models. HUDs are not supported!
    • Trim Mode is “None“.
    • Press the “Publish” Button. This will create 2 files: an XML and a PNG.
  2. Import the XML and the PNG via the Data Explorer into Shiva and add them as Resources to your game:
    importTexture  importXml

    1. Workflow Optimization: if you want to skip the importing, configure your output paths to the shiva resources folder directly! I only tested this once the resources was already created though.
  3. If texturing a Model, create a Material with the same name as the texture, configure it such that it uses the texture and also add it to the Resources of your game.

You are now ready to use the atlas!

 

Here is some example code:

local hUser = application.getCurrentUser ( )
 
application.setCurrentUserScene ( "TexturePacker" )
 
--Load atlas data:
--Use sendEventImmediate!
user.sendEventImmediate ( hUser, "TexturePacker", "onLoadAtlas", "atlasTexturePacker" )
--user.sendEventImmediate ( hUser, "TexturePacker", "onLoadAtlas", "otherAtlas" )
 
--Texturize Model via code:
user.sendEventImmediate ( hUser, "TexturePacker", "onSetObjectTexture", application.getCurrentUserSceneTaggedObject ( "obj8" ), "tp05" )
user.sendEventImmediate ( hUser, "TexturePacker", "onSetObjectTexture", application.getCurrentUserSceneTaggedObject ( "obj1" ), "tp01" )
user.sendEventImmediate ( hUser, "TexturePacker", "onSetObjectTexture", application.getCurrentUserSceneTaggedObject ( "obj2" ), "tp02" )
 
--Or use Object AI "TexturePackerAI" (done for obj3 and obj4)

 

Best you take a look at the supplied TexturePackerDemo.
Set your viewport to Android Landscape (800×480) for best results.

Here’s a snapshot of a little game I’m currently working on, utilizing the TexturePacker extension (every texture is coming out of an atlas):

overview

Feedback is welcome!

And once again, the link to the ShiVa Asset Store: http://www.shivaengine.com/store/aimodels/132-texturepacker-ai.html.

Box2D-Shiva-Wrapper: Demo Project

May 26th, 2012

Not too much news regarding the actual Box2D wrapper today. I rather spent the last days on coming up with a little demo project (proof of concept for the plugin). I already got a rough prototype up and running, but the time isn’t right yet to release any info to public. Fact is, that this demo already has brought up some issues that I fixed and besides that, I started expanding the API:

applyAngularImpulse
applyForce
applyForceToCenter
applyLinearImpulse
applyLinearImpulseToCenter
applyTorque
setBodyActive
setBodyAwake
destroyBody
getBodyLinearVelocity
getAngleBetweenPoints

Not too much, but more is coming!

Now back to some concept art (nice alternative to too much programming :) )!

MASH-up

May 25th, 2011

Today we released the first iteration of MASH, the “Modern Alchemists ShiVa Libs”:

Modern Alchemists ShiVa Libs is a bundle of custom written ShiVa addons. All projects rely on ShiVa 1.9 and UAT 1.2 beta 7. This doesn’t mean it won’t work with older versions, but the docs might refer to code hockups which weren’t present back then.

All code is under LGPL License. If you like our work, tell us! If not, tell us even more! Got a code fix? Tell us… you get the idea ;)

It features:

  • MASS: In-App-Purchase for iOS and Android
  • MAOF: OpenFeint for iOS and Android
  • Mortar (TBA): automating the world!

You can get all the files/code either from the download section or via SVN at  google code: http://code.google.com/p/ma-sh/

Android: Could not reserve enough space for object heap

April 15th, 2011

If you ever get an error like
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

or
BUILD FAILED
...ant_rules_r3.xml:361: The following error occurred while executing this line:
...ant_rules_r3.xml:174: apply returned: 1
,
don’t let yourself get fooled about some threads found on google.

The answer why your VM crashes is, that the heap space trying to be allocated is not free in physical memory.

That means: try to decrease the setting for max heap space in the file android-sdk-windows/platform-toolsdx.bat to smaller value. I had to change it to 512M instead of 1024M, meaning:
set defaultMx=-Xmx512M

And tada, off you go!

Update: Drag and drop install APK script

April 5th, 2011

I updated the Drag and drop install APK script post, such that it works with the latest Android SDK! Hope it helps ;)