Map Visuals


  • Dev Team

    We're excited to announce that MapVisual API is now live!

    0_1598815945391_2020-08-30_1139.png

    It allows you to draw simple graphics on the world map similarly to RoomVisual API. You can use it to display helpful infographics, debug info, multi-room paths visualizations, etc. It is available only in the new alpha version of the world map.

    Check out the documentation for Game.map.visual.

    👍


  • VERY NICE, look forward to trying it 🙂



  • This post is deleted!


  • I can't seem to figure out drawing unfilled (stroke only) circles.

    On room visuals I would do fill: null, but that gives me a black fill on the map.

    Anything I am missing?



  • Also: holy cow, is this my avatar on those Screenshots? 😄



  • Excellent! This is going to be so useful 😄

    @artch, is there any chance whilst you're working on the new map interface that you could make it so ctrl-clicking opens rooms in a new tab?

    👍


  • @artch, another request - can you make the mouseover popup always display the mineral type please, not just when in minerals mode? It's annoying having to change to mineral display mode just to check the mineral type for one room. How about putting it in the top-right next to where the control level goes?

    The new map interface is a big improvement!

    👍


  • It would be nice if we could pass a persistence option to visuals. Rather than having to draw stuff every tick, an option that says "draw the same thing for the next x ticks" would be great. It'd allow much more complex visuals without overhead.

    For example: I could draw a status of every room on the map based on scouting info. It'd be great for me to see what's going on at a glance. I'm probably not going to do it, and certainly not always on, because it's just too much CPU to run every tick. On the other hand, the data does not go stale quickly. Updating it once every 100 ticks would be more than sufficient for me.

    I'm not sure how visuals are implemented. The server tells the client something. I don't think it'd be too hard for the client to track persistence - wouldn't add server load and the 100kb limit could still be per-tick (ie. persisting visuals don't count).

    ☝


  • Looks like the options for Game.map.visual.rect() make it invisible if you only put in a position and size of width and length. I have to put in {stroke: '#ffffff'} in order to see it.



  • @tigga said in Map Visuals:

    It would be nice if we could pass a persistence option to visuals

    For map visuals this makes so much sense. They're often very expensive to generate, and they change infrequently.

    This mechanism would be somewhat useful for room visuals, but it seems critical for map visuals.


  • Dev Team

    @tigga This would be a nice addition, however it requires major refactor of how visuals data is stored on the backend, both room and map, they reuse the same storage. We recommend you to generate them only when needed and store in memory. Rendering itself (Game.map.visual methods) is not very CPU-consuming part, it simply makes a bunch of JSON.stringify.



  • Someone on slack pointed out the console.addVisual function, which would help a bit if it was "official" as it would allow doing as you suggest: you'd be able to save the object on heap and just pay serialize cost. Would be even nicer if we could just pass a serialized version ourselves 😉

    Without that you've got to recreate the object every tick. That's going to be expensive using the API calls for extensive visuals.


  • Dev Team

    @tigga Maybe one approach could be implementing two new methods Game.map.visual.export() returning a JSON strings block with currently constructed visuals and Game.map.visual.import(string). Do you think this will solve your issue?

    👍


  • @artch Yes - that'd be great!


  • Dev Team

    @tigga It's deployed to the official server.

    👏


  • Just wanted to let you guys know that map visuals are absolutely amazing. My map visuals can provide an instant overview about what is happening in my empire. It is absolutely game changing.

    Thank you for implementing it!



  • Map visuals are great. However, one has failed to locate a facility for enabling the map visuals permanently in the steam client. The map visuals are disabled again, once one enters the room and returns to the world map by perusing the "World" button.