Changelog 2017-02-27

Memory segments

Introduced new memory segments feature:

  • You can have up to 10 MB of additional memory by activating asynchronous memory segments.
  • Each memory segment is a string with an ID from 0 to 99.
  • Maximum segment data length is 100 KB.
  • Segments are asynchronous, you should request them using RawMemory.setActiveSegments. The data will be available on the next tick.
  • You cannot have more than 10 segments active at the same time.
  • Active segments are available in RawMemory.segments object and are saved automatically.
  • Activating and saving segments have no added CPU cost.


// on the next tick
RawMemory.segments[3] = '{"foo": "bar", "counter": 15}';


You can use this feature to store data which is not needed every tick, for example pathfinding caches, or collected statistics. Offloading data structures from Memory to asynchronous segments will allow to save some CPU spent on Memory parsing.

Other changes

  • You can now create a RoomVisual object using the constructor without a roomName parameter and post visuals to all rooms simultaneously:

    new RoomVisual().circle(30,30, {fill: 'red'});
    new RoomVisual('W1N1').rect(10,10,40,40);

    This code will display both the circle and the rectangle in the room W1N1, and only the circle in any another room.

  • Changed RoomVisual.text method style options:
    • Renamed size option to font. It can be either a number or a string in one of the following forms:
      • 0.7
      • 0.7 serif
      • bold italic 1.5 Times New Roman
      • 20px sans-serif - absolute size in pixels
    • Added new stroke and strokeWidth options.
    • Added new backgroundColor and backgroundPadding options.


    new RoomVisual().text('Text 123', 10, 10, {
       font: 'bold italic .7 serif', 
       color: 'white', 
       backgroundColor: '#88ff88', 
       backgroundPadding: .3,
       stroke: '#005500',
       strokeWidth: .15         


These features are supported in private server v2.4.0.

Have more questions? Submit a request


  • roncli

    Did the changes to fonts make it so that fonts no longer scale with the zoom level?  I miss this feature greatly. :(

    [edit] Figured it out, you can't just send a size, you must send a type face, too. [/edit]

    Edited by roncli
  • ThyReaper

    I'm having issues with text visuals since the update. This line:

    new RoomVisual().text('Text 123', 10, 10, {font: '1 serif'});

    Renders text as expected, however these lines:

    new RoomVisual('W21N87').text('Text 123', 10, 10, {font: '1 serif'});

    Game.rooms.W21N87.visual.text('Text 123', 10, 10, {font: '1 serif'});

    Do not.


    It seems like it's only broken in my own rooms, but I don't see how or why that might be happening. Other visuals besides text work fine.


  • Helam

    I think roncli found this, but text wont show up anymore if you dont pass a style. Passing the 'font' option makes it show up again. Bug with the new update?

  • Avatar
    Artem from Screeps

    Thanks for reporting, must be fixed now.

  • W4rl0ck

    the documentation of RoomVisuals().text has a small mistake (

    there the backgroundColor property for style is documented as "background"

Powered by Zendesk