The only way to make it efficient is to have movement handled on the client. As long as the server handles everyone's movement (and as long as you have to reduce world.tick_lag to make it smooth) there's no way to make it as efficient as people wish it could be (whether it's native or not).

It sounds like there are some internal things holding BYOND back when it comes to things like this, but its hard to tell. While I was making my library, I tried to think "what new built-in procs would make this easier?", but I couldn't come up with anything. There just seems to be some general slowness in how certain things are handled. There's no reason why dreamseeker should struggle to run at 30 fps. If these things were improved, it would help everything, not just user-made pixel movement.
Forum_account wrote:
The only way to make it efficient is to have movement handled on the client.
Open client sided processing would cause so many other problems, complicate the language, and offer so few benefits that its hardly a feasible solution, especially for this specific feature. In vast majority of cases, it would actually offer far worse "performance" due to the networking requirements alone.

Honestly, if they were willing to take just a few simple steps, we could probably build our own competent pixel movement systems, but since they aren't, we might as well just get them to do everything (its probably never going to happen one way or the other) - not to mention the countless benefits that a built-in implementation would provide.

As for performance/ticks, maybe they could just remove that processing limit to begin with. Instead of sitting around for 99% of an unused tick, that time could be spent processing the next one - that is how most (if not all?) actual games work, and if I'm not mistaken, BYOND's internal processing works that way as well.
This is already done in pixel_move(). The first line inside the loop is:

if(dpx == 0 && dpy == 0 && dpz == 0) break

Sorry, it's nearby()that bring sup the issues.

After checking it, it seems that the break you have here does save a bit of time but nearby() and the bumping checks are still called since the break check happens after everything is said and done. To skip this, I added a similar check to movement just before pixel_move() which cancels any bumping checks entirely if you're not moving.

It cut down the cpu jumping from 0-14 (at any time) to 0 (while not moving).

As for nearby() it's practically the same, except it does if() checks for vel_x and vel_y. Total of 4 if()'s seems to take only nanoseconds longer but can result in using 3 less turfs (and their contents)for the check, which saves more time than it uses. It's only a noticeable change with multiple mobs.
I could add a similar check before the for loop in pixel_move to avoid the call to nearby. The problem with not checking some tiles because you aren't exactly moving towards them is that those tiles may contain atoms that you would bump into. The CPU cost is from the call to nearby and the cost of it returning a list (it makes a lot of lists for the garbage collector to clean up). Whether the list has 6 or 9 items won't make a difference - especially when the loop is exited on the first iteration.
Also, Forum_Account's pixel_movement is competent, but due to byond being as slow as it is, p_m is hampered and slow. For single-player games it works fine and dandy but multiplayer is damn near impossible with it due to how much the server has to handle all at once.

If client side operations were to be done with pixel_movement, the clients would do the calculations and the server would apply the move after making a check of its own to make sure the numbers it's getting aren't going to make you fly around a server.

Then again, this sometimes happens already when a game gets overloaded with players, it's to be expected.

Don't get me wrong, I don't think it's a quick/easy/efficient fix, but it'd be a start.

All of this arguing over whether or not things should be done is what's killing the progress, because no one seems to be settling on an idea so that we can actually progress.

We wouldn't ask for this feature if it wasn't necessary. We have a good pixel movement system that is, even now, still getting better, but it's only getting better because of how much byonds internal code holds it back.

on Library usage:
Libraries are nice, they help you do something without having to do all the work yourself, but don't take it as if we give up on doing any work at all. Libraries are tools to be used, but not exploited. pixel_movement is a great example, I could have made something much like pixel_movement , but instead of wasting my time on it, I picked it up and changed it to meet my needs.

Consider this: If you buy a car and then soup it up with a new engine, new intake, exhaust, a turbo, etc. Am I any less of a mechanic because I didn't build the car from scratch? Hell no, why build a car from scratch if you have a perfectly fine framework sitting there for you to use freely?

I do dislike when people buy a car, put new rims on it and say "I built that", but there is varying degrees of this labeling a modification a ripoff just because it still resembles the original is a little over-the-top and presumptuous.

Back to "make a competent library instead of asking them to add in pixel movement":
Another car analogy, sorry but it fits: Let's say I build a turbo for a car and install it. The car now runs fantastic from 0-60 but can't go any faster because the turbo would pull in WAY too much air. Saying the turbo is crappy is never a reasonable response. The engine has it's limits and should be modified to broaden those limits to allow the turbo to do its job.

in this case we're not asking to modify the engine to fit the turbo, we're asking to build the turbo into the engine on standard. We can modify the engine to better support the turbo but ultimately it'll be better off with one that's built in because it will be designed specifically with THIS engine in mind, not just any other engine.

Sorry if it doesn't make sense I'll give you some help:

tl;dr The best solution to this argument is to add pixel based movement in. Yes, there are other ways to add support for the library, but ultimately it's going to run a lot better if it's hard-coded as soft-coded systems will always be at a disadvantage.
Bravo1 wrote:
For single-player games it works fine and dandy but multiplayer is damn near impossible with it due to how much the server has to handle all at once.

A Miner Adventure runs just fine. It even has dynamic lighting and flowing water, which account for more of the CPU and bandwidth usage than the pixel movement.

The best solution to this argument is to add pixel based movement in. Yes, there are other ways to add support for the library, but ultimately it's going to run a lot better if it's hard-coded as soft-coded systems will always be at a disadvantage.

Any game would run better if it was written from scratch instead of using DM, so it's hard to justify that a feature would be better implemented in DM than as part of BYOND itself. Still, there are two points worth considering:

1. Is it worth the BYOND staff's time? There are some features we can't make ourselves in DM. Why should the staff spend their time working on a feature we can already make?

2. How useful will the native feature be? Making it built-in might make it faster but can limit its flexibility. Look at how opacity works - because it's all built-in there's no way to customize the visibility calculations. If you want them to work differently, you're out of luck. Would a pixel movement implementation turn out the same way?
1. Yes it's worth the time. Tile based movement is an archaic at best.

2. It'd be incredibly useful, over a third of the new games coming out are using pixel movement that could be a higher number if we had a much smoother system.

As for speed issues with a miner adventure, Isometric maps seem to have a lot of trouble with pixel_movement.
Bravo1 wrote:
1. Yes it's worth the time. Tile based movement is an archaic at best.

I agree that the feature is a good one, but the question is: would it be the best use of the staff's time to implement this? The best case is that they spend several months to add a feature that many people have already implemented themselves. Why bother? In that time, they could instead add features that would be much more difficult (and sometimes impossible) for people to add themselves.

2. It'd be incredibly useful, over a third of the new games coming out are using pixel movement that could be a higher number if we had a much smoother system.

I don't think speed is what's stopping two thirds of BYOND users from using pixel movement. There are many BYOND games that use pixel movement, so its very hard to make the argument that user-developed methods cannot be sufficient - there's already proof that they are. The problem I was getting at with this question is something I've brought up before:

If the feature is built-in and flexible you get very little performance benefits because developers will have to override many of the procs to make the system work how they need it to work. The server is still executing DM code, so this won't be any faster than a completely user-made implementation could be. If the feature is not flexible you can get better performance, but you'll have to make a BYOND feature request every time you want the pixel movement to behave a little bit differently (imagine if you couldn't override Move or Entered and had to make BYOND feature requests instead, sounds like fun, right?).

Some features are better implemented in DM than added natively as part of DM, this is one of those features. It's the reason why BYOND doesn't come with an Attack() verb - there are many ways you'd want it to work, so you just have to make it yourself (that's why we have the DM language). We can probably find some features that the BYOND staff could implement to improve the performance of user-made pixel movement systems, but that's not what is being asked for (or discussed) here.

As for speed issues with a miner adventure, Isometric maps seem to have a lot of trouble with pixel_movement.

I'm not sure what you're getting at there. Can you elaborate?
Forum_account needs to be banned from posting in this topic. He has done nothing but constantly attempt to shut down this request by making the same idiotic points. Points which countless people have already smacked down numerous times.
The only reason he is even against this request to begin with is because he has already made a sub-par pixel movement library of his own, and doesn't want a competent replacement system being released. "THERE WON'T BE A BUILT-IN PERFORMANCE INCREASE, IT WON'T BE FLEXIBLE, MY PIXEL MOVEMENT LIBRARY IS THE BEST THING EVER MADE BY ANYONE ANYWHERE EVER, THIS FEATURE REQUEST IS TERRIBLE". Yea, we've heard your objection to improving the engine. If you want to keep spamming this topic, then at least come up with some legitimate/new counter points.
And now half of his conversation has degraded into a discussion with Bravo about how the coding in his library is terrible, and needs basic improvements to be feasible even when idle.

Its been over 2 months since this was requested, if they had started working on it day one, instead of listening to various idiots pointlessly argue against such a blatant improvement, it would probably be finished by now.
Well, I've had to scrap pixel movement in an isometric game before due to speed issues, then again that game was meant to be multiplayer.

It seems that with more than 5-6 players at a time, he game will start to slow down or have adverse effects to the controls.

One such effect was that, when removing your finger from a movement key your mob would stop, walk again for a fraction of a second and then stop again. It caused some really bad effects to the combat system and ultimately it had to be removed and replaced with an adaptive version of the tile based movement.

Something about the way isometric maps are processed visually makes them more taxing on the cpu for each tick. I've noticed I can load images on every turf for a lighting system and have it work completely fine in a 2d map, but isometric maps will have noticeable slowdowns, unless you're standing near the edges of the map. Perhaps it's because of the sheer number of visible tiles with isometric maps, I'm not sure.


Either way, if you wanted to have a game with more than 20 players, even if it's tile based, pixel movement would slow things down way too much to be playable.

I ran several tests with just pixel movement working with my game Darkness. Once there was 15+ mobs on the map the game would slow down considerably, being completely unplayable after 30+ mobs.

Most multiplayer games out there easily support over 50 players on a server at once and it doesn't seem like pixel movement will ever be able to handle that unless you're sitting on a 6ghz single core cpu, of which I don't think there are many within a feasible price range for developers.

As for making it flexible and fast, it's all up to how they want to implement it. There are ways to get both but it sounds like the biggest argument against pixel based movement is: "It's too much work" when, honestly, it'd be one of the most beneficial things byond has ever implemented.
Also F_A's pixel movement isn't sub-par, it's fantastic, but due to the limitations of the engine supporting it, it's slow on large scale games.
Bravo1 wrote:
Perhaps it's because of the sheer number of visible tiles with isometric maps, I'm not sure.

That would be my guess. The same problem would happen in top-down games, it just took a lot more objects or a larger view to get it to happen. There was a BYOND bug that caused controls to be unresponsive when the client couldn't keep up with drawing the screen, but that should have been fixed (several updates ago).

Most multiplayer games out there easily support over 50 players on a server at once and it doesn't seem like pixel movement will ever be able to handle that

1. Increasing the framerate will lower how many players you can support. Whether pixel movement is built-in or not you'll have to increase the framerate (try playing Darkness at 10 fps and see how choppy it is :-D), so a more limited player count is something you'll have to deal with no matter what.

2. My library could use a bit of optimizing. It hasn't been a big concern to me, but I've been looking into it more lately. I also suspect there are many issues with BYOND that'll only be uncovered and fixed as more games use higher framerates (ex: the issue with unresponsive input mentioned above).

Also F_A's pixel movement isn't sub-par, it's fantastic, but due to the limitations of the engine supporting it, it's slow on large scale games.

Thanks! If you have some examples of things that performed more poorly than you expected, I'd be curious to see what you were doing - either to find a soft-code optimization or see if something in the library itself should change to improve performance.

As for making it flexible and fast, it's all up to how they want to implement it. There are ways to get both...

That's the problem, finding a way to get both. So far, nobody has explained how that would work. The current, tile-based movement system is fast because it's simple, not because it's built-in. People assume there would be an automatic performance gain by making it built-in but its not that easy.
Bravo1 contributed,

"Also, Forum_Account's pixel_movement is competent, but due to byond being as slow as it is, p_m is hampered and slow. For single-player games it works fine and dandy but multiplayer is damn near impossible with it due to how much the server has to handle all at once.

If client side operations were to be done with pixel_movement, the clients would do the calculations and the server would apply the move after making a check of its own to make sure the numbers it's getting aren't going to make you fly around a server.

Then again, this sometimes happens already when a game gets overloaded with players, it's to be expected.

Don't get me wrong, I don't think it's a quick/easy/efficient fix, but it'd be a start.

All of this arguing over whether or not things should be done is what's killing the progress, because no one seems to be settling on an idea so that we can actually progress.

We wouldn't ask for this feature if it wasn't necessary. We have a good pixel movement system that is, even now, still getting better, but it's only getting better because of how much byonds internal code holds it back.

on Library usage:
Libraries are nice, they help you do something without having to do all the work yourself, but don't take it as if we give up on doing any work at all. Libraries are tools to be used, but not exploited. pixel_movement is a great example, I could have made something much like pixel_movement , but instead of wasting my time on it, I picked it up and changed it to meet my needs.

Consider this: If you buy a car and then soup it up with a new engine, new intake, exhaust, a turbo, etc. Am I any less of a mechanic because I didn't build the car from scratch? Hell no, why build a car from scratch if you have a perfectly fine framework sitting there for you to use freely?

I do dislike when people buy a car, put new rims on it and say "I built that", but there is varying degrees of this labeling a modification a ripoff just because it still resembles the original is a little over-the-top and presumptuous.

Back to "make a competent library instead of asking them to add in pixel movement":
Another car analogy, sorry but it fits: Let's say I build a turbo for a car and install it. The car now runs fantastic from 0-60 but can't go any faster because the turbo would pull in WAY too much air. Saying the turbo is crappy is never a reasonable response. The engine has it's limits and should be modified to broaden those limits to allow the turbo to do its job.

in this case we're not asking to modify the engine to fit the turbo, we're asking to build the turbo into the engine on standard. We can modify the engine to better support the turbo but ultimately it'll be better off with one that's built in because it will be designed specifically with THIS engine in mind, not just any other engine.

Sorry if it doesn't make sense I'll give you some help:

tl;dr The best solution to this argument is to add pixel based movement in. Yes, there are other ways to add support for the library, but ultimately it's going to run a lot better if it's hard-coded as soft-coded systems will always be at a disadvantage."


Koil replied with,

"I believe Gooseheaded's game uses FA's pixel movement library and it's multiplayer and runs just fine.

The feature isn't necessary. The BYOND suite is capable of making excellent games without the need of pixel movement. The problem is the lack of projects actually being developed, which isn't going to suddenly decrease if we have access to built-in pixel movement."

Koil wrote:
Bravo1: tl;dr The best solution to this argument is to add pixel based movement in. Yes, there are other ways to add support for the library, but ultimately it's going to run a lot better if it's hard-coded as soft-coded systems will always be at a disadvantage."
Koil: "I believe Gooseheaded's game uses FA's pixel movement library and it's multiplayer and runs just fine. The feature isn't necessary. The BYOND suite is capable of making excellent games without the need of pixel movement. The problem is the lack of projects actually being developed, which isn't going to suddenly decrease if we have access to built-in pixel movement."

I somewhat agree with Koil. At the same time I was hosting using ATP host and CPU was increasing as time went on. The game played fine with 4 players but still reached around 15% CPU usage at one point. The system would be better built in so that CPU could be used somewhere else besides movement. And were not saying that the number of projects would suddenly increase but the quality of the projects certainly would.
I'm referring to games with 20+ players, which I've said before but people seem to continue to disregard.
Whether we're talking about a user-made feature or a built-in feature, people have unrealistic expectations of what is possible. Consider how much time you're giving the server to do things. If you want the game to run at 40 fps with 30% CPU usage when 20 players are connected:

40 fps = 1000 ms / 40 ticks = 25 ms per tick
30% of 25 ms = 7.5 ms

Each tick you have to do all of the processing in 7.5 milliseconds. With 20 players you'll have at least 20 mobs. If you figure there are 2 enemies (moving ones, at least) per player and one projectile (on average) per player, that's 80 total mobs.

7.5 ms / 80 = 0.09375 ms = 93.75 microseconds per mob.

Let's think about what you can do in 93 microseconds. Here's a simple proc:

proc/test_proc()
var/list/l = list()
for(var/obj/door/d in oview(2,src))
l += d

var/obj/door/d = pick(l)
return d


I ran it many times with 3 instances of /obj/door being in oview(2) and it averaged 22 microseconds per call. It's a little bit contrived so this proc is obviously not that useful - the point is to show the amount of processing you can get done in 22 microseconds (check a 5x5 region for objects, add three to a list, then randomly pick one). If this is what you can accomplish in 22 microseconds, it'll be hard to get anything meaningful done in ~94 microseconds. When you consider what would need to be done to check for collisions and handle each mob's AI (or whatever else is being done each tick), 94 microseconds isn't a lot of time. People assume that things will be super-fast because they're built-in, but:

1. That's just not true. If all code written in c++ was fast and the .dmb interpreter was written in c++, DM code would be fast too. I wish it was that easy :-)

2. Even if the feature is built-in it'll be calling procs like Enter, Entered, Move, etc. and these'll take up some amount of time. Not much time, but we're talking about microseconds here. The performance gain won't be tremendous (maybe double).

Assumptions that were made:

1. 40 fps. That's a little high, but you'd want the framerate to be at least 25-30.

2. 30% CPU usage. For a crowded server that's a little low, but it depends on how high the spikes will be. If the CPU usage isn't very spiky you wouldn't have a problem sustaining 50-70% CPU usage. If players have some complex abilities that spawn lots of objects, the spikes could be high and you might want to keep the general CPU usage lower.

3. 20 players connected. I consider that high, but some people consider it low (not every game is an "MMO-")

4. 2 enemies and 1 projectile per player mob. This sounds low but it depends on the game. When you figure that 20 players is a little high it all evens out.

If you do the math again for 30 fps and 50% CPU usage, you get 208 microseconds per mob. This is certainly doable. The first example (30% usage for 40 fps) is possible too (even with a user-made DM implementation), but you probably won't get much better than that. Staying with the assumption of four moving mobs per player, we're still talking about player limits in the 30-40 range.

The biggest ways to improve this:

1. Multi-threading and support for multi-core CPUs. There's some overhead required for coordination, so using a 4 core CPU won't improve performance by 4x, but it'll help tremendously.

2. Offload processing to the client. If every client is responsible for calculating the player's movements and some visual effects, this client-server model becomes a lot more scalable.

The first option is probably the best way to go. Generally, speed problems like this can be solved by waiting for better hardware, but better hardware comes in the form of multi-core CPUs. I have no idea how feasible it is, but it makes a lot more sense than built-in support for pixel movement (the built-in feature will still be slow because it's not effectively using the CPU - it'll be a one-time minor improvement to one aspect of BYOND).

tl;dr Having games run at 10 fps has spoiled you! No matter what we're talking about (pixel movement, AI, pathing, attacks, special effects, etc.), you'll find that you can get away with a lot when the game runs at 10 fps. When you want the game to run at a decent framerate, performance becomes more and more of an issue.
Forum_account wrote:
Having games run at 10 fps has spoiled you! No matter what we're talking about (pixel movement, AI, pathing, attacks, special effects, etc.), you'll find that you can get away with a lot when the game runs at 10 fps. When you want the game to run at a decent framerate, performance becomes more and more of an issue.
No, BYOND failing at life has deluded you. Unity can process all of those things in excess of 1,000 frames per second. Plus throw in actual particle effects (not just animated icon_states), dynamic lighting/shadows, actual 3D graphics, multiple cameras, intuitive HUDs/GUIs, and much more... Even Minecraft can easily run at several hundred frames per second, and trust me, its far more complex than anything on BYOND. They all use pixel movement, just like 99.9% of every other video game ever made since the beginning of time. Most of the performance issues for 3D games come into consideration when processing the actual graphics, not when trying to run a simple loop once a second to see if you're in front of a door.
Falacy wrote:
Even Minecraft can easily run at several hundred frames per second, and trust me, its far more complex than anything on BYOND.

The reason BYOND's framerate is limited is because the client's refresh rate is tied to the server's ticks and the server is responsible for processing events for all clients. Dreamseeker can render the screen more than 100 times per second, but the server can't process all events for all clients 100 times per second.

In Minecraft, the client renders the screen (and likely manages its own movement) independent of the server. When I mentioned the option of BYOND having each client be responsible for its own movement (which is the benefit of Minecraft's design you are describing here), you said:

"Open client sided processing would cause so many other problems, complicate the language, and offer so few benefits that its hardly a feasible solution, especially for this specific feature. In vast majority of cases, it would actually offer far worse "performance" due to the networking requirements alone."

Minecraft is good because the client has more responsibilities, but making the BYOND client responsible for the same things would have "so few benefits" and not be "a feasible solution". I do agree that having the client handle movement isn't the way to go (though it'd work) because BYOND's benefit is that the server handles everything. It's because of that simplification that making a BYOND game is so easy, but there are obvious performance drawbacks.
Multi-core processing won't be feasible except for internal operations that can run in parallel. That basically means stuff like icon operations, which we now offload to the client as much as possible. To parallelize that kind of thing though we'd still need to basically have a setup where the processing could split up but the main thread waited until all the workers were ready. Anything like allocations, deallocations, and interpreting code still has to be done single-threaded.
Forum_account wrote:
The reason BYOND's framerate is limited is because the client's refresh rate is tied to the server's ticks and the server is responsible for processing events for all clients. Dreamseeker can render the screen more than 100 times per second, but the server can't process all events for all clients 100 times per second.
You seem to somehow be going under the assumption that processing in these other games isn't tied to the rendering frame rate? I can't speak for Minecraft's, but I know that for Unity that is the case. Each frame, the main Update function(s) you have setup are processed, the GUI is reprocessed, and all cameras are re-rendered, etc.

Minecraft is good because the client has more responsibilities, but making the BYOND client responsible for the same things would have "so few benefits" and not be "a feasible solution".
Until recently, Minecraft's multiplayer was quite fail compared to its single player, for a lot of the over complication reasons by comparison. It also runs 10s of times faster, and most likely has some competent network pre-processing, which I doubt client sided BYOND games would have - leading to a spam of already overwhelmed network traffic (more inbound than out, though), decreased performance, and even laggier games - especially on poor connections.
Page: 1 2 3 ... 6 7 8 9 10