ID:2047289
 
This week, pretty much my sole focus has been dealing with the big icon issue, which was looming as a big problem over 510's new lighting features--and it had been bugging a lot of users well before that.

As I mentioned in last week's post, the new method of handling big icons is to divide the map up into chunks in visual space (only counting the default client.dir=NORTH), and keep track of which objects are in view of it. Those of you who've been waiting on a solution can thank Ter13 for proposing the rough concept.

Where it stands right now, I'm both ahead of and behind the game. Ahead, because I got big turfs handled, which is something I really wanted to do sooner rather than later but had been planning to put off. Also, the webclient supports this new setup for objs and mobs, but not yet for turfs, and it wasn't my intention to handle the webclient that early at all; the obj and mob code simply fell out of what I was working on. And I'm behind because I wanted to put out a release yesterday, but I discovered in further testing that something was very wrong, and I had to hunt down that bug. Plus at this point, I'd prefer to make the webclient handle turfs too.

So while my goal was to get out a release this week, the real time to do that was yesterday--and since I found a bug that had to be fixed, that pushed it back. I could do a release with where things stand today, but because of the high-impact nature of this change, I can't in good conscience put it out on a Friday. Yes I know we're still in beta here, but I have too many bad experiences with Friday releases.

For those interested in what happens under the hood with how maps are sent to players, here's a quick overview. In the old way, turf maps were always sent as a big block--minus a chunk for the old block, if a full refresh wasn't called for. (Before version 505, changing any turf appearance or area in bounds caused a full refresh!) The turf field is padded a bit, so players can move around a little before an update. Also, turfs in an extended radius were checked for anything that had big/giant extents, and were added to a list of special turfs; the new system gets rid of that, and only sends huge turfs in view (or ones that hold any big/out-of-bounds movables in view). Movables were sent by looping through all turfs in view range (with a little padding), plus all special turfs, and sending them all to the client. That too has been changed, since now it's feasible to simply loop through all chunks in view and grab the movables from there.

One of the cool things that I discovered as part of this process, by which I mean something I discovered when tracking that bug yesterday, is that it's feasible for the client to display objects on another Z level if it's told to. And my chunk setup kind of dovetails with that as well, for turfs, or it can later on. Why is this important? Because one of my longstanding wish-list items is to eventually have a way to link up Z levels so that seamless transitions can be made from one map to another, making it easier to create an expansive RPG or action game. That's nowhere near on the horizon yet, but I like that we've moved more in a direction where it could be feasible someday.

Other development items remain on my list, but I went over all those last week. I hope to get to a bunch more things once 510.1328 is out.

Easter is coming up in three weeks. For a lot of people, that means a break from school. Make the most of it and get ready to do some serious game developing (or playing)! But until that happens, it's time to get your green on and play Irish folk music in the hopes of luring out a leprechaun with the promise of beer and cereal marshmallows. (I think that's how it works.) If you find a pot of gold at the end of the rainbow, or loose change in your couch, hopefully you'll send a little our way.
Thanks Ter13!
(Before version 505, changing any turf appearance or area in bounds caused a full refresh!)

That was me too, if I recall.

Those of you who've been waiting on a solution can thank Ter13 for proposing the rough concept.

No, Thank you, Lummox.

Any word on performance improvement of this approach? My gut tells me that chunking is going to create a pretty significant improvement performance-wise.

(When this comes out, I want to hear from you SS13 people and the folks over at Severed World about the difference)

Though, obviously the method I proposed initially that would have required a total messaging format change and observer tracking would have been far more significant an improvement.
hiiiiiiiiiiiii, Teeeerrrrrrrrr.
I won't know much about how performance is affected till this is out in the wild; I haven't run profiling tests and it'd be difficult to do so with any accuracy, especially given the number of games that can be impacted how how each may perform differently. To be honest I'm not sure if performance will end up slightly better or slightly worse.

A lot of the old behavior is still in play, in terms of the fact that the server goes through a list of objs or mobs, and then uses the same behavior it always has to flag it for appearance/step/etc. changes. For the time being at least, chunks are only strictly being used to determine if an object is in the chunk, but if it's changed, and turfs are only included in a chunk if they're exceptional (e.g. out of normal bounds). The turf map is still handled as a rectangle of turfs, and obviously sometime in the future I'd like to get beyond that for the sake of isometric performance.

One inefficiency in the new code, that I'd like to find a way to avoid, is that changing a movable's appearance at all automatically sets the dirty flag for its visible bounds, which means it'll get recalculated even for a minor change, and in turn that means if it's in any chunks already it'll get re-chunked. Hopefully this won't be too much of a headache on the server. Ideally, I'd like for this dirtying to happen only if the appearance changes to one with different bounds. That's checkable, so it may be something I can add for improved behavior. (Open question: Is it worth it? If an object is changing appearance there's often a good bet it's in motion too, or soon will be.)

The chunk behavior right now also tries to align on tile bounds, going by a chunk size that's intended to be 16x16 turfs. (The size is arbitrary.) I'd prefer to switch things up so I can use bit shifts instead of division when finding the lower left chunk. That's an optimization I can make later. Multiplication is still in play when recalculating a movable's bounds, though, because the tile size can be anything; that part obviously can't be changed.

I can say that one definite improvement is the way objs and mobs are handled. Instead of having to traverse a rectangle of turfs, it only has to traverse the chunks in view. Before, the code was traversing turfs it didn't necessarily need to--although it did have ways of skipping over uninteresting ones fairly quickly, so IMO it wasn't horrible. The new method is simply cleaner.

[edit]
One last thing I should mention is that transform changes in animations are really a wildcard here. The code that handles bounds does not try to accurately determine the maximum spread from one transform to another; instead it gets the before and after for each step, which is obviously a problem for rotations. The main reason: While it's mathematically possible to get an equation for x,y that boils down to terms of t, t*sin(n*t), t*cos*(n*t), and a constant, the math is not friendly, so I'm still working it out. I know how to use interval math to take it from there once I do figure it out, at least.
You do not know how happy I am that this is finally being fixed. Thanks for all the hard work! :)
could this possible mean a increase in map size from 1,000x1,000 to something higher?
bruh who needs a 1000x1000 map
some people do?
Lummox JR wrote:
One of the cool things that I discovered as part of this process, by which I mean something I discovered when tracking that bug yesterday, is that it's feasible for the client to display objects on another Z level if it's told to.

Yes!
Lummox JR wrote:
One of the cool things that I discovered as part of this process, by which I mean something I discovered when tracking that bug yesterday, is that it's feasible for the client to display objects on another Z level if it's told to.

WHOA WHOA WHOA hold the phone. Does this mean we could in the future be able to create a real stacked zlevel now? As in, a zlevel just above another which can show the lower one through a 'hole' in the floor.
WHOA WHOA WHOA hold the phone. Does this mean we could in the future be able to create a real stacked zlevel now? As in, a zlevel just above another which can show the lower one through a 'hole' in the floor.

Thanks to a lack of zbuffering in the render process, this would make overdraw a complete nightmare.
connecting z layers? Im down :)
We are but worms compared to Ter13
Lummox JR wrote:
one of my longstanding wish-list items is to eventually have a way to link up Z levels so that seamless transitions can be made from one map to another

In response to SuperAntx
SuperAntx wrote:
Lummox JR wrote:
one of my longstanding wish-list items is to eventually have a way to link up Z levels so that seamless transitions can be made from one map to another


Unrelated question but I figured it might go best here: Is it possible for client.screen atoms to respect loc and whatnot for visibility, and for a appearance flag to be added that prevents it from being visible in the world?
That sounds like two separate things. The answer to the first one is definitely not; it'd just be too complex to no purpose, since you can just as easily choose what to add to the HUD. I'm not sure what you mean about the second.
Well they'd go hand in hand, I just felt it might be the easiest solution to having things only specific clients can see, phasing if you will.
You'd add it to specific clients screens, then set a flag on appearance_flags that prevented it from being networked to other clients.
Nothing in appearance_flags could possibly prevent networking to clients. Adding anything like that would be hellish; it would be a bad thing for the server.
Page: 1 2