OFPEC Forum

Addons & Mods Depot => Arma2 - O2 and Models/Modelling => Topic started by: Absolution on 09 Jun 2011, 04:59:23

Title: Completing the LPD-29
Post by: Absolution on 09 Jun 2011, 04:59:23
http://www.youtube.com/watch?v=KwrLE0iN5as&feature=channel_video_title (http://www.youtube.com/watch?v=KwrLE0iN5as&feature=channel_video_title)

A year ago, or so, I was in here frequently asking for help on my addon of an amphibious warfare ship. I had worked it out enough that it could be used in a controlled environment but I never released it to the public. It just wasn't complete enough.

I think I've sat on it long enough and would like to get it into a releasable state. There are two hurdles that I have never overcome:

1: The size of the ship forces me to split it up into three parts. I have tried several methods to put it together. I have tried creating attachto scripts similar to that of the FSF. I have tried attaching one part of the ship to another directly in the editor. In all cases holes form in the deck.

2: The model is completely devoid of parameters. It's just one view LOD, a geometry LOD for walls, a roadway LOD for the floors and a Shadow LOD. That is it. I know I am missing some key elements to bring it all together.

In its current state if you spawn on the deck of the ship at mission start you are okay. If you join in progress or respawn on the deck you either instantly die or take a serious wound. I think it's because the roadway LOD is not enough to define the ground and ARMA "drops" you out of the sky.

If I can get this thing to be hassle-free during placement and remove the injury bug I will release it to the public. This is just supposed to be a static object like the LHD.

Anyone here with the time/energy to help me get this thing done?
Title: Re: Completing the LPD-29
Post by: Gnat on 09 Jun 2011, 14:53:24
Nice work so far Absolution!
1. unless all parts are no greater than 50m x 50m x 50m then there should be no holes
If some or all parts are greater than that, you'll get holes for sure.
If you bit as size correct and you have holes, its another problem.

2. Well .... no, not really. Thats essentually all you need to start. You could add a Pathway LOD but its not essential.

3. Spawn damage ... hmmm. What scripts are you using for spawn. Spawning anything on any carrier deck is dangerous without a good script controlling location. You can rely on BIS placing it correctly.
Title: Re: Completing the LPD-29
Post by: DeanosBeano on 10 Jun 2011, 00:02:49

 Congrats  on the ship so far it looks very impressive.

 1: same as Gnat but maybe theres something  auto centres and moving ?, on something this large  i would make myself some separate roadways and either proxy them in or attach tem whichever is best .

 2 : its ben said  , nothing to add

 3:  If your using a specific height to spawn or place in jip , which command are you using to get the correct height ? remember  the  top of a wave can change heights returned and all roadway lods report  0 height no matter how high they are , i would put some points in the memmory lod  in specific areas personally , like bridge , 1st floor  top deck etc and name them , simply attach any units spawning for _x of a second and then detach them .

 



 
Title: Re: Completing the LPD-29
Post by: Absolution on 10 Jun 2011, 03:14:50
Thank you for the compliments! It means a lot coming from respected members of the ARMA community.

1: The ship is 200m long and 50m wide when assembled and I have three pieces of approximately the same length (~70m). When each piece is placed individually no holes form. It's only when they are attached to each other. I will try to create separate roadway pieces (each below 50x50x50) and attach them to the ship.

2: How do I define a center point from which to base the attachto? At the moment it just uses the center of mass and it's not in a very centered location. The attachto scripts start looking like "_bow attachto [_aft,[63.55236,10.2212,0]];", as an example. This model doesn't even have a .cfg file associated with it.

3: All of the player slots in MP are given a "setpos" command in their individual init fields. I created this ship to work with the 15th realism unit which regularly sees 50+ individuals in our operations. I worry that writing so many scripting events would be cumbersome. Although, I have no experience with what you are suggesting and maybe it's not so bad. I am not even sure how that would be done.
Title: Re: Completing the LPD-29
Post by: Gnat on 10 Jun 2011, 13:28:29
1. The Kuznetsov is made up of 1 or 2 large oversized Resoltion LODs (with little else) and then several (6? ) more separate smaller models, each with just a Geo LOD and a Roadway LOD. The Resolution LOD is just empty.

2. Example: If you take an object and chop it into 4 bits. Cut each bit out, but when you place it in a separate model, you place it exactly where it was placed in the orginal model. eg it may be away from the center of the O2 window.

3. Maybe use named memory points that sit in the model, but above the deck. Then script into a respawn position;
_thing setposasl (_ship modeltoworld (_ship selectionposition "spawnpos1"));
Title: Re: Completing the LPD-29
Post by: DeanosBeano on 10 Jun 2011, 17:41:46
Quote
2. Example: If you take an object and chop it into 4 bits. Cut each bit out, but when you place it in a separate model, you place it exactly where it was placed in the orginal model. eg it may be away from the center of the O2 window.

 if you do it that way be careful as it will create the same problem at about 46 meters if you dont centre the 5 or 6  roadway lods that will be seperate , i did atrial with 4  boxes of 50 meters and it loses its geo and roadway properties , i think this is because  it still seees [0.0.0] as the centre and ignores again at _x meters .

 I have uploaded a simple box addon with a test mission ,its very basic , but shows the problems i had ,
 when you walk (after triggering appropiate radio ) the distance you have travelled  is measured then you see how far before you fall.

 i have put this here not to reveal anything new but its a place we can all debate from and maybe someone can show myself what needs to be done as i have never had much luck with this method and usually center all the parts and use the mission.sqm to simply adjust there pos by _x and save i have included mlods if anyone wants to change and create better example.

 

 
Title: Re: Completing the LPD-29
Post by: Gnat on 11 Jun 2011, 08:50:53
Quote
if you do it that way be careful as it will create the same problem at about 46 meters if you dont centre the 5 or 6  roadway lods that will be seperate , i did atrial with 4  boxes of 50 meters and it loses its geo and roadway properties , i think this is because  it still seees [0.0.0] as the centre and ignores again at _x meters .
Odd, because what I described is exactly how the Kuznetsov is done.

Checking ...... opening O2 ...... yep .... confirmed.
Anything to do with Properties?
-lockAutoCenter = 0
or
autocenter = 1
Title: Re: Completing the LPD-29
Post by: DeanosBeano on 11 Jun 2011, 14:19:16

 to clarify , i was showing that your  method was correct when you said.
Quote
1. The Kuznetsov is made up of 1 or 2 large oversized Resoltion LODs (with little else) and then several (6? ) more separate smaller models, each with just a Geo LOD and a Roadway LOD. The Resolution LOD is just empty.

 just wanted to point out (will update later this week ) that the roadway ,geometry including view lods , must be separate models and must be centered in o2  ( not offset like the resolution lods) and placed in editor or scripted . in summary only the Resolution lods ( because they have uvmaps ?) can be done in the way the boxes are (resolution wise).
Title: Re: Completing the LPD-29
Post by: Gnat on 12 Jun 2011, 03:54:47
Quote
roadway ,geometry including view lods , must be separate models and must be centered in o2  ( not offset like the resolution lods)
Huh?
I JUST said they don't have to be. The Kuznetsov is built with offset.
I don't want to argue, but this is somewhat typical of the engine, theres aways grey areas and theres usually more than one way to do something technical.

To explain a little more, why would you make a multiple section model with its bits offset in O2?
Because the scripting and maths is easier when you place and rotate the bits. As each bit is offset exactly vs. the vehicle center (which is really the O2 center) placing and rotating around pos [x,y,x] is the same for all models.

Title: Re: Completing the LPD-29
Post by: DeanosBeano on 12 Jun 2011, 10:46:01

 hmm not sure why the word argue is in there ?
 i put a download to my post of blocks of 50 meters totaling 200 meters and set them in mission editor as you have described, however the roadway lod fails at _x meters , i was hoping to solve the problem , youhave added  maybe its the auto centre property .
 
 maybe its the uneven land it is set on however i cant see because i have pos them in the sqm   but who knows with bis engine as you say , weird results are not uncommon .

 guess i misunderstood the premise of the thread , ill let you continue with your kuznezov example if it works thats all it needs i guess.

Title: Re: Completing the LPD-29
Post by: Gnat on 12 Jun 2011, 17:48:56
No prob DB.
Quote
ill let you continue with your kuznezov example if it works thats all it needs i guess.
Just full disclosure. Absolution like any addon maker can decide to use one method or another.
Title: Re: Completing the LPD-29
Post by: DeanosBeano on 12 Jun 2011, 19:55:31
Quote
Just full disclosure. Absolution like any addon maker can decide to use one method or another.

 Problem is though , i made an example of what you decribed in order you may show him what to do to fix his problem without having to upload the Kuznetzov and all we got was  a very sarcastic post.

Quote
Odd, because what I described is exactly how the Kuznetsov is done.

Checking ...... opening O2 ...... yep .... confirmed.

 I was under the impression he came here for help and i tried to make it easier for him to be helped whilst also gaining some help myself  as i said  i tried your  split parts in the example and it didnt work .

 i guess this place has changed somewhat since its begginings .

 
Title: Re: Completing the LPD-29
Post by: Gnat on 13 Jun 2011, 13:19:43
WHoah!  ???
There are no "very sarcastic post" here.
I have simply stated that the Kuznetsov, a publicly released addon, works quite fine in the method you have very clearly stated "doesn't work".

Where possible I will have no one here mis-informed on fact.
Fact: Kuznetsov works with O2 offset LODs
Fact: Exactly why it works, I don't know
Fact: You did your own o2-offset tests and it didn't work

What people choose to do with those facts is purely up to them.
If Absolution wants more facts (not sure what else there is) on the Kuznetsov, he need only ask.
Title: Re: Completing the LPD-29
Post by: Absolution on 14 Jun 2011, 00:45:30
My LPD is split up such that, theoretically, if you attach them all to each other's 0,0,0 coordinate they should line up. They are offset in O2 as Gnat describes. This helps with manually placing each part in the editor since all they have to do is lay "exactly" on top of one another and they line up just fine. In fact, that's ultimately how I got it to work but each piece must not be attached to each other or else holes form.

When I do attach one to another it appears to use the center of mass (or maybe center of geometry) to determine the piece's center and not the origin as described by Oxygen. I assume that it works for Gnat and not me is because he has a setting that tells Arma to specifically use the Oxygen origin. I assume, again, that "autocenter = 1" is this property?

Part of my confusion is that the ship works fine when not attached to anything but breaks when it is. This makes me concerned that no matter how small I cut the individual pieces up they will still form holes when put together.

Perhaps you'd be willing to share an unbinarized copy of the Kuznetsov so that I can explore it and learn from your efforts? I've downloaded the FSF and looked at it but because it's binarized its ultimately not helpful with my current challenge.
Title: Re: Completing the LPD-29
Post by: Gnat on 14 Jun 2011, 13:56:14
The Kuznetsov doesnt use an attachto command.
Snippet
Code: [Select]
_parts =
[
"TAKR_E",
"TAKR_F1b",
"TAKR_G1",
"TAKR_G2",
"TAKR_G3",
"TAKR_K1",
"TAKR_K2",
"TAKR_K3",
"TAKR_K4",
"TAKR_K4L",
"TAKR_K5",
"TAKR_K6",
"TAKR_K7",
"TAKR_K8",
"TAKR_K9",
"TAKR_K9L",
"TAKR_K10",
"TAKR_K11",
"TAKR_K12",
"TAKR_K13"
];
{
_dummy3 = _x createvehicle _Kuzspawnpoint;
_dummy3 setdir _Kuzdir;
_dummy3 setpos _Kuzspawnpoint;
} foreach _parts;
So maybe this is a Class thing.
Snippit
Code: [Select]
class StaticShip;
class ShipBit : StaticShip
{
class AnimationSources;
};

class TAKR_K1: ShipBit
{
        vehicleClass="Armored";
scope=protected;
        side=TEast;

One thing, just to get clear, youre making a STATIC ship, right?

Quote
Perhaps you'd be willing to share an unbinarized copy of the Kuznetsov so that I can explore it and learn from your efforts?
Sure, if you are making a static ship, but your comment about the FSF has made me think twice.

If not static, then that may explain DB's comments, because YES, using any class and using attachto WILL causes the LODs to break.
...... I'm sure I read you were doing a Static version but.
Title: Re: Completing the LPD-29
Post by: Absolution on 16 Jun 2011, 04:24:43
I used the FSF as a learning tool because it was the only ship I was aware of at the time. Are you worried that I will not credit you? I understand if that is the case.

Yes, it is meant to be static.

Here is a snippet from where I define one of my ship parts (the other two inherit from this one):
Code: [Select]
class CfgVehicles {
class StaticShip; //loading old class for inheritance
class LPD_SEC_MID : StaticShip { // inheriter to : inherit from
scope = 2; //2: Visible in the editor | 1: Not visible in the editor | 0: Not visible, can't be used for inheritance
accuracy = 1; // never recognize
vehicleClass ="MEU_LPD"; // same as CfgVehicleClasses
displayName ="LPD-29 Mid Section"; // name of the object
destrType = DestructNo;
model = "\MEU_LPD17\LPD_SEC_MID.p3d"; //path to the binarized model
                armor = 500;// strength of wall also effected by weight amount in geo lod
                mapsize = 200;// size of icon when placed in editor
icon = "\MEU_LPD17\LPD_icon_mid.paa"; //icon used in editor

class MarkerLights
{
    class BlinkRedMid
   {
   name="BReM1";
   color[]={1, 0, 0, 1};
   ambient[]={1, 0, 0, 0};
brightness=0.100;
blinking=1;
};
};
         };
Title: Re: Completing the LPD-29
Post by: Gnat on 16 Jun 2011, 18:59:29
Quote
I used the FSF as a learning tool because it was the only ship I was aware of at the time. Are you worried that I will not credit you
No, no no! Its just the FSF is mobile, Kuznetsov is static. Two very different addons.

PM you soon.
Title: Re: Completing the LPD-29
Post by: Absolution on 01 Jul 2011, 03:33:25
I finally got a chance to sit down and work on this. First thing I am doing is making sure the init script works and that I can place my ship pieces all at once. Good news is that the script works as advertised... the bad news it wont stop! I cut out all the parts that I didn't think I needed and when I went to preview it the ship pieces were replicating infinitely as the game ran. The script is obviously looping but I can't figure out why.

Code: [Select]
// Original LHD placement script by ArMaTeC
// Adjust for Kuznetsov by Gnat
// Adjusted again for LPD-29 by Absolution

if (isServer) then {
_lpdspawn = _this select 0;
_lpddir = getdir _lpdspawn;
_lpdspawn setpos[getposasl _lpdspawn select 0, getposasl _lpdspawn select 1, 0];
_lpdspawnpoint = [getposasl _lpdspawn select 0, getposasl _lpdspawn select 1, 0];
_XSin = sin(_lpddir);
_XCos = cos(_lpddir);
_vx = (_lpdspawnpoint select 0); // + (_XSin * 19.916) + (_XCos * 8.87891);
_vy = (_lpdspawnpoint select 1); // + (_XCos * 19.916) - (_XSin * 8.87891);
_vxS1 = (_vx)+ (_XSin * -80) + (_XCos * 0);
_vyS1 = (_vy) + (_XCos * -80) - (_XSin * 0);
_vxS2 = (_vx)+ (_XSin * 80) + (_XCos * 0);
_vyS2 = (_vy) + (_XCos * 80) - (_XSin * 0);
_vxS3 = (_vx) - (_XSin * 19.916) + (_XCos * -4.9);
_vyS3 = (_vy) - (_XCos * 19.916) - (_XSin * -4.9);

_xx = 50 preloadObject "lpd_sec_aft";
_xx = 50 preloadObject "lpd_sec_mid";
_xx = 50 preloadObject "lpd_sec_bow";

_dummy = "lpd_sec_mid" createvehicle _lpdspawnpoint;
_dummy setdir (_lpddir+180);

_dummy0 = "lpd_sec_aft" createvehicle _lpdspawnpoint;
_dummy0 setdir _lpddir;
_dummy1 = "lpd_sec_bow" createvehicle _lpdspawnpoint;
_dummy1 setdir _lpddir;

_dummy0 setpos [_vxS2, _vyS2, -0.1];
_dummy1 setpos [_vxS2, _vyS2, -0.1];

};

My other issue is that I do not know how to use the "_vx" type expressions at the top. I understand they relate to setting the position of the various pieces but I don't know enough to know what each expression does specifically.

*edit*
I was running rptmod at the time and it gave me no errors. It looks like we just have a runaway script.
Title: Re: Completing the LPD-29
Post by: Gnat on 01 Jul 2011, 10:45:19
Supect thats an easy one.
You are (re)spawning an addon with the build script again.
Quote
      class EventHandlers
       {
         init = "_this execVM  "build"


So the build script creates a new bit ..... that bit spawns and triggers the INIT. That INIT trigggers another build script .... that spawns and triggers another addon ..... etc etc etc
The bit you place on the MAP should be the ONLY addon that triggers the Build script ..... once.
Title: Re: Completing the LPD-29
Post by: Absolution on 26 Jul 2011, 01:08:22
Luckily I am not getting paid for this because I would have been fired a LONG time ago. I've sorted out the infinite loop (thanks Gnat) and I only need to sort out the positioning. When I spawn my anchor piece I get the other two pieces but they are off-set by dozens of meters. It's like having three ships sailing side by side but none of them are complete ships. :) At least I got them to point in the right direction.

I need help understanding the position portion of the init script:
Code: [Select]
if (isServer) then {
_lpdspawn = _this select 0;
_lpddir = getdir _lpdspawn;
_lpdspawn setpos[getposasl _lpdspawn select 0, getposasl _lpdspawn select 1, 0];
_lpdspawnpoint = [getposasl _lpdspawn select 0, getposasl _lpdspawn select 1, 0];
_XSin = sin(_lpddir);
_XCos = cos(_lpddir);
_vx = (_lpdspawnpoint select 0); // + (_XSin * 19.916) + (_XCos * 8.87891);
_vy = (_lpdspawnpoint select 1); // + (_XCos * 19.916) - (_XSin * 8.87891);
_vxS1 = (_vx) + (_XSin * -100) + (_XCos * 0);
_vyS1 = (_vy) + (_XCos * 0) - (_XSin * 0);
_vxS2 = (_vx) + (_XSin * 0) + (_XCos * 0);
_vyS2 = (_vy) + (_XCos * 100) - (_XSin * 0);

I understand the mathematics behind this (cos of 0 = 1, etc) but what I don't get is what part of the equation relates to a given direction. I've been doing trial and error for about an hour and I don't feel any closer to understanding it.

What variable tells the object to move left/right/forward/back?
Title: Re: Completing the LPD-29
Post by: Absolution on 31 Jul 2011, 22:29:23
RELEASED:
http://forums.bistudio.com/showthread.php?t=123082

The short of it is I am tired of trying to make this thing perfect. I incorporated the placement scripts as best I could. It works when you point it at 0 degrees or 180 degrees but none other. The equations are obviously broken but I've stressed over it enough.

Thank you all for the help. This would have been impossible without you guys.
Title: Re: Completing the LPD-29
Post by: Gnat on 01 Aug 2011, 16:36:41
Well done!
Congrats on the release.

To bad about the position script. Someone with time and patience will work it out ;)