question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ParticleEffect modification broke Particle Effect on GWT module #5280

See original GitHub issue

Issue “Life attribute on Particle Emitter is not applied to particles individually” with ID #5280 broke Particle loader for the HTML/gwt module

Issue details

A new parameter (independent) has been added to the ParticleEffect configuration file “.p”. In order to ensure backward compatibility the lifeValue.loader in class ParticleEmitter has been updated with a mark(100) followed by a reset (see below). Problem is,

  • On Desktop, Android, calling that works.
  • On GWT this triggers an Exception as there is no implementation for the BuffereredReader.mark() method. This calls by default the method on Reader.java which by default raises an exception.

In class ParticleEmitter:

public void load (BufferedReader reader) throws IOException {
			super.load(reader);
			// For backwards compatibility, independent property may not be defined
			reader.mark(100);
			String line = reader.readLine();
			if (line == null) throw new IOException("Missing value: " + "independent");
			if (line.contains("independent"))
				independent = Boolean.parseBoolean(readString(line));
			else
				reader.reset();
		}

Reproduction steps/code

Run the Out of the box Tests on GWT, select the following test com.badlogic.gdx.tests.ParticleEmitterTest

You will get the Exception outlined in the stacktrace section below.

The issue does not happen with the android or Desktop module (which is probably why this went undetected).

Version of LibGDX and/or relevant dependencies

LibGDX Version: 1.9.9-SNAPSHOT

Stacktrace

Uncaught Error: com.badlogic.gdx.utils.GdxRuntimeException: Error loading effect: data/test.p
    at rLd.JKd [as dyb] (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159)
    at rLd.SKd [as lyb] (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159)
    at rLd.EKd (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159)
    at rLd.eLd (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159)
    at rLd.lLd (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159)
    at new rLd (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159)
    at ZX.jY [as zt] (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:120)
...
com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159 Uncaught Error: java.lang.RuntimeException: com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'pwb' of undefined
    at mLd.JKd [as dyb] (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159)
    at mLd.SKd [as lyb] (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159)
    at mLd.FKd (com.badlogic.gdx.tests.gwt.GdxTestsGwt-0.js:159)
...

Please select the affected platforms

  • Android
  • iOS (robovm)
  • iOS (MOE)
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
obigucommented, May 27, 2019

Here you go https://github.com/libgdx/libgdx/pull/5637, now let’s hope it gets merged

1reaction
obigucommented, May 27, 2019

AFAIK it will only break trying to load particle effects that use the old format. I believe it doesn’t make sense anymore to merge the “hacky” solution as backwards compatibility has already been broken for a while. https://github.com/libgdx/libgdx/pull/5374 is still open and should be merged to cleanly handle GWT non supported classes and update the particle effects test files to the latest format. EDIT: I remember now https://github.com/libgdx/libgdx/pull/5374 has a formatting issue. I was waiting for confirmation/feedback to fix it. Will do if there’s interest.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Particle System modules - Unity - Manual
Particle System modules. The Particle SystemA component that simulates fluid entities such as liquids, clouds and flames by generating and ...
Read more >
Getting started with the Particle System | Unite Now 2020
In this video, you'll learn how to make fire, smoke, snow, and rain using Unity's Particle System. You'll also learn how to modify...
Read more >
Diving Into Niagara: Intelligent Particle Effects - YouTube
Hosted by Arran Langmead, this session digs into how you can start building more intelligent effects using Unreal Engine's Niagara VFX ...
Read more >
2D ParticleEffects - libGDX
ParticleEffects are no different than Sprites, in fact they ARE sprites. Take everything you know already about efficiently rendering sprites and carry them ......
Read more >
LibGDX: Change particle image at runtime? - Stack Overflow
Is it possible to change the image of the particle effect at runtime? ParticleEffect particleEffect = new ParticleEffect(); particleEffect.load( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found