Coder Social home page Coder Social logo

Comments (3)

bobsummerwill avatar bobsummerwill commented on June 24, 2024

Yuck. Got some more deserialization working to get the fileIDs at least read in, but it's an abomination!

a369f61

kitsilanosoftware/BosphorusEngine@1d8ef29

I think that the file-format that Unity are using here is really non-idiomatic YAML. In particular, this in GameObject:

m_Component:

  • 4: {fileID: 1099934815}
  • 20: {fileID: 1099934814}
  • 92: {fileID: 1099934813}
  • 124: {fileID: 1099934812}
  • 81: {fileID: 1099934811}

Actually appears to be a sequence of mappings of mappings, and the outer mapping is NOT using a consistent key name. The key value (the object type) is actually being used as a key. Maybe this is some manifestation of their underlying C++ code? Whatever the case, it is just horrible.

I did something horrific to get the data read in, and will have to try to simplify it now I now what the events are being mapped as.

Or maybe I will just shelve that horror for now and move onto getting the runtime fixing up the references and actually running a bit.

I see that the YAML also has fileIDs which aren't listed in the YAML itself, which are presumably for external assets, like the script code, meshes, etc.

I found something online describing the hashing used for fileID, which is some hash of the object type name and object name concatenated.

from bosphorus.

ztzg avatar ztzg commented on June 24, 2024

Hi Bob,

I'll do something quick-and-dirty for now, and then clean it up later.

I want to get a running tiny Unity scene with a MVVM abstraction soon,
based on deserializing EmptyUnity2DProject, which just has a camera and a
cube and those various "settings" objects.

Sounds good!

Yuck. Got some more deserialization working to get the fileIDs at
least read in, but it's an abomination!

a369f61

kitsilanosoftware/BosphorusEngine@1d8ef29

Well, one step at a time :) This doesn't look bad at a glance; the only
mistake would be to not schedule a clean up once the required mechanics
are better understood.

I think that the file-format that Unity are using here is really
non-idiomatic YAML. In particular, this in GameObject:

m_Component:

  • 4: {fileID: 1099934815}
  • 20: {fileID: 1099934814}
  • 92: {fileID: 1099934813}
  • 124: {fileID: 1099934812}
  • 81: {fileID: 1099934811}

Actually appears to be a sequence of mappings of mappings, and the
outer mapping is NOT using a consistent key name. The key value (the
object type) is actually being used as a key. Maybe this is some
manifestation of their underlying C++ code? Whatever the case, it is
just horrible.

C++: most probably. The serialization format doesn't seem to have been
"designed," but rather to stem from their internal object model.

I did something horrific to get the data read in, and will have to try
to simplify it now I now what the events are being mapped as.

Or maybe I will just shelve that horror for now and move onto getting
the runtime fixing up the references and actually running a bit.

I, for one, would try to get something useful running ASAP, because
I'm sure you will discover some other warts while doing so. Refactoring
is likely to be more successful with a better knowledge of the graph :)

I see that the YAML also has fileIDs which aren't listed in the YAML
itself, which are presumably for external assets, like the script
code, meshes, etc.

I found something online describing the hashing used for fileID, which
is some hash of the object type name and object name concatenated.

Really? "fileID"s seem to be 32-bit integers; they would need to
somehow cater for collisions. Or are you talking about the other,
longer hashes?

Cheers, -D

from bosphorus.

bobsummerwill avatar bobsummerwill commented on June 24, 2024

Ah, yes, I misspoke slightly. The reference I saw was for this "fileID" only ...

m_Script: {fileID: -1167294237, guid: 2b16a1acf52a2a64e916f8a9e6d5df31, type: 3}

http://forum.unity3d.com/threads/yaml-fileid-hash-function-for-dll-scripts.252075/

from bosphorus.

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.