Evgeniy Rojkov emmiters blend, plist, anchor and others
Posts 37
Added by Evgeniy Rojkov over 1 year ago

PROBLEM #1: plist

I exported plist from Particle Designer. That file contains

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

with that line visaul studio throw exception

System.NotSupportedException was unhandled
  Message=NotSupportedException
  StackTrace:
       at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlTextReaderImpl.Read()
       at cocos2d.CCSAXParser.parse(String pszFile)
       at cocos2d.CCDictMaker.dictionaryWithContentsOfFile(String pFileName)
       at cocos2d.CCFileUtils.dictionaryWithContentsOfFile(String pFileName)
       at cocos2d.CCParticleSystem.initWithFile(String plistFile)
       at Rebellion.GUI.GameLogo.createFlameEmiiter(Int32 depth)
       at Rebellion.GUI.GameLogo..ctor()
       at Rebellion.GUI.MainMenu.init()
       at Rebellion.GUI.MainMenu.node()
       at Rebellion.GUI.MainMenu.scene()
       at Rebellion.AERGameDelegate.applicationDidFinishLaunching()
       at cocos2d.CCApplication.LoadContent()
       at Microsoft.Xna.Framework.DrawableGameComponent.Initialize()
       at cocos2d.CCApplication.Initialize()
       at Microsoft.Xna.Framework.Game.Initialize()
       at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
       at Microsoft.Xna.Framework.Game.StartGameLoop()
       at Microsoft.Xna.Framework.XnaGameApplication.XnaGameApplicationStartGameLoop()
       at Microsoft.Xna.Framework.XnaGameApplication.XnaGameApplication_Launching(Object sender, LaunchingEventArgs e)
       at Microsoft.Phone.Shell.PhoneApplicationService.FireLaunching()
       at Microsoft.Phone.Execution.NativeEmInterop.FireOnLaunching()

without that file - everything is ok

Evgeniy Rojkov RE: emmiters blend, plist, anchor and others
Posts 37
Added by Evgeniy Rojkov over 1 year ago

PROBLEM #2: emmiter blend

plist contains blending setting (additive blend)

plist

<key>blendFuncDestination</key>
<integer>1</integer>
<key>blendFuncSource</key>
<integer>770</integer>

C#

CCParticleSystemQuad flameEmmiter = new CCParticleSystemQuad();
flameEmmiter.initWithFile("flame");
addChild(flameEmmiter, depth);

also BlendFunc doesnt work

flameEmmiter.BlendFunc.src = OGLES.GL_SRC_ALPHA; //also tryed OGLES.GL_ONE
flameEmmiter.BlendFunc.dst = OGLES.GL_ONE;

works only "IsBlendAdditive", but its lead to problem #3

C#

flameEmmiter.IsBlendAdditive = true;

Evgeniy Rojkov RE: emmiters blend, plist, anchor and others
Posts 37
Added by Evgeniy Rojkov over 1 year ago

PROBLEM #3: IsBlendAdditive

if set emmiter.IsBlendAdditive = true , this makes all other sprites with higher depth become blend additive too.

here screenshot

C#

spriteRebellion = CCSprite.spriteWithFile(AERLocale.IMAGES_FOLDER + AssetID.IMAGE_REBELLION);
addChild(spriteRebellion, 1);

CCParticleSystemQuad flameEmmiter = new CCParticleSystemQuad();
flameEmmiter.initWithFile("flame");
flameEmmiter.IsBlendAdditive = true; // this makes "spriteRebellion" additive too
addChild(flameEmmiter, 0);

Evgeniy Rojkov RE: emmiters blend, plist, anchor and others
Posts 37
Added by Evgeniy Rojkov over 1 year ago

PROBLEM #4: something wrong with particles anchor point

on windows phone emulator sprites spread and rotate looks like anchor point not in center

here screenshot

<key>rotationEnd</key>
<real>0.0</real>
<key>rotationEndVariance</key>
<real>90</real>
<key>rotationStart</key>
<real>0.0</real>
<key>rotationStartVariance</key>
<real>90</real>

if i change rotationEndVariance and rotationStartVariance to 0 - flame become like in Particle Designer but without rotates

Evgeniy Rojkov RE: emmiters blend, plist, anchor and others
Posts 37
Added by Evgeniy Rojkov over 1 year ago

here plist and texture for tests

back_flame.plist (2.6 kB)

Evgeniy Rojkov RE: emmiters blend, plist, anchor and others
Posts 37
Added by Evgeniy Rojkov over 1 year ago

texture

smoke5.png (6.3 kB)

Evgeniy Rojkov RE: emmiters blend, plist, anchor and others
Posts 37
Added by Evgeniy Rojkov about 1 year ago

up

Evgeniy Rojkov RE: emmiters blend, plist, anchor and others
Posts 37
Added by Evgeniy Rojkov about 1 year ago

bump again.
is there any developers read this forum?

Raghu S RE: emmiters blend, plist, anchor and others
Posts 79
Added by Raghu S about 1 year ago

hi,
It seems this forum is not updated well. well anyway Which XML reader are you using to read the plist file? I believe that error is caused because .net's XML readers cannot recognize the header since plist is a Mac specific XML file. removing the header should make it work fine. In case you want to make it work as it is you could try writing a custom XML parser.

Raghu S RE: emmiters blend, plist, anchor and others
Posts 79
Added by Raghu S about 1 year ago

As for your third question I believe it is because the underlying XNA processes all sprites in batches. drawing everything in a single class might be the reason for your problem. cocos might me sending all sprites in a class to a single spritebatch draw method of XNA - Again I'm not sure this is how it goes in cocos. Dev's might be of help here but it seems to be the right cause for your problem according to me. try using separate classes or layers for particles and Text.

sorry not so sure about your other two questions.

Evgeniy Rojkov RE: emmiters blend, plist, anchor and others
Posts 37
Added by Evgeniy Rojkov about 1 year ago

seems like all developers abandon this project

姜 卓 RE: emmiters blend, plist, anchor and others
Posts 1
Added by 姜 卓 about 1 year ago

I have the seem problem4.
My solution is modifying plist file......

RongHong Huang RE: emmiters blend, plist, anchor and others
Posts 171
Added by RongHong Huang about 1 year ago

About problem 3, this is a bug, the blendadditive attribute shouldn't affect other sprites.

RongHong Huang RE: emmiters blend, plist, anchor and others
Posts 171
Added by RongHong Huang about 1 year ago

The blendadditive bug has been fixed and committed,

About problem 4, the particle rotation wasn't implemented before, now it acts,
you could try the latest code on the github.

Thank Evgeniy and Jiang for your reports.:)

Jiri Formanek RE: emmiters blend, plist, anchor and others
Posts 26
Added by Jiri Formanek about 1 year ago

About the problem #1... I solved it this way:

...
XmlReaderSettings settings = new XmlReaderSettings();
settings.DtdProcessing = DtdProcessing.Ignore;
XmlReader xmlReader = XmlReader.Create(textReader, settings);
...

directly in CCSAXParser class. There is no reason to read DTD.

Jiri Formanek
Mingle Games
http://www.facebook.com/pages/Mingle-Games/122532511173330


(1-14/14)