Coder Social home page Coder Social logo

Comments (6)

rollerozxa avatar rollerozxa commented on June 2, 2024 1

Can indeed reproduce.

image

Strangely only crashes on Windows, works fine on Linux.

from principia.

griffi-gh avatar griffi-gh commented on June 2, 2024

from principia.

rollerozxa avatar rollerozxa commented on June 2, 2024

Yes, obviously.

from principia.

griffi-gh avatar griffi-gh commented on June 2, 2024

seems like the Robot Manager never receives ENTITY_EVENT_REMOVE, even though it's subscribed to it
literally have no idea why this doesn't work, since Lua Script relies on the same event and it does work there... (even if it's actually not handled properly)

from principia.

griffi-gh avatar griffi-gh commented on June 2, 2024

seems like subscriptions get reset??? between initialization and actual absorb.
calling subscribe every frame (hack) fixes the issue....??

from principia.

griffi-gh avatar griffi-gh commented on June 2, 2024

principia/src/src/entity.hh

Lines 839 to 845 in 87b00fb

/* Setup is called after init if the entity has no
* state to load from */
virtual void setup()
{
this->listeners.clear();
this->subscriptions.clear();
};

... interesting...
seems like this is a side effect of the default setup implementation, which clears all listeners and subscriptions
(The robot manager subscribes to the ENTITY_EVENT_REMOVE event in the init "stage", which gets called before setup)

Commenting out the following lines in the setup implementation "fixes" the issue:

// this->listeners.clear();
// this->subscriptions.clear();

image

But I'm pretty sure this has some unintended side effects...

By the way, saving and reloading the state before the robot is absorbed causes the game to not crash, since setup is not called if the level is reloaded from a state buffer:

principia/src/src/entity.cc

Lines 560 to 578 in 87b00fb

* ENTITY STATE HANDLING
*
* When a level is saved, write_state is called from world. The entity can fill however
* much data in the buffer as it wishes.
*
* When the level is loaded again, the following occurs:
* 1. Entity allocates
* 2. on_load(bool created, bool has_state)
* 3. read_state()
* 4. add_to_world()
* 5. init()
* 6. restore()
*
* When a level is loaded without a state buffer, the follow occurs:
* 1. Entity allocates
* 2. on_load(bool created, bool has_state)
* 3. add_to_world()
* 4. init()
* 5. setup()

from principia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.