Vanhail
|
|
« Reply #1440 on: March 24, 2014, 10:50:55 AM » |
|
Hahaha, oh man, I've been there. Keep up the good work.
|
|
|
Logged
|
|
|
|
JLJac
|
|
« Reply #1441 on: March 26, 2014, 11:09:26 PM » |
|
Update 225Trudging along... Don't get me wrong, I'm having a wonderful time, but my ambition to divide the work into manageable chunks is down the drain. My idea was to first convert the player - but in order to work on the player's movement behaviors I need to be able to save and load a level, and in order for that to happen I need to understand how to handle XML and text files, etc etc etc. The biggest convertion push for the player is done though, ie basic terrain interaction. Still have all the behaviors involving poles, and a few other special cases left. Throwing a few questions out there: Currently I'm researching on saving and loading a level from a text file, any general tips on that? Right now my tiles (all the little things that populate the 2d array of a room) are classes. Should I go with structs instead? If I fetch one property of a struct, and it has other, big, properties, does it pass its heavy value-based self through all the methods used to fetch it? Example: public struct MyStruct() { public bool verySmallProp; public int[,,,,,,] SUPERBIGPROP; }
if (object.anotherObject.thirdObject.fetchMyStruct().verySmallProp){//...}
Is the data of SUPERBIGPROP unnecessarily passed as well, slowing everything down? In that case, would a class be quicker? (Which is, to my understanding, reference based and thus not passed at all) I'm asking because every object is asking the surrounding tiles about their status many many times per frame, so I want that to run as smoothly as possible. A tile can have several things on it, such as poles vertically and horizontally, fly hives, etc etc etc. How would you guys store that information? A lot of bools, or a list with tags?
|
|
|
Logged
|
|
|
|
RealityShifter
|
|
« Reply #1442 on: March 27, 2014, 12:16:41 AM » |
|
I had success saving room data in .ini files. All the tiles then the objects. The file sizes are surprisingly small. XML files work similarly and I think that's the standard.
I don't think weather you use structs or classes matters, or even the filing method. Just that the data is well kept track of, and can be interpreted. Your making a level compiler / decompiler! good luck.
How I've done it is had all possible variables to be saved fed into the file regardless of being null or 0. so my tiles have 6 variables total possible. So in the ini file there's always 6 lines per tile and each line corresponds to a variable in the same order each time x,y, etc. When I'm feeding the level data back into the game to be played, the decompiler script assigns those variables to a created tile in the same order, and knows a new tile starts every 6 lines. It's like bytes! :D
It looks like this. 5=176.000000 4=32.000000 3=3.000000 2=0.000000 1=0.000000 0=0.000000
.ini files work well with easily separating your tiles from objects because you can assign and look up sections.
|
|
|
Logged
|
Creativegametheory.com @theorygeorgiou
|
|
|
JLJac
|
|
« Reply #1443 on: March 27, 2014, 12:52:48 AM » |
|
Wow, that looks high tech I just solved it actually, using IFormatter and FileStream - I got the solution from the c# documentation. And yeah, the levels are totally small! With this solution you just have to mark the classes involved in the serialization as [Serializable] and then it just magically takes care of everything :D It packages the instances(in my case of the Tile class) somehow and stores them in the file, and then it unpacks them into living instances just as easily. And yeah, the file size is super small! But I'm pretty sure it would be even smaller if I did it your way... Well, this wasn't what I was supposed to be doing anyway - I was supposed to tweak the wall gliding, and was fed up with having to rebuild a wall to glide against each time I changed something haha!
|
|
|
Logged
|
|
|
|
Nico May
|
|
« Reply #1444 on: March 27, 2014, 08:59:47 AM » |
|
How are you handling collision resolution in rain world?
|
|
|
Logged
|
|
|
|
RealityShifter
|
|
« Reply #1445 on: March 27, 2014, 09:49:32 AM » |
|
Awesome. yep it is easier than it sounds. ha ha.
|
|
|
Logged
|
Creativegametheory.com @theorygeorgiou
|
|
|
Zaphos
|
|
« Reply #1446 on: March 27, 2014, 10:12:26 AM » |
|
Wow, that looks high tech I just solved it actually, using IFormatter and FileStream - I got the solution from the c# documentation. And yeah, the levels are totally small! With this solution you just have to mark the classes involved in the serialization as [Serializable] and then it just magically takes care of everything :D It packages the instances(in my case of the Tile class) somehow and stores them in the file, and then it unpacks them into living instances just as easily. And yeah, the file size is super small! But I'm pretty sure it would be even smaller if I did it your way... Well, this wasn't what I was supposed to be doing anyway - I was supposed to tweak the wall gliding, and was fed up with having to rebuild a wall to glide against each time I changed something haha! If it's serializing to binary files then that's probably smaller than an ini file would be. One thing to watch out for with automatic serialization is making sure that your saves are compatible across versions of your game -- i.e. if you add or remove fields, or change the names of fields, you still want to be able to load files that were created with the old code. These docs might help with that: http://msdn.microsoft.com/en-us/library/ms229752(v=vs.110).aspx (disclaimer: I have not used C# with Unity so I don't know for sure)
|
|
|
Logged
|
|
|
|
Nico May
|
|
« Reply #1447 on: March 27, 2014, 06:08:53 PM » |
|
very interesting link, I hadn't seen that one, I guess I figured it was impossible, or at least you would have to load them in as the old type and then convert them yourself, but I guess not:)
|
|
|
Logged
|
|
|
|
RainWorldIsAwesome
|
|
« Reply #1448 on: March 27, 2014, 06:50:03 PM » |
|
Are you ever gonna release the version that was Coded in lingo?
|
|
|
Logged
|
Felius Limax Venator Lacertae
|
|
|
Christian
|
|
« Reply #1449 on: March 27, 2014, 08:32:24 PM » |
|
Are you ever gonna release the version that was Coded in lingo?
This would be awesome if it happened
|
|
|
Logged
|
|
|
|
devMidgard
Level 1
|
|
« Reply #1450 on: March 28, 2014, 02:01:14 AM » |
|
Update 225Trudging along... Don't get me wrong, I'm having a wonderful time, but my ambition to divide the work into manageable chunks is down the drain. My idea was to first convert the player - but in order to work on the player's movement behaviors I need to be able to save and load a level, and in order for that to happen I need to understand how to handle XML and text files, etc etc etc. The biggest convertion push for the player is done though, ie basic terrain interaction. Still have all the behaviors involving poles, and a few other special cases left. Throwing a few questions out there: Currently I'm researching on saving and loading a level from a text file, any general tips on that? Right now my tiles (all the little things that populate the 2d array of a room) are classes. Should I go with structs instead? If I fetch one property of a struct, and it has other, big, properties, does it pass its heavy value-based self through all the methods used to fetch it? Example: public struct MyStruct() { public bool verySmallProp; public int[,,,,,,] SUPERBIGPROP; }
if (object.anotherObject.thirdObject.fetchMyStruct().verySmallProp){//...}
Is the data of SUPERBIGPROP unnecessarily passed as well, slowing everything down? In that case, would a class be quicker? (Which is, to my understanding, reference based and thus not passed at all) I'm asking because every object is asking the surrounding tiles about their status many many times per frame, so I want that to run as smoothly as possible. A tile can have several things on it, such as poles vertically and horizontally, fly hives, etc etc etc. How would you guys store that information? A lot of bools, or a list with tags? I see you're developing this in C#, are you using a custom built engine or Unity, or somewhat popular? -- EDIT Actually yeah, I could also go back some pages and see the UnityEngine included into a Script, so no need to respond me :D Good freaking luck around that, this game looks awesome.
|
|
|
Logged
|
|
|
|
electrolyte
|
|
« Reply #1451 on: March 28, 2014, 08:32:37 AM » |
|
I'm super impressed at your jump from Lingo to Unity Following this like a rash!
|
|
|
Logged
|
|
|
|
JLJac
|
|
« Reply #1452 on: March 29, 2014, 02:58:21 PM » |
|
Thanks everyone!
Collision is all home brewn code, like everything else in the game except sprite handling, where I use the excellent Futile framework. It's strictly tile based for terrain and radius/trigonometry based for creatures, simple as that.
Yeah, I know I need to watch out for backwards conmability... Ran into that issue a few times with the old level editor. This time around I don't think it'll be as big of a problem though, as the game will not evolve as much during the process since it's already designed.
|
|
|
Logged
|
|
|
|
Slader16
|
|
« Reply #1453 on: March 29, 2014, 03:01:12 PM » |
|
How are you making the player sway? I think that's the right word *Edit* Oh, and are you using Unity's 2D or 3D mode?
|
|
« Last Edit: March 29, 2014, 03:57:16 PM by Slader16 »
|
Logged
|
|
|
|
Nico May
|
|
« Reply #1454 on: March 29, 2014, 03:23:55 PM » |
|
Is the tile collision done so that the player is pushed out after moving, or not allowed to enter the tile ever (sorry about the questions, this is just what ive been working out in my attempt at an engine...)
|
|
|
Logged
|
|
|
|
prime31
Level 0
|
|
« Reply #1455 on: March 30, 2014, 09:44:28 AM » |
|
@Slader16, there is no such thing as "2D" vs "3D" mode for Unity. Everything is 3D. Even a flat quad consists of four three-dimensional points of all which have the same z value.
|
|
|
Logged
|
|
|
|
Slader16
|
|
« Reply #1456 on: March 30, 2014, 10:18:11 AM » |
|
@Slader16, there is no such thing as "2D" vs "3D" mode for Unity. Everything is 3D. Even a flat quad consists of four three-dimensional points of all which have the same z value.
Oh yeah, you're right! (I keep forgetting that )
|
|
|
Logged
|
|
|
|
Nico May
|
|
« Reply #1457 on: March 30, 2014, 10:23:25 AM » |
|
@Slader16, there is no such thing as "2D" vs "3D" mode for Unity. Everything is 3D. Even a flat quad consists of four three-dimensional points of all which have the same z value.
Oh yeah, you're right! (I keep forgetting that ) he's using futile, which as I understand it, only uses unity for rendering, and is mainly code based, acting much more like flash (I haven't used it, so correct me if I'm wrong)
|
|
|
Logged
|
|
|
|
Slader16
|
|
« Reply #1458 on: March 30, 2014, 10:41:23 AM » |
|
@Slader16, there is no such thing as "2D" vs "3D" mode for Unity. Everything is 3D. Even a flat quad consists of four three-dimensional points of all which have the same z value.
Oh yeah, you're right! (I keep forgetting that ) he's using futile, which as I understand it, only uses unity for rendering, and is mainly code based, acting much more like flash (I haven't used it, so correct me if I'm wrong) Ohh, I thought that Futile was for rendering the sprites/animations etc.
|
|
|
Logged
|
|
|
|
gimymblert
|
|
« Reply #1459 on: March 30, 2014, 11:34:07 AM » |
|
well even pure 2D game engine tend to work in 3 dimensions with sprite priority (aka depth) to handling overlapping. What matter more is the DOF
|
|
|
Logged
|
|
|
|
|