The Exiled

Shunned by Man, Accepted by Gods
* FAQ    * Search   * Members
* Login   * Register
It is currently Thu Mar 28, 2024 9:54 am 

 View unanswered posts | View active topics


 Board index » General Area » Mapping
Post new topic Reply to topic Users browsing this forum: No registered users and 3 guests
Author
Message
perrinoia


User avatar
Joined: Wed Oct 03, 2007 9:05 pm
Posts: 18
Location: New Hampshire or Rhode Island
Post Posted: Tue Oct 20, 2009 1:27 pm    Post subject: How to make a randomly generated maze
Reply with quote
 
Code:
//   Yup, it's this simple. -perrinoia
function makeWall(%mkr)
{
   %obj = newObject(Object::getName(%mkr), InteriorShape, "W64corner.dis");         // Create Wall
   %rnd = floor(getrandom() * 4);                                          // Pick a #, 0-3
   %p[0] = "16 0 0";   %r[0] = "0 0 0";                                    // If %rnd=0, Use these offsets
   %p[1] = "0 16 0";   %r[1] = "0 0 1.57079";                                 // If %rnd=1, Use these offsets
   %p[2] = "-16 0 0";   %r[2] = "0 0 3.14159";                                 // If %rnd=2, Use these offsets
   %p[3] = "0 -16 0";   %r[3] = "0 0 -1.57079";                                 // If %rnd=3, Use these offsets
   addToSet(nameToId("MissionCleanup/Labyrinth"), %obj);                        // Assign Wall to Group
   GameBase::setPosition(%obj, Vector::add(GameBase::getPosition(%mkr), %p[%rnd]));   // Offset Positions
   GameBase::setRotation(%obj, Vector::add(GameBase::getRotation(%mkr), %r[%rnd]));   // Offset Rotations
   GameBase::setTeam(%obj, %rnd % (getNumTeams() - 1));                        // Set initial team based on Rotation
}

addToSet("MissionCleanup", newObject("Labyrinth", SimGroup));
Group::iterateRecursive(nameToId("MissionGroup/Grid"), makeWall);   // for each grid marker, make a wall.

First, you'll need a grid of Markers, 32 meters apart. All assigned to the group "MissionGroup/Grid". Then insert this code into your .mis file and the walls should appear the next time you load the mission. You may continue to edit the mission even after the walls have been created, when you hit save the walls will not be saved in that position. They will be forgotten, and the next time the mission is loaded, they will be recreated randomly again. (Note: If you use this mission as the default mission when you start your server, the maze will be identical everytime you start the server, however, if it is not the first mission loaded by the server, it will be truly random)

You can remove markers from the grid in the editor, and when you reload the mission, the wall that had spawned over that grid marker will not respawn. Thus you can then add a base for each team in the holes you created in the grid, or shape the grid to fit your arena, or add an objective surrounded by walls that aren't randomly rotated.

The maze does not change mid game, only when the mission is loaded.
Image
Image
Image
Image

http://www.ptysor.com/Maps/Labyrinth.rar




Image
 Top Offline
Profile WWWYIM
Author
Message
perrinoia


User avatar
Joined: Wed Oct 03, 2007 9:05 pm
Posts: 18
Location: New Hampshire or Rhode Island
Post Posted: Tue Oct 20, 2009 1:36 pm    Post subject: Re: How to make a randomly generated maze
Reply with quote
 
Oh, your also welcome to download the whole map (using that link at the bottom of my post) and edit it to your liking, use different bases, what ever floats your minotaur.
Image




Image
 Top Offline
Profile WWWYIM
Author
Message
TE-Starseeker

Joined: Tue Oct 25, 2005 2:25 am
Posts: 297
Location: Finland
Post Posted: Tue Oct 20, 2009 2:59 pm    Post subject: Re: How to make a randomly generated maze
Reply with quote
 
Nice one!

Any objectives? Find the goal or something?



Image
 Top Offline
Profile
Author
Message
perrinoia


User avatar
Joined: Wed Oct 03, 2007 9:05 pm
Posts: 18
Location: New Hampshire or Rhode Island
Post Posted: Tue Oct 20, 2009 6:03 pm    Post subject: Re: How to make a randomly generated maze
Reply with quote
 
Yeah, if you look at the last 2 pictures which were taken from an Observers point of view, you'll see the float base from Roller Coaster that houses the flags in the middle of the maze, although, in this case it houses a tower switch, which when claimed will change the team of all of the walls and the arena itself to match the colliding player's team, which means that the other team can no longer deploy turrets on any of those surfaces, makes it pretty difficult to defend your base. You may also notice in the middle and ontop of the newDam object which makes each team's base, that there is a flag stand, with a flag ontop.

I think I made it 8 team points to win, towerswitch = 1, which means you can either hold the objective and capture the enemy's flag 7 times, or capture the enemy's flag 8 times to win.

I'm gonna edit the map and add some bots... There will be one fat bot named Minotaur which will vigorously defend the objective, and one meak little bot per team, named MickyMouse and MiniMouse which will spawn near the flag and navigate the maze randomly in search for stray noobies. There may also be some cheese at the end of the maze.

I'll share the mice navigation code when I create it, but off the top of my head, I'm thinking it will probably use if(!GameBase::getLOSInfo(%mouse, 32, "0 0 "@ %r[%rnd])) to determine that there is no wall blocking that random direction, then set a waypoint at $LOS::Position, and the function will be called each time the mouse reaches it's waypoint that was randomly choosen the last time it reached a waypoint. Should be rather simple.




Image
 Top Offline
Profile WWWYIM
Display posts from previous:  Sort by  
Post new topic Reply to topic Board index » General Area » Mapping
Previous topic :: Next topic  
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group