ID:1969743
 
(See the best response by Kaiochao.)
Some code
                sky = background('Map Open1background NIGHT256.dmi', REPEAT_X + REPEAT_Y)
sky.width=256
sky.height=256
sky.px = -src.px*5
sky.py = -src.py*2
sky.owner=src
sky.show()

Readme
Background
vars
image/image
This is how the background image is displayed. If we just used
objs, every other player would be able to see your background. So,
we use images and attach them to an obj. You shouldn't ever have
to access this directly.

obj/object
If we used an obj to display your background, every other player
would be able to see it. So, we leave this obj blank but attach
images to it. The mob's set_camera proc adjusts the position of
this object to position the background based on px and py. You
shouldn't ever have to access this directly.

mob/owner
The mob that the background image is displayed for. Because the
position of the background can be different for different players,
you need to create a /Background object for each player.

px, py
The offset of the background image in pixels. By default (0, 0) the
lower left corner of the image is in the center of the screen.

width, height
The width and height of the image used to create the background.

procs
hide()
Removes the image from the owner's image list and removes the
/Background object from the owner's backgrounds list.

show()
Adds the image to the owner's image list and adds the /Background
object to the owner's backgrounds list.


Some words
I believe this line of code is more or less a direct copy of forum_account's sliding background demo. I have played with it extensively, read over the readme as well as the changelog extensively and still haven't gotten it to work the way I want it to.

Without any edits to the library, I believe it's impossible to edit the speed at which objects move. Which is a problem since not all background layers should move at the same speed and when they do, it's visually displeasing(A forest directly behind the player should move faster than the mountains on the horizon). Although, if you can edit this speed, please elaborate to me on how to do so.

Although, the speed at which the background moves is not my main concern: What I'd primarily like to do is have is to either:
1. Increase the amount of backgrounds displayed at once in order to cover the surface area needed OR
2. Line up two separate backgrounds which do not overlay one another in order to replicate the same thing, I believe this method shouldn't require an edit to the library.

        // depending on the scroll_mode we need to create
// overlays to cover additional area:
//
// +---+ +---+---+
// | | | | |
// +---+ +---+---+ +---+ +---+---+
// | | | | | | | | | |
// +---+ +---+---+ +---+ +---+---+
// none: X: Y: X + Y:
//


In other words, instead of just X + Y, I'd like to have X + X + Y + Y, 8 boxes instead of 4.

I can replicate this by making my backgrounds 512x512 instead of 256x256 but this does not allow for me to edit my backgrounds directly in Dream Maker, which isn't preferred but something I can always fall back on.

So what's up guys, I know a fair share of the community is not overly fond of Forum_Account's libraries, although some of his libraries like this one in particular are unique and have yet to have someone replicate them. So please keep your concerns directed at my questions rather than the fact that I shouldn't be using these libraries in the first place.

Edit: Here is the full library:
// File:    background.dm
// Library: Forum_account.Sidescroller
// Author: Forum_account
//
// Contents:
// This file contains the code for creating background
// objects. The code for updating the positions of
// background objects is in pixel-movement.dm

var
const
REPEAT_X = 1//1
REPEAT_Y = 2

// The /Background object contains the actual object
// and image that are the visual background display, it
// also contains size and position info. To move the
// background you change the px and py vars and the
// set_camera proc adjusts the background accordingly.
Background
var
obj/object
image/image

width
height

px = 0
py = 0

mob/owner

repeat = 0

New(mob/m, i, scroll_mode)

owner = m
repeat = scroll_mode

var/icon/I = new(i)

width = I.Width()
height = I.Height()

object = new()
object.animate_movement = 0
object.layer = 0

image = new(i, object)
image.layer = 0

// depending on the scroll_mode we need to create
// overlays to cover additional area:
//
// +---+ +---+---+
// | | | | |
// +---+ +---+---+ +---+ +---+---+
// | | | | | | | | | |
// +---+ +---+---+ +---+ +---+---+
// none: X: Y: X + Y:
//
if(scroll_mode & REPEAT_X)
var/obj/o = new()
o.layer = 0
o.icon = I
o.pixel_x = width
image.overlays += o

if(scroll_mode & REPEAT_Y)
var/obj/o = new()
o.layer = 0
o.icon = I
o.pixel_y = height
image.overlays += o
if(scroll_mode & REPEAT_X)
var/obj/o2 = new()
o2.layer = 0
o2.icon = I
o2.pixel_x = width
o2.pixel_y = height
image.overlays += o2

Del()
hide()
del image
del object
..()

proc
show()
if(owner && owner.client)
owner.client.images += image
owner.backgrounds += src
image.layer=1

hide()
if(owner && owner.client)
owner.client.images -= image
owner.backgrounds -= src

mob
var
list/backgrounds = list()

proc
// This creates and returns a new /Background object.
background(i, scroll_mode = 0)
if(!client) return

if(scroll_mode == 0 || scroll_mode == REPEAT_X || scroll_mode == REPEAT_Y || scroll_mode == REPEAT_X | REPEAT_Y)
return new /Background(src, i, scroll_mode)
else
CRASH("[scroll_mode] is an invalid value for scroll_mode. Use zero or the REPEAT_X and REPEAT_Y constants.")

// This proc exists to be overridden. By default it does
// nothing but it's called from set_camera to give you a
// chance to adjust the px/py of backgrounds every time
// the camera moves.
set_background()
I do like his libraries a lot, despite the fact that he was kind of a dick on the forums. They're generally very well organized and clean and easy to read. I make extensive use of his backgrounds, as a part of his sidescroller library, in this old contest entry.

I implemented the parallax scrolling backgrounds with his library by overriding his mob.set_background().

Here's what mine ended up looking like:
            set_background()
var/spx, spy
spx = camera.px
spy = camera.py
if(fore1)
fore1.px = -spx * 1.3 -400
fore1.py = -spy -75
fore1.setLayer(3000)

if(back1)
back1.px = -spx * 0.7 -400
back1.py = -spy * 0.2 -300
back1.setLayer(1.4)

if(back2)
back2.px = -spx * 0.6 -400
back2.py = -spy * 0.15 -300
back2.setLayer(1.3)

if(back3)
back3.px = -spx * 0.5 -400
back3.py = -spy * 0.1 -300
back3.setLayer(1.2)

if(back4)
back4.px = -spx * 0.4 -400
back4.py = -spy * 0.05 -300
back4.setLayer(1.1)

if(back5)
back5.setLayer(1)
back5.px = -400
back5.py = -300


The coefficients to spx and spy determine the speed at which the background scrolls. The smaller this coefficient, the further away the background will appear to be.

camera is from Forum_account's sidescroller library.
Best response
Without any edits to the library, I believe it's impossible to edit the speed at which objects move. Which is a problem since not all background layers should move at the same speed and when they do, it's visually displeasing(A forest directly behind the player should move faster than the mountains on the horizon). Although, if you can edit this speed, please elaborate to me on how to do so.
The library doesn't move the backgrounds. You move the backgrounds in set_background() as shown in background-demo/demo.dm, so you have full control over how fast each background moves.

demo.dm:
    // This proc is automatically called each tick to give you
// a chance to set the px and py of each background object.
set_background()
if(my_background)

// The background object isn't an atom, but it has px and py vars.
// These vars set it's position relative to the center of the player's
// screen. We set their values based on the player's position so the
// background scrolls as you move.
my_background.px = -px * 1.2
my_background.py = -py * 1.2


As for your main concern, you just have to create backgrounds (for() loop) until the size of the image exceeds the client's view size.
* If you ever change the client's view size, you'll have to regenerate your backgrounds.
* You can get the size of the client's view using client.bound_width and client.bound_height (in pixels). Divide this by the background icon size and ceil the result to get the required number of repetitions.