Jump to content
Zenophon

Release - VR Random Urban Area Generator Script

Recommended Posts

Overview

 

This script generates a randomized, urban-like area using the new generic VR structures. It is a simple implementation, and it is mostly meant for arena-style PvP missions or CQB practice vs. the AI. You can use this function to quickly have fun in the editor, or generate a complex VR city block by block.

 

The function uses a grid system to evenly distribute large structures and small cover objects. It uses a rectangular area marker to define the boundaries of the area. The size of each grid, each of which contains one large structure, and how many smaller objects there are per grid are entirely customizable. Each object is randomly placed and rotated within the grid.

 

The function is very fast, generating large areas in less than a second, and it can be used as many times as you need. There is no debug, argument checking, or defensive code, to make it as simple and fast as possible, so make sure the arguments are correct.

 

Download

 

Google Drive:

https://drive.google.com/file/d/0B-QFvxyAVKTUcDJBMFBacnRxdUU/edit?usp=sharing

 

Usage

 

Place the script somewhere in your mission folder

Function parameters:

  1. String, an area marker
  2. Scalar, the grid size in meters, each grid gets one large structure
  3. Scalar, count of smaller VR objects, each grid gets this many

The complete documentation is also commented at the top of the file

You can run it from anywhere with execVM, example:

0 = ["marker", 25, 6] execVM "Zen_GenerateVRArea.sqf";
 

You can also compile it into a function if you plan on using it many times

Zen_GenerateVRArea = compileFinal preprocessFileLineNumbers "Zen_GenerateVRArea.sqf";
0 = ["marker", 25, 6] call Zen_GenerateVRArea;
 

Changelog

7/15/14

 
  1. Improved: Area can now turn with marker angle
  2. Improved: Object rotation stays at right angles to the marker angle
  3. Legal: Added license

7/14/15

 
  1. Initial release

 

Known Issues

 

  • When using a small grid size or small marker, some of the large buildings can overlap each other. The only way to fix this is to prevent them from rotating. Using a reasonable grid size should mostly prevent this issue.
  • There are only 5 big VR structures and 5 little VR objects right now, so it could get a little repetitive. There's nothing I can do about that unless BIS adds new objects, as I have already may every effort to randomize things.

 

Feedback

 

If you liked/disliked it or have any suggestions for improvement, I would like to hear your thoughts. Either this thread, PM, or email is fine.

Contact the author:

ZenophonArmAFramework@gmail.com

 

Legal

 

This software is released under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0).

http://creativecommons.org/licenses/by-nc/4.0/

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Edited by Guest
updated to latest version

Share this post


Link to post
Share on other sites

Thanks Foxhound!

Also, I am releasing an updated version. The download link and first post have been updated. I have decided to include a legal license, as this is likely the final release. The only coding change is that the area can rotate based upon marker angle. This script is now released under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)

Changelog

7/15/14

  1. Improved: Area can now turn with marker angle
  2. Improved: Object rotation stays at right angles to the marker angle
  3. Legal: Added license

Share this post


Link to post
Share on other sites

Awesome!! This reminds me of DAC's object composition function except now I don't need to use the whole DAC script :) Will check it out... thanks.

Share this post


Link to post
Share on other sites

Very easy, simple and fun script. Thanks for this. Here is my quick mission that I put together to train my QCB skills as I am always scared to death when I see enemy popup somewhere :). Just kill guerrilla opfor that coming from opposite side of arena.

Used very cool Arsenal Viewer to setup equipment for VR guys ( you need omit uniform or you will lose their VR look and delete identity face and voice settings from export string).

http://www.prekladytextu.eu/arma3/VR_Battle.zip

Share this post


Link to post
Share on other sites

Great Script! Used it for my mission.

But maybe you could make it a little bit more adjustable?

I digged in around in the code and altered everything to my liking, but great script!

Share this post


Link to post
Share on other sites
Great Script! Used it for my mission.

But maybe you could make it a little bit more adjustable?

I digged in around in the code and altered everything to my liking, but great script!

I would be glad to add some more parameters, but I don't know what they would be. It already adapts to the size and direction of the marker and has parameters for the spacing and clutter in the area.

If you want a specific part made adjustable, just say what it is and I can release an updated version.

Share this post


Link to post
Share on other sites

cool!

nice fast way to create a PvP match lol

Wonder what will happen if I place enterable objects in the object pool, like cars and houses. Wonder if the screen will go black if they are entered. Guess I'll av to mess about with it.

Edited by 3lockad3

Share this post


Link to post
Share on other sites

Would there be anything that would cause this to just... stop working without any errors? Did Arma 3 update and change something?

0 = ["marker", 25, 6] execVM "Zen_GenerateVRArea.sqf"; does nothing. Marker is indeed named marker, ran from soldier.

 

 

**EDIT** Scratch that. I'm stupid; I forgot that it automatically adapts to the size of a marker, It's been almost a year since I used this script. My bad! D:

Share this post


Link to post
Share on other sites

You would need the equations for the sides of the rectangle.  I think the best way would be to step around the sides from the corners and mirror each position.  Note that I'm using Zen_ExtendVector from my framework, but any equivalent vector addition command will do.
 

Spoiler



// let _a and _b be the dimensions of the rectangle
_a
_b

// get the marker's compass direction and center
_dir
_center

// define a length of the object spawned around the border
// this ideally is a factor of _a and _b
_l

// find a corner
// e.g. if the rectangle is at 45 deg, this is the topmost corner
_corner = [_center, vectorMagnitude [_a, _b, 0], (markerDir - 45)] call Zen_ExtendVector;

// step along one side, mirroring the result across the rectangle
for "_r" from 0 to _a step _l do {
    _pos1 = [_corner, _r, (markerDir + 90)]] call Zen_ExtendVector;
    _pos2 = [_pos1, _b, -markerDir]] call Zen_ExtendVector;
    // ... spawn at positions
};

// and along the other two sides
for "_r" from 0 to _b step _l do {
    _pos1 = [_corner, _r, -markerDir]] call Zen_ExtendVector;
    _pos2 = [_pos1, _a, (markerDir + 90)]] call Zen_ExtendVector;
    // ... spawn at position
};


 

Note that I did not test this, so I might have made a mistake with the angles or something.  If it draws a rectangle at the wrong rotation, first try swapping _a and _b.

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×