I currently have my game setup to have the view port scale based on window size. Looks great and everything, but people who have higher resolutions obviously have to display much more information and take a performance hit. Additionally, higher resolution players will have an advantage over lower resolution players.
Does Byond have any way to resolve this issue short of just making a static view port size of like 768x768? I'd realllyyy prefer to keep the scaling, but if possible make it so the view port only scales up to a certain point.
At 1920x1080, client.view gets set to 43x31. Is there a "golden ratio" in which we wouldn't see too much of a performance issue?
I reduced the size of the view port, and it's now 39x31 (which is 1,209 tiles in the view port).
Should I still be expecting performance issues with these dimensions if I had 50+ players on a server? I've got the UI anchors done already, just trying to figure out how much I need to reduce the view port size so players don't have stuttering |
Should I still be expecting performance issues with these dimensions if I had 50+ players on a server? That really depends on the client's machine, the machine the server is hosted on, how busy your map is, what your appearance count is, how fast appearances are churning, how many objects are present in the viewports of online players, etc. Too many unknown variables for me to give you a meaningful answer. Honestly, this is a topic that BYOND sort of teaches you to think about wrong. Your viewport size should always be inferred from the screen size, not a fixed value. I'm gonna prep an update to one of my snippet sundays that should help you with some of the new stuff that BYOND has done to help make viewport setup easier. Be back in a few hours. |
Right on, I'm always happy to learn, and this has been a giant pain in the butt to attempt to get right
|
Alright, I'm back.
I threw together a quick example project for you. I'll document the code here. //definitions: Next, let's go over some new client variables that we're adding to make handling dynamic view sizes a little more convenient: client With all of this set up, we're ready to add one verb and one proc to the client. client Because BYOND doesn't call on-resize or on-show when the interface is first created, we need to get the size of the map when the player first logs in and update their viewport accordingly. It's a short, simple proc call. client Alright, all of the code to make a configurable dynamic resizing viewport is done. We do need to do a little bit of work in your UI. Open up your DMF file and edit your default map element. 1) Make sure your default map element has anchors if you want it to be resizable along with your window. 2) In the events tab, we're gonna edit the on-size event. We're going to be using something called embedded wingets. These are something that Lummox implemented a little bit at a time for a few years until I requested that they be expanded into a fully-featured embedded interface querying system that allows us to minimize the number of times we need to talk back and forth between the client and server to do complex tasks. Don't worry too hard about understanding them, just read up on embedded wingets in the reference. There's some cool stuff in there. We're going to copy/paste a command string into the on-size-change event: onMapResize [[id]] [[is-default]] [[width as escaped]] [[height as escaped]] [[zoom as escaped]] What this does, is call the onMapResize verb when the event happens. It will send the name of the map element as text, whether it's the default element as a number (0 or 1), the width of the map in pixels as a number, and zoom as an integer. If you are interested in seeing my little demo project, feel free: Project included in library format for easy inclusion and in demo format if you just wanna poke around in the guts Also, I really don't recommend allowing users to change the size of the main window at will. I really recommend putting your project in borderless full screen mode and building a menu for changing the window size to the desired resolution if they want to kick into windowed mode. But that's work, and we're all allergic to it here. |
Use LEFT,BOTTOM,TOP,RIGHT screen_loc anchors to adjust the UI such that it doesn't care what size the viewport is.
You generally wanna keep < 1200 tiles in the view, but you can go bigger the fewer players you have.