Jump to content

[1.4.1] Snap Building PRO


Recommended Posts

You are on the right track.

 

Basically:

1 unit = 1 meter. So: 1.11 = 1 meter 11 centimeters. Database only holds 6 digits maximum! So something like this:

[0,[0,0,0]] - this is a debug zone as seen in database. First zero is a direction, last 3 within nested array are XYZ coordinates (left-right,top-bottom,up-down).

[0,[15000.0,15000.0,0]] - Our map is 15 square kilometers, so this would be a far corner away from debug zone. As you've noticed, both X and Y takes up 6 digits!

 

Anything built within 9 square KM should be fine, as it is 4 digits into database and 2 more after comma, giving us headroom for millimeters, this would still create gaps, but unnoticeable to human eye.

[0,[9999.99,9999.99,0]]

 

Once we start building past this mark, it's all about rounding up milimeters as f3cuk stated previously:

Let's build an object at ~10km X, and ~1km Y, coords in live game are [0,[10003.54321,1.54321,0]]

 

Database will save it as:

[0,[10003.5,1.54,0]] effectivelly losing us 4 centimeters. Now if you are misfortunate and place 2 objects, each shifting to each own side, you might lose up to 10 centimeters, which is quite huge gap.

and there is no way to fix this with a kind of script or a database patch for more inits or something like that? or alternative coordinations?

Link to comment
Share on other sites

Any ideas how I could test this 2km deep into ocean (without spending hours building metal floors)? I know for sure water surface bool is returned, there must be something simple that I've overlooked... 

Thanks, guys.

How about simply taking the editor, place one large object like MAP_majak_podesta out of the sea, fly there by helicopter und start building? :)

 

 

and there is no way to fix this with a kind of script or a database patch for more inits or something like that? or alternative coordinations?

This would be possible but needs to rework the hive.dll and some internal script.

 

Edit: DayZ would realy need an reworked Database, specialy in the Databaselayout... but that would take a lot of time.

Edited by L3G0
Link to comment
Share on other sites

Database only holds 6 digits maximum!

 

Also raymix, it's not the database that restricts floats, it's the game! The engine only accepts floats of up to 6 digits.

[] spawn {
        while {true} do {
                systemChat format ["%1", getPosATL player];
        };
};

Still that in your init and move around the map, you are limited to 6 digits. That's why bases tend not to shift vertically because they are usually on the ground meaning there's going to be 4-5 decimals.

 

I actually made a script to convert the worldspace into arrays, basically seperating the decimal from the int, then recombining them and storing the amount of leading zeros, it worked fine but then I realised that it's the database that's the problem.

Link to comment
Share on other sites

How about simply taking the editor, place one large object like MAP_majak_podesta out of the sea, fly there by helicopter und start building? :)

Oh, right.... that kinda fell out of my head. Thanks

 

 

Also raymix, it's not the database that restricts floats, it's the game! The engine only accepts floats of up to 6 digits.

 

Gotcha, makes sense now. Still funny how you'd have to hack around creating extra arrays just for a single float. What mislead me was infistar debug menu, that actually shows ton of digits after comma (z axis is the most obvious). Thanks

Link to comment
Share on other sites

Update: "Proper" water base support.

 

Fixed problem with snap points not appearing deeper into the ocean. Aparantly nearestObjects is limited to getPosATL (Above Terrain Level), while water surface in arma requires ASL (Above Sea Level) coords. What happened was - player was simply out of range, because radius to test nearby objects was deep down below player, testing terrain level not sea level. Fix was kind of dirty, but should work fine - we simply take Z axis from player to measure distance we lost and add it to detection radius. This increases detection radius to compensate for lost distance, but whatever... worst case scenario you might get slight performance loss if building huge base, shouln't be a huge problem tho (geometrically top part of sphere is smaller than centre).

 

Installation: If upgrading from 1.3 then simply replace snap_build.sqf file with a new one and you are done.

 

Mods: player_build was not changed, minor update to snap itself only.

 

Thanks, kind regards,

Ray

Edited by raymix
Link to comment
Share on other sites

Thanks for explaining before raymix. Think i just might fully understand it now.

 

Gotcha, makes sense now. Still funny how you'd have to hack around creating extra arrays just for a single float. What mislead me was infistar debug menu, that actually shows ton of digits after comma (z axis is the most obvious). Thanks

 

This is interesting, i think you might be able to save it then. But i need to see the code that actually saves coordinates first to be sure.

X = 10003.56

Y = 11235.21

All you need to do is explode them on the . so you get

X = [10003,56];
Y = [11235,21];

Then save them to the database like
 

[_height,[X select 0 . X select 1,Y select 0 . Y select 1]]
Link to comment
Share on other sites

Update: "Proper" water base support.

 

Fixed problem with snap points not appearing deeper into the ocean. Aparantly nearestObjects is limited to getPosATL (Above Terrain Level), while water surface in arma requires ASL (Above Sea Level) coords. What happened was - player was simply out of range, because radius to test nearby objects was deep down below player, testing terrain level not sea level. Fix was kind of dirty, but should work fine - we simply take Z axis from player to measure distance we lost and add it to detection radius. This increases detection radius to compensate for lost distance, but whatever... worst case scenario you might get slight performance loss if building huge base, shouln't be a huge problem tho (geometrically top part of sphere is smaller than centre).

 

Installation: If upgrading from 1.3 then simply replace snap_pro.sqf file with a new one and you are done.

 

Mods: player_build was not changed, minor update to snap itself only.

 

Thanks, kind regards,

Ray

 

Nice work bud, may I point this out from the BI wiki: http://puu.sh/aTxTj/e8d18057a5.png

You should optimize your code by using that method of fetching position.

Link to comment
Share on other sites

You mean snap_build.sqf ?

yes it is, sorry :)

 

This is interesting, i think you might be able to save it then. But i need to see the code that actually saves coordinates first to be sure.

Should be one of publish vehicle scripts, not entirely sure tho, haven't explored server side much myself

https://github.com/vbawol/DayZ-Epoch/tree/master/SQF/dayz_server/compile

Link to comment
Share on other sites

Nice work bud, may I point this out from the BI wiki: http://puu.sh/aTxTj/e8d18057a5.png

You should optimize your code by using that method of fetching position.

That actually makes sense if you think about it. Both getPos and getPosATL requires extra test to find out surface beneath tested object, while getPosASL is a (kind of) constant variable that does not depend on tested object's location.

 

So here's the theory then:

getPos checks for any surface beneath tested target, it could be terrain or even road LOD on objects, hence the extra performance requirement. So if player is being tested and is standing on a roof of house, I'd guess that some sort of raycast is used to test objects it will penetrate towards terrain, then closest object is tested to see if it has road LOD? 

getPosATL uses terrain elevation data, which means some sort of raycast has to be shot as well, or maybe just coords are used, no idea, then elevation data is extracted and Z position is calculated from there.

getPosASL uses sea level, which is also dynamic variable, however it does not need to be tested against position, variable can be simply read from current dynamic sea level and worked out from there, I guess. 

 

This makes ASL a clear winner, but converting from ASLtoATL still makes no sense to me, because some sort of check has to be done to get elevation data. So yeah..

Link to comment
Share on other sites

I have read this forum and still not sure what is going on.  I am running Overpoch Cherno map.  When i added p4l and snapbuilding_pro it all worked fine and i was able to snap no issues...the half walls went in like  a charm...then i went to upgrade the wall and doors and the wheel mouse options are not there...i also noticed that the option to turn name tags on and off or "show name" is not there...and the wheel option to the plot pole for maintenance is not there...i have the most updated infistar and for the life of me can not get the wheel mouse options to show up....any ideas?

Link to comment
Share on other sites

Should be one of publish vehicle scripts, not entirely sure tho, haven't explored server side much myself

https://github.com/vbawol/DayZ-Epoch/tree/master/SQF/dayz_server/compile

 

If you are talking about the server_publishobject.sqf (e.g) then no, it doesn't really show much. I guess the files where 'the magic happens' are somewhere within the hiveExt.dll and since i haven't got the faintest idea how to edit those i wont be able to have a look at it. There are however some people on these forums that know how to actually edit and recompile dll files, one of them might take a look or explain to us how to decompile it.

Link to comment
Share on other sites

If you are talking about the server_publishobject.sqf (e.g) then no, it doesn't really show much. I guess the files where 'the magic happens' are somewhere within the hiveExt.dll and since i haven't got the faintest idea how to edit those i wont be able to have a look at it. There are however some people on these forums that know how to actually edit and recompile dll files, one of them might take a look or explain to us how to decompile it.

 

You may want to have a scan over the last couple of posts, it's not the database trimming the decimals, it's the game.

Link to comment
Share on other sites

You may want to have a scan over the last couple of posts, it's not the database trimming the decimals, it's the game.

 

I know mikey, but i just want to have a look at the files that actually write to the database to see if we can actually find a workaround.

Link to comment
Share on other sites

I know mikey, but i just want to have a look at the files that actually write to the database to see if we can actually find a workaround.

 

How can you find a work around if the game isn't even giving you the decimals? Nothing in the hive is going to help you change the way the Arma 2 engine works.

Link to comment
Share on other sites

Like i said before, i don't know if there is a workaround possible or not. Just want to take a look to see if maybe i can find one. I know the game has a limitation of 6 decimals, but there might be a workaround by adding them separately like explained Engine limitations are often avoided simply by thinking creative/out of the box.

Link to comment
Share on other sites

Like i said before, i don't know if there is a workaround possible or not. Just want to take a look to see if maybe i can find one. I know the game has a limitation of 6 decimals, but there might be a workaround by adding them separately like explained Engine limitations are often avoided simply by thinking creative/out of the box.

 

Okay, I'm going to stop there.

Link to comment
Share on other sites

Okay, I'm going to stop there.

 

Really? Wth man? What is this attitude about? Wasn't aware this turned into an argument somewhere where one of us could say something like that. My interest in this is genuine and if you think I'm asking retarded questions (which is perfectly plausible) please atleast help me understand why you think that so maybe i could learn a little.

Link to comment
Share on other sites

Really? Wth man? What is this attitude about? Wasn't aware this turned into an argument somewhere where one of us could say something like that. My interest in this is genuine and if you think I'm asking retarded questions (which is perfectly plausible) please atleast help me understand why you think that so maybe i could learn a little.

 

Woah, I'm sorry if I gave off the vibe that I wanted an argument, I was just saying that I'm going to stop replying, I'm not trying to take a dig here but you don't seem to understand what I'm getting at and I can't be bothered to explain it anymore. All the information you need to understand is in the previous posts. Sorry about that dude.

Link to comment
Share on other sites

Cant get this to work on my 2nd server.

When I scroll the snap thingy doesn't appear like it should, but I can still press F to walk around the object.

 

I've tripple checked, and everything is added the way it should be.

I'm using the custom player_build which is compatible with plot4life. 

Link to comment
Share on other sites

Cant get this to work on my 2nd server.

When I scroll the snap thingy doesn't appear like it should, but I can still press F to walk around the object.

 

I've tripple checked, and everything is added the way it should be.

I'm using the custom player_build which is compatible with plot4life. 

That one's outdated, here I bashed together a new one using diffmerge:

https://gist.github.com/raymix/51828217334b93b8ff42

Link to comment
Share on other sites

ok i followed all the instructions and got the script to work, however when i enable it i cant get the F key to drop or snap or anything. its orange when all the rest of the keys are blue.. i press F and nothing happens.. I have the most updated version of infistar and your files. anything else that can cause this issue?

Link to comment
Share on other sites

ok i followed all the instructions and got the script to work, however when i enable it i cant get the F key to drop or snap or anything. its orange when all the rest of the keys are blue.. i press F and nothing happens.. I have the most updated version of infistar and your files. anything else that can cause this issue?

make sure that dayz_spaceinterrupt is installed properly. Can you post your compiles file? Also are there any other mods running that has anything to do with building or spawning objects?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...