Search found 17 matches

by viveleroi
Fri Feb 10, 2017 3:35 pm
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Async Support
Replies: 10
Views: 14148

Re: Async Support

I chose to put chunks into their own files because: a) as the user walks around I need an easy way to read chunks based on their coordinates, and b) chunk data varies in length depending on the tiles/entities on them. If there's a way to easily do both while combing files somehow, I'd be open to it....
by viveleroi
Fri Feb 10, 2017 1:22 am
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Async Support
Replies: 10
Views: 14148

Re: Async Support

For simplicity I've stripped everything but save code for the chunks/tiles. I'm hoping you have some additional advice because it's still killing the performance of my terrain generation logic. Running profiling, my chunk generation logic by itself accounts for an average of 10% of a frame's time. O...
by viveleroi
Wed Feb 08, 2017 8:33 pm
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Custom classes and polymorphism
Replies: 7
Views: 8327

Re: Custom classes and polymorphism

That's good to know. Functional saves/loads are my focus right now and I'm finally pretty close to having all that work done - just doing some cleanup, testing, etc. Eventually I'll figure out how best to support mods. While hard-coding instance checks would be a pain for myself, since my game will ...
by viveleroi
Wed Feb 08, 2017 8:26 pm
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Async Support
Replies: 10
Views: 14148

Re: Async Support

Thanks. I've made all of these changes and it seems a lot better, though I have yet to test on a large screen where the lag was way more noticeable.
by viveleroi
Wed Feb 08, 2017 12:41 am
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Custom classes and polymorphism
Replies: 7
Views: 8327

Re: Custom classes and polymorphism

Yup, that works perfectly. For anyone stumbling upon this thread in the future, here's my code: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ES2UserType_Item : ES2Type { public override void Write(object obj, ES2Writer writer) { Item data ...
by viveleroi
Tue Feb 07, 2017 7:08 pm
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Custom classes and polymorphism
Replies: 7
Views: 8327

Re: Custom classes and polymorphism

I haven't tested this, pending fixing a type issue we're discussing in another thread, but what if I did this: During write, I write the typeof to the file: writer.Write(data.GetType().ToString()); Then during read, I dynamically instantiate it: var typeStr = reader.Read<string>(); var type = Type.G...
by viveleroi
Tue Feb 07, 2017 7:03 pm
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Async Support
Replies: 10
Views: 14148

Re: Async Support

I'm always open to suggestions, so I'll show you as much as you need, for now I'll post the relevant type classes and describe how I call saves. Sidenote first, thanks for the help. You've seen me all over these forums lately as I figure things out. I've been a developer for a long time but I've nev...
by viveleroi
Tue Feb 07, 2017 4:46 pm
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Async Support
Replies: 10
Views: 14148

Re: Request a Feature (Post your Requests Here)

I am performing writes/reads sequentially. I'm not using tags anywhere in my code. Just by playing I definitely notice a solid lag spike when new chunks generate/old chunks unload and that wasn't there before, so I need to see what else I can do. Profiling shows that ES2.Save (mainly ES2Writer.Write...
by viveleroi
Tue Feb 07, 2017 4:02 pm
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Custom type inheritance
Replies: 3
Views: 5801

Re: Custom type inheritance

That doesn't seem to work either, I must be missing something.

I'm using:

Code: Select all

writer.Write<Item>(item);
and I get the error:

Code: Select all

Easy Save does not support saving of type Battery
I have a custom type defined properly for "Item", so I'm not sure what I'm missing.
by viveleroi
Tue Feb 07, 2017 3:43 pm
Forum: (Legacy) Easy Save 2 General Discussion
Topic: Custom classes and polymorphism
Replies: 7
Views: 8327

Re: Custom classes and polymorphism

Unfortunately that's just not a feasible solution because eventually I'll have hundreds of items and some day would like to allow for mods to add custom items. Hard-coding every single one into the read method is going to get ugly fast.