Jump to content
Sign in to follow this  
xXDaxterProXx

Saving Any Data

Recommended Posts

Hey guys, I'm new to the forums. I was going to ask this on the eclipse forum, but they look dead and this forum looks more active.

 

I'm using a vb6 engine, and I want a sub I can use to save any data (like maps or players) that all my save subs can use. Something like "saveData map(1)" and "saveData player(1)", so I only have to call one sub instead of adding any new data to the save subs. I keep forgetting to add the new data in maprec to the save sub, and want to just call one thing to save everything in the map.

Share this post


Link to post
Share on other sites

Erm, you're going to have to add that data into a universal save sub regardless. There's no shortcut to save any data. Besides, many small save subs are superior to one huge one. Cleaner, simpler, and less prone to errors. Sorry if I didn't understand what you were asking about.

Share this post


Link to post
Share on other sites

I'm not sure if you can use generics in vb6. It might be possible? But honestly the amount of research and half baked attempts at making it work might not be worth the effort. 

 

It wouldn't be too hard making it work for most data, but maps have some arrays that can dynamically change sizes so you can't blindly dump binary and load them back in. 

 

So honestly? Just remember to add the values you added to the map saving methods. It'll be less of a hassle and I doubt you'll have to keep adding values every update for your game. You'll likely spend less time adding them than completely rethinking and redoing the save mechanism in an ancient language. 

Share this post


Link to post
Share on other sites

I don't think it has generics. I also want to add multiple layers to players for body type, hair, and other stuff, and some would take multiple slots so I need to write it all out like the maps. So using one sub to save everything would just be easier.

Share this post


Link to post
Share on other sites

I just want to make a sub that I can use to save any data, maps, players with optional layers, npcs, or any other data. I want the sub to loop through each part and save it so I don't have to worry about adding things to the save subs.

 

I think you have me confused with someone else damian, I've never been on this forum before.

Share this post


Link to post
Share on other sites

This isn’t the same Dax lol. And regardless if it’s all in one sub or not man, you’re gonna need to add in any extra data you add. It can’t save it otherwise. Like if you added a new map layer, you’d have to edit this massive save sub instead of the small map specific save sub. This whole idea (at least in VB6) is counter productive

Share this post


Link to post
Share on other sites

Not sure if it's possible in VB6. Even if it is I think you're still better off just writing the save data in those smaller savesubs. More clean and less prone to errors.

Share this post


Link to post
Share on other sites

.Net apps have something called Reflection that allows your program to iterate through the properties/values of a structure/class and do cool things like this. VB6 does not have any sort of functionality so what you're asking for isn't possible as far as I know.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×