Way to Save Environment in a File?

6 views
Skip to first unread message

bill.mybiz

unread,
Dec 6, 2011, 10:58:56 AM12/6/11
to opennero
Has anyone figured out a way to save an environment or at least to
change some environment file so we don't have to continually place
objects (walls, turrets, spawn points)?

By this I mean is there a file where I can just add some lines that
say "Wall(2,5,25,23)" for a position and rotation. Then I could
replace the default environment that it loads with this file, and
switch between environments by changing their filenames?

Igor Karpov

unread,
Dec 6, 2011, 11:19:01 AM12/6/11
to open...@googlegroups.com
You could sort of do this by editing NERO/module.py, where you will
see a bunch of addObject calls which place walls etc. You can then add
your own objects at the desired positions, and you could even switch
in different versions of this file. It's kind of a manual process
right now, but it should work...

--Igor.

bill.mybiz

unread,
Dec 7, 2011, 10:20:19 AM12/7/11
to opennero
That's exactly what I was looking for. Thanks, I'll give it a shot
today.

bill.mybiz

unread,
Dec 7, 2011, 11:22:26 AM12/7/11
to opennero
Yup that works great. For anyone else interested, here are templates
for snippets of adding walls and turrets. The grid is +/-400
coordinate system with the middle wall at 0,0,0. Just add these and
set the position, orientation, scale as you like for each individual
item.

### Wall template
## x_offset = 0
## y_offset = -100
## z_offset = 0
## x_rotation = 0
## y_rotation = 0
## z_rotation = 45 #rotation about the z-axis...use this
## x_scale = 1 #thickness
## y_scale = 1 #length
## z_scale = 1 #height
##
## common.addObject(
## "data/shapes/cube/Cube.xml",
## OpenNero.Vector3f(constants.XDIM/2 + x_offset,
constants.YDIM/2 + y_offset, height + z_offset),
## OpenNero.Vector3f(x_rotation, y_rotation, z_rotation),
#orientation vector
## scale=OpenNero.Vector3f(constants.WIDTH * x_scale,
constants.YDIM / 4 * y_scale, constants.HEIGHT*2 * z_scale),
## label="World Wall4",
## type=constants.OBJECT_TYPE_OBSTACLE)

### Turret template
## x_offset = 100
## y_offset = -50
## z_offset = 0
## x_scale = 1
## y_scale = 1
## z_scale = 1
##
## common.addObject(
## "data/shapes/character/steve_basic_turret.xml",
## OpenNero.Vector3f(constants.XDIM/2 + x_offset,
constants.YDIM/2 + y_offset, height + z_offset),
## OpenNero.Vector3f(0, 0, 90), #orientation vector
## scale=OpenNero.Vector3f(x_scale, y_scale, z_scale),
## label="turret_guy",
## type=constants.OBJECT_TYPE_TEAM_1)

On Dec 6, 10:19 am, Igor Karpov <ikar...@cs.utexas.edu> wrote:

Reply all
Reply to author
Forward
0 new messages