I'm creating an in-game level editor to streamline my development process. I'm running into a wall with serialization though.
I'm using the binser library. I have a Level class made up of a bunch of Tile instances. I want the Tile class to only store a reference to its TileType and its location so that it can generate its graphics stuff on deserialization, but I'm not sure how to write the custom serializer/deserializer functions and I can't find any examples. Has anyone done this before?
Custom Serialization
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Custom Serialization
Serialization is converting a complicated object into linear stream of information, hence the name. It doesn't quite applies to what you're doing.
What you need to do is to iterate over tiles and save their locations and type. When you load them, you generate a tile based off information you read from the file.
What you need to do is to iterate over tiles and save their locations and type. When you load them, you generate a tile based off information you read from the file.
- thatcosmonaut
- Prole
- Posts: 9
- Joined: Sun Nov 06, 2016 6:04 pm
Re: Custom Serialization
Yea I guess I just thought serialization would be a useful abstraction of that process. But it might just be easier to handle it manually. Thanks for the advice.
Re: Custom Serialization
Complete (i.e. default) serialization would carry a lot of irrelevant information about live object, reducing efficiency greatly. It is only really useful if you only use the object as data storage, rather than a class instance.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest