Development Forum |
|
|
Malkin Manager
|
6/21/2013 | |
I've approached Liam and Moe about how to create a worldwrap, like we see in C12DS and C2toDS. Liam has reported the following:
Implementing a worldwrap is very difficult, and incredibly finicky--each situation/room is unique. The worlds have to be mapped a very specific way which is different every time, and takes a lot of time to perfect.
It's not something that can be really be tutorialised.
Worldwrap is HUGELY resource intensive, and it needs a really long room to work best. It uses a bunch of cameras to show what's going on on the other side, so in a smallish room, more than half the time the screen would be filled with cameras, which eat up system resources like nobody's business - it's just not worth the extra resources in the majority of cases.
My TCR Norns |
mfb
|
6/21/2013 | |
I always wondered how that worked. Even if it's really resource-obnoxious in practice, I think documentation on the concept behind all weird Creatures workarounds is good to have
Shee Tea Shop |
Feddlefew
|
6/22/2013 | |
Wait, that's how that works? Even in the original game?
(Out of curiosity, where is the C1 world wrap point?) |
Malkin
Manager
|
6/22/2013 | |
I don't know how it works in the original game, but that's how it's implemented for C12DS and C2toDS. To give you an idea of the length required, C2toDS's background is over 12500 pixels long.
My TCR Norns |
mfb
|
6/22/2013 | |
C1's wrap point is in the big ocean, right over one of the underwater shee statue's crown tines. That's why there's a 'black hole' there. I don't think that C1 and C2 used the same method as DS, seeing as their engines had the opportunity to be made especially for worldwrap, and seeing as they don't bring computers to a crawl.
(I'm not 100% sure that C12DS's wrap point is in the same place as C1's, but due to the way this hack works (I had the opportunity to talk to Clucky about it a long time ago) I'm pretty sure that the 'point' actually extends a screen or some other large distance in either direction. Hence in C12DS the island is sort of laggy.)
Shee Tea Shop |
Sanely Insane
RisenAngel
Manager
|
6/22/2013 | |
To answer the wrap point question: C1's world seam is in the sea with the underwater tunnel (the rightmost one), on the far right of the sea either barely cutting through or right next to the moon.
Don't really have anything to add to the conversation besides that, unfortunately.
Edit: And of course I'm ninja'd.
~ The Realm ~
Risen Angel's Creatures Blog
|
mfb
|
6/22/2013 | |
Sorry I'm a ninja!
Since it's the next logical question, C2's wrap point, if I recall correctly, is on the left edge of the peak of the volcano.
Shee Tea Shop |
Moe
|
6/22/2013 | 2 |
C2toDS Map
This is what C2toDS's map looks like scaled down. The light area is the actual "working area", the left and right bits were added to let the camera move left and right reasonably before being switched to the other side of the world.
The wrap points are the right and left edges of the lit area. Almost the entire shaded area is mapped just like it's lit counterparts, so when an object crosses the boundaries into the dark areas of the map, an agent (or series of agents) positioned along that edge instantly "grabs" the offending agent and re-positions it in the corresponding lit portion, maintaining any velocity it had. It knows to exclude those agents that shouldn't be grabbed like overlays.
A series of cameras are positioned on the right side of the map (repeating several times out for good viewing distance at higher resolutions), that displays anything that is on the corresponding lit side of the map as if it were really there.
Basically, it's quick hands and mirrors making magic happen. Congratulations, you've ruined the illusion. Now you get to live in a world of gears and gizmos sapped of it's mystery and magic. I hope you're happy! It sounds easy in theory, but positioning it, optimizing it, and coding it can be confusing. That's why you can't make a good tutorial of it.
Unfortunately, for as neat of an effect as it is, it's quite resource intensive. You've got cameras upon cameras (which DS doesn't handle that well!), and in order to move objects instantaneously, you've got an object, or series of objects, constantly searching the entire game for offending agents (those that have crossed the boundary) and moving them.
Every second it searches the position of every agent touching the boundary wrap agents 20 times (That can be hundreds of checks per second!). That's why it's not cheap to do. Unless you're making a real world, don't make your room wrapping. It's a waste. Use the resources you'd spend on wrapping to make your agents and room more interesting instead.
Edit: As for where C2 (the original game's) "wrap" points were, I'm going to assume they're actually the same as C2toDS's, right there on the island, simply because that's where the background begins and ends if you piece together all the pieces in back.s16 (which I did for C2toDS). |
Malkin
Manager
|
6/22/2013 | 3 |
Thank you, Moe! I don't think it's ruined the illusion at all - it just makes me admire how it works more.
My TCR Norns |
mfb
|
6/22/2013 | |
There was never really an illusion to ruin, seeing as I've always been able to see the lag spike when I'm around that area
thanks for the dissection.
Shee Tea Shop |
Chaotic Spriter
mea
|
6/22/2013 | |
So what would be the minimum suggested length to make it worth wrapping the metaroom? And would making the height of the metaroom shorter make it less resource intensive & so maybe make it worthwhile to wrap a smaller room? |
Prodigal Sock
Ghosthande
|
6/22/2013 | |
Hmm, I can see why checking all objects every tick would be resource intensive... especially in a very large room. Is there any reason why it would be less practical to (for example) make a large invisible agent (or several such agents) that span the boundary area, and only check for agents touching them?
|
Peppery One
Papriko
|
6/22/2013 | |
And what happens when some genious isn't careful enough with kill hots? I think THAT'D ruin the illusion.
Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis... |
Moe
|
6/22/2013 | 1 |
Oh, actually, it does work on touch. Thanks for reminding me Ghosthande! It's been so long since I've messed with the code I had forgotten (it was one of the first things coded, after all). Still, it checks any agent touching it multiple times per second, and having such a large invisible object is not pretty on the sprite editor. I think C2toDS uses multiple smaller frames in an array of grab-ness.
But the real resource intensiveness comes from the cameras. That's why people notice lag when they reach the world boundaries.
As far as a minimum width, I'd recommend long enough so that even at the highest standard monitor resolution, both world boundaries can't be seen simultaneously (otherwise you'd see both sets of cameras and that would kill performance). So...at minimum 1600 width or more. I'd recommend 2000 and higher to be safe.
And people shouldn't be carelessly "kill hots"ing. It bothers me when people recommend that in the forums for community members wanting to delete agents. There are lots of things in C2toDS in particular that should not be killed but can easily be destroyed by a careless user. Can I program in safeguards? Sure, but I'm not going to. That's just more resources to check to see if an agent exists and to re-inject it. In my opinion, only coders and power-users should be using Kill Hots. You will screw up the birds, the calendar, the world wrap, the bees, the hummingbirds, the bats...and a myriad of other C2toDS agents if you kill the wrong agents. I'm not holding people's hands (pun intended). Kill hots at your own risk.
Sorry, didn't mean to rant, but like I said it bothers me that Kill Hots has become so commonplace, because it really is, if not always dangerous, destructive. I did code up a personal development command that works as a much safer, more selective Kill Hots that doesn't target things that shouldn't be destroyed...maybe the community could use it? I'll think about packaging it at some point, unless someone beats me to it. |
Peppery One
Papriko
|
6/22/2013 | |
Why do you use a huge frame? Use the default blank or blnk files and then CORE them bigger...
Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis... |
mfb
|
6/22/2013 | |
kill hots carelessness is what ject is for
given not terrible useful in the case of 3rd party metarooms/anything else that isn't a cos so I can understand the frustration.
Shee Tea Shop |
Moe
|
6/22/2013 | |
Not sure that would work, Papriko, but it's an interesting idea. Depends what the game means when it says "bounding boxes" and if it takes that "diamond" as literally in implementation for touching as it does for physical interaction. Either way, I think multiple "grabber" agents in an array works fairly more reliably, since each agent only has to worry about what is touching it at the time, if a flock of agents tries to cross the boundary, there are no inst etch lags. Makes things faster for the actual moving of objects I would think?
I would have to experiment. Might be pretty nice for meta-rooms that aren't very tall or have smaller crossover points. |
Chaotic Spriter
mea
|
6/23/2013 | |
Well, feel free to use my newest metaroom the Desert Ruins/Desert Wasteland to experiment with. It's just over 3000 pixels wide & has only two layers of rooms to worry about. |
|