Jump to content
Sign in to follow this  
opec666

Modular & randomly-generated dungeons (endless CQB). Stuck on generating pathways.

Recommended Posts

Hello. I had a silly idea recently about making endless tunnels of close quarters combat, so I beat out this idea into script form: http://pastebin.com/CmHAUm1a

I'm storing each kind of "shape" (sides with connection points to adjacent cells) in their own .sqf file.

The script does so well in making the first and second generations of cells (the center cross-piece and its n/s/e/w connections. It stumbles when trying to making connections to the second generation's open pathways. Can anyone see where this script is screwing up? I've looked and looked to no avail.

If this automated script doesn't work, I'll just have to set up an interface for the Zeus player to generate the dungeon layout. I would much prefer it be randomly generated.

I haven't made any of the layouts in x-cam beyond these awful concrete block pathways. Each concrete path leads from the center of the block to the edge of where it connects to the next 100^2m block.

http://i.imgur.com/yKT3Xhw.jpg (113 kB)

Share this post


Link to post
Share on other sites

You know, I remember talking to a guy in the scripting skype group who had written some code that generated a maze with the VR blocks. Will see if I can find it - might be of interest to you.

Share this post


Link to post
Share on other sites

I think this is extremely confusing. Consider using the Functions Library to clear up space in your script by putting each function in it's own file. Tbh, right now, this script is little more than a clusterfuck

Share this post


Link to post
Share on other sites
Intriguing idea OP, sounds interesting don't give up.

I really wanted to help, that's why I'm in this thread in the first place. The idea is very cool, and I'd like to see at least a semi-functioning prototype (even if I have to write most of the code myself).

But MFW I clicked on that pastebin link ---> @__@ "this is impossible to debug"

Share this post


Link to post
Share on other sites
Hello. I had a silly idea recently about making endless tunnels of close quarters combat, so I beat out this idea into script form: http://pastebin.com/CmHAUm1a

I'm storing each kind of "shape" (sides with connection points to adjacent cells) in their own .sqf file.

The script does so well in making the first and second generations of cells (the center cross-piece and its n/s/e/w connections. It stumbles when trying to making connections to the second generation's open pathways. Can anyone see where this script is screwing up? I've looked and looked to no avail.

If this automated script doesn't work, I'll just have to set up an interface for the Zeus player to generate the dungeon layout. I would much prefer it be randomly generated.

I haven't made any of the layouts in x-cam beyond these awful concrete block pathways. Each concrete path leads from the center of the block to the edge of where it connects to the next 100^2m block.

http://i.imgur.com/yKT3Xhw.jpg (113 kB)

There is updated shuffle function: http://killzonekid.com/arma-scripting-tutorials-arrays-part-4-arrayshuffle/

KK_fnc_isEqual you can now use isEqualTo https://community.bistudio.com/wiki/isEqualTo

KK_fnc_inString you can just use find as it now works with strings https://community.bistudio.com/wiki/find

Edited by Killzone_Kid

Share this post


Link to post
Share on other sites

SilentSpike - I hope you can track that maze mission and/or its author down!

DreadedEntity & MDCCLXXVI - I moved all the functions into their own files and defined them in description.ext. I was getting a headache trying to reference things all within init.sqf as well.

Killzone_Kid - Thanks for those. I updated the shuffle and switched to isEqualTo. Find was giving me unexpected results (probably me misusing it), so I stuck with using KK_fnc_isEqual.

Here's my latest version: http://www.mediafire.com/download/i5w9dy65ipi6jb8/dungeonsLIVE.VR.pbo

I added map markers (for storage of relative grid-references, like [0,0], and the "shape"; I couldn't get detection of game logics just right with nearEntities). Clicking on the map generates a new cell as well now.

These screenshots show me having clicked on certain grids to generate new cells:

hszVLiF.jpg - Line 97 of fn_rulebook.sqf commented out, tries to determine what shape to use and fails.

iMkLJYk.jpg - Line 97 of fn_rulebook.sqf NOT commented out, for debug purposes... picks any "continuation" shape regardless of what's already around it. Seems to work well.

I think the rulebook failure has to do with my method of determining which elements are common to all four arrays _allow_n, _allow_s, _allow_e, _allow_w. This is lines 69-95 of fn_rulebook.sqf:

	_agreed_final1 = [];
_agreed_final2 = [];
_agreed_final3 = [];

{	
	_this_x = _x;
	{
		_is_eql = _x isEqualTo _this_x;
		if ( _is_eql ) then { _agreed_final1 pushBack _x };
	} forEach _allow_s;
} forEach _allow_n;

{	
	_this_x = _x;
	{
		_is_eql = _x isEqualTo _this_x;
		if ( _is_eql ) then { _agreed_final2 pushBack _x };
	} forEach _allow_e;
} forEach _agreed_final1;

{	
	_this_x = _x;
	{
		_is_eql = _x isEqualTo _this_x;
		if ( _is_eql ) then { _agreed_final3 pushBack _x };
	} forEach _allow_e;
} forEach _agreed_final2;

Lines 23-31 of fn_new_path.sqf are also commented out, to stop the continual branching-out process, since right now that just generates megabytes of .rpt errors. :)

Share this post


Link to post
Share on other sites
SilentSpike - I hope you can track that maze mission and/or its author down!

Seems the skype conversation history doesn't go back that far, a shame because it was really quite interesting.

Share this post


Link to post
Share on other sites
Seems the skype conversation history doesn't go back that far, a shame because it was really quite interesting.

How far?

Right click -> jump back -> from beginning

Ctrl+F <keyword>

---------- Post added at 18:55 ---------- Previous post was at 18:49 ----------

Killzone_Kid - Thanks for those. I updated the shuffle and switched to isEqualTo. Find was giving me unexpected results (probably me misusing it), so I stuck with using KK_fnc_isEqual.

Impossible, isEqualTo is solid.

if (a isEqualTo b) then {hint "a is equal to b"};

if !(a isEqualTo b) then {hint "a is not equal to b"};

Share this post


Link to post
Share on other sites

ahh, you're right because isEqualTo is solid. I did switch to that.

I meant to write kk_fnc_inString. Simply because your function returns a boolean, whereas find returns a number (the index where found).

Share this post


Link to post
Share on other sites
How far?

Right click -> jump back -> from beginning

Ctrl+F <keyword>

Must be over 6 months ago because nothing's showing up and that's as far back as it'll let me go.

The biki group has stopped working for me by the way (I can't send messages as they just load forever), so here:

I think your netID function is using an OR instead of an AND here:

typeName this != "OBJECT" || typeName this != "GROUP" ... exitWith

Just a little De Morgan's Law mixup by the looks of it :)

Share this post


Link to post
Share on other sites
Must be over 6 months ago because nothing's showing up and that's as far back as it'll let me go.

The biki group has stopped working for me by the way (I can't send messages as they just load forever), so here:

Just a little De Morgan's Law mixup by the looks of it :)

Ah yeah, silly mistake, expanded it without testing, thanks, changed it.

As for Skype, maybe you need skype reinstall or something? I can go back over 1 year, and BIKI channel works for me.

Share this post


Link to post
Share on other sites

http://i.imgur.com/90CCzn0.gif (439 kB)

http://www.mediafire.com/download/9eugd77atv8v796/dungeons.VR.pbo (run with addon xcam_eu.pbo, 636 kb)

So much more work to do, especially adding rules to shape creation so it respects what's been built around it already. Lots and lots of creative work to be done in x-cam as well.

This default set was thrown together quickly just to show off the "engine". There's also an uglier debug set of just lines of 10cm no-clip balls to show shape outlines.

Edited by opec666

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
Sign in to follow this  

×