CS 404/504 Games and Virtual Environments Homework #4
Due: 3/11/11, 5pm. Turnin is by e-mail and forum posting. Remember to
put your NAME in a comment at the top of your document(s).
This first virtual environments assignment includes two tasks that
may be done in parallel.
1. SecondLife
Go through the basic movement tutorial (tutorial island).
E-mail me your SL user name. I will add you to the list of folks with
permission to build stuff on my lot. Find and go to Dr. J's property
("Clint Jeffery's Place") in a zone called Crumbi at location 234,50.
Recommend you search for and teleport to adjacent region "Fishii"
and then head north into Crumbi. The propert is near Crumbi's southeast
corner.
Read about LindenScript and how to create virtual objects in SL.
Suppose we want to create a virtual chair that approximates a real
chair, how do we do it?
2. Build a Very-Small-Scale CVE-compatible Model
The purpose of this exercise is to introduce (that means this is
phase 1, we will add details in later phases) simple brute-force
3D modeling, with the notion that we would be the ones writing the
engine that renders it.
Code-wise, you are to download and use the
jeb1,
jeb2, or
jeb3
demos, probably start with jeb1.
Functionalitywise, you are to select and depict one of the following
Treasure Island locations
- Admiral Benbow Inn
- The tavern where the story starts. You could go model a real local
tavern, or design one from scratch. In Phase 1, you are looking for the
basic room structure, the textures for the floor, walls, and ceiling, and
"decorations": art objects such as (textures of) windows, fireplaces,
carpets, etc.
- The good ship Hispaniola
- With a basic layout allowing key plot points to occur, Probably there
is at least a "deck" and a "hold" with access between them.
- The treasure island
- The island in the book was fairly large. We probably need at least a
beach, a hut, and a cave, if I recall correctly.
- model your location; establish its basic position and dimensions
- (for inn and ship) identify adjacencies and connect rooms and make
them reachable
from the rest of the model via door(s) or opening(s).
- collect textures for your location. Class Rule: you may not use textures
for which you do not have legal rights. Write games about pirates,
but do not pirate anything yourself.
- add virtual tables, chairs, plants, etc. as needed in your room.
You will need to put your room into CVE's dat/uidaho model format
in your local/standalone client (jeb1, jeb2, jeb3, or cve).
Some Guidelines
- This assignment is largely inventing (or measuring), gathering and
collecting data. Doing a good job may be difficult.
- A rectangular area's basic dimensions are x,y,z,l,h,w where x2=x+l
(l is length), y2=y+h (h is height), and z2=z+w (w is width). Please use
units of meters. Given a floor plan or other 2D top-down birdseye view
sketch,
you can use the FHN program to get your x,z and
the x2,z2 from which l and w are computed by subtraction.
- . "y": you will have to decide how high the ceilings are, and how much
space between floors.
- You will need a lot of textures. One way to get them is to take a lot
of digital camera photos. You can also find textures on the internet.
- Digital camera images require image editing work before
they are usable in a virtual environment. MS Paint is OK for low-end
stuff; so is a X11 tool called "xv" if you can still find it.
The Gimp turns out to be a quite splendid free image editor;
Adobe Photoshop is a market leader among commercial tools.
Photos that will eventually be used as textures need to
(a) focus on a particular surface,
(b) be taken "straight on", not at an angle, (c) minimize glare due to
lighting, and (d) shoot at lower resolutions. Eventually all textures will
have to be edited into nice clean small images whose length and width are
powers of two. For this assignment we are not going to be picky (yet).
Example Room Model
This is from UI Janssen Engineering Building; the closest analog would be
the Admiral Benbow Inn.
Jeffery decides to model SH 230 (Jeffery's office). He scrutinizes
the contents of the room, looking for the hight points, and produces the
following sketch.
North is upside down in this picture, which was drawn from the point of
view of sitting in Jeffery's office chair.
Besides knowing which axes are which (i.e. that north is upside down),
unless the room is the only location in the whole program,
a localized room model like this would usually need world coordinates
that determine its position in the world. You could skip this in a HW4
that wasn't tying all the locations together.
For the JEB example, the FHN program, applied to the JEB floor plan bounding
points of JEB 230, gives (x,z)
coordinates of (26.6, 11.3). Does this make sense? I guess
so; due to the building's L shape, JEB 230's north-facing window does not imply
a z value of 0. For a y value, Jeffery goes with 40.5 feet (13.5 feet per
floor for Ground, 1st, up to 2nd) = 12.3 meters up. The room's height of
11.5 feet is = 3.5 meters.
Jeffery decides there are really 3 rectangular "Room" objects to
model in order to reach the main corridor: the jeb230 (large almost-square),
jeb228 (thinner, former secretary area, nearer the main corridor), and the
mini-corridor the two doors open out into. It is probably useful to start
with the first one, and then add rooms piece-by-piece.
Room {
name JEB230
x 26.6
y 12.3
z 11.3
w 3.15
h 3.5
l 3.93
}
Placing this in a file named jeb.dat, Jeffery tests his work on the
jeb1 demo program. He gets a generic room, quite small, with walls that
don't look like this room...but it is a start.
Jeffery gets a $10 camera and snaps a few images from which he hopes
to make textures. The resolution is incredibly low, but for videogame
decoration purposes, the resolution cannot go very high anyhow.
From these he uses an image editor to cut out the parts least tainted
by lighting irregularity, scales to dimensions that are powers of 2,
and produces the following textures.
With textures like these, Jeffery can now fill in his room details
(wall texture, floor texture, and wall decorations):
Room {
name JEB230
x 26.6
y 12.3
z 11.3
w 3.15
h 3.5
l 3.93
texture jeb230wall.gif
floor Wall {
texture jeb230carpet.gif
}
decorations [
Wall { texture jeb230art.gif
coords [29.7,13.3,13.3,
29.7,13.8,13.3,
29.7,13.8,13.6,
29.7,13.3,13.6]
}
Wall { texture jeb230calendar.gif
coords [26.65,13.3,13.3,
26.65,13.8,13.3,
26.65,13.8,13.6,
26.65,13.3,13.6]
}
]
}
Repeating this for his other rooms, the main remaining detail will be
to add Doors or Openings. Here are a couple examples.
Opening{
x 26.6
y 12.3
z 15.23
w 2.2
height 3.5
collide_in 1.2
plane 3
rooms [JEB228, JEB230]
}
Door {
x 28.9
y 12.3
z 15.23
w 0.8
height 2.2
collide_in 1.2
plane 3
rooms [JEB230 , corridor 230]
}
Engine Design Comments
- Notice that the class Room is used in the model.dat format
for rectangular spaces that
may be part of a larger logical room, or a space that isn't really a
room at all.
- Notice that the class Wall is used for all 2D surfaces rendered using
DrawPolygon,
not just walls. Under OpenGL at least, all vertices have to
lie on a plane.
- I have strong reservations about how the current model.dat
file format uses absolute coordinates in subobjects such as the decorations.
It would probably better to use room-relative coordinates.
- The syntax would benefit from being further nested -- it
makes good sense to go even further than the previous bullet and
allow the attachment of decorations to specific
subcomponents of the room, such as the wall that a poster is mounted on,
so that if the wall were moved (if interactive model editing were allowed),
the attached decorations would move automatically.
- Notice that the walls of the room object are implicit, which makes
attaching decorations to them in the file format difficult, unless
the rules for attaching decorations were also implicit...