Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 9 Vote(s) - 4.56 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Work in progress Katamari: The dark descent (Update 16/11)
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#41
RE: Katamari: The dark descent (Update 21/06)

Okay, really making some headway on this now:
http://www.youtube.com/watch?v=mrLaz5boPtY


Still got to fine-tune resizing behaviour a little more, as well as allow arbitrary rotations of props (based on how they are positioned in the level, as well as the rotation of the katamari). The attachment issue mentioned in the video is already fixed. I can now roll the katamari around a level and pick up pretty sizeable props by the end of it, so things are really starting to take shape now Smile
06-21-2012, 06:41 PM
Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#42
RE: Katamari: The dark descent (Update 21/06)

Great balls of fire, look at that torch wielding maniac. :>
06-21-2012, 07:13 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#43
RE: Katamari: The dark descent (Update 21/06)

I think I had a dream about this mod last night.....


O_o

06-22-2012, 08:18 PM
Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#44
RE: Katamari: The dark descent (Update 21/06)

.. Did you invent the AngelScript?

Hi.
06-22-2012, 10:50 PM
Website Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#45
RE: Katamari: The dark descent (Update 24/06)

I figured i'd get in the habit of writing out an occasional update whenever a milestone is met. Also, I finally worked out how to fix AddAttachedPropForProp so that all the parameters are use-able with no loss in precision.

Update as of 24/06/2012
  • Re-attachments on resize are now limited, so that only the last 60 or so props are re-attached (this makes a noticeable performance boost when you get to a large size and there were near 300 attachments!)
  • Made both my attachment list and my world entity list massively more efficient, giving a noticeable reduction in lag when re-attaching props and adding the collision callbacks.
  • Came up with a full fix for AddAttachedPropToProp which lets all position and rotation parameters be used correctly (the normal function ignores z position and uses z rotation for both position and rotation. Fix is outlined below).
  • Props are now rotated when they are attached, based on the rotation of the katamari, this makes the whole thing seem a lot more "ball like".
  • Props should no longer float when attached to the katamari as a side-effect of glancing collisions with very thin/small props.
  • Started work on a basic particle system when resizing (this is still very much a WIP as it is way too bright) [Thanks palistov for giving me a place to start with the particle editor too]
You can see a video of the rotation-based attachment here.

Fixing AddAttachedPropToProp once and for all:
Spoiler below!

This is the function in question from the wiki:
AddAttachedPropToProp(string& asPropName, string& asAttachName, string& asAttachFile, float afPosX, float afPosY, float afPosZ, float afRotX, float afRotY, float afRotZ);
The problem with it: afPosZ is not used for Z position! Rather afRotZ is used for both Z position and ZX rotation.

The initial solution to this problem was to create a new function:
void AttachProp(string& asPropName, string& asAttachName, string& asAttachFile, float afPosX, float afPosY, float afPosZ)
{
  AddAttachedPropToProp(asPropName, asAttachName, asAttachFile, afPosX, afPosY, 0, afPosZ, 90, afPosZ);
}
This let me attach props at the correct position without any Z-rotation, but there was still a rotation in y by 90 degrees, and rotating the attached prop is not possible. To get around this, I made is a 3-stage attachment method, split over two functions. The first function is designed to offset the 90-degree rotation by creating a base prop on which all attachments should be made:
void AddAttachedBaseToProp(string propName, string baseName, string baseFile)
{
   AddAttachedPropToProp(propName,baseName,baseFile,0,0,0,0,-90.0f,0);
}
The second function then assumes you are attaching props to this base:
string AddAttachedPropToBase(string &in asBaseName, string &in asAttachName, string &in asAttachFile, float posX,float posY, float posZ, float angX,float angY,float angZ)
{
        //Generate a unique name for this level
    AddLocalVarInt("DUMMY_ID",1);
    string dummyName1 = "ATTACHMENT_DUMMY_" + GetLocalVarInt("DUMMY_ID");

        //Attach the dummy prop, at the attachment position with cumulative 0,0,0 rotation
    AddAttachPropToProp(asBaseName,dummyName1,"block_box.ent",posZ-angZ,posY,0,-posX,90,-posX);

        //Attach the actual prop with the desired rotation
    AddAttachedPropToProp(dummyName1,asAttachName,asAttachFile,0,0,0,angX,angY,angZ);

        //Return the name of the dummy prop, so that if RemoveAttachedPropFromProp needs to be used,
        //Instead of removing asAttachName, remove the returned dummy name instead to remove the prop.
    return dummyName1;
}
This works, as recall the base has a position of (0,0,0) and rotation of (0,-90,0). For the next attached prop this means that "z" position is now "x" position and (-"x") is now "z". Using this knowledge, the dummy prop is added using the same approach as the initial fix with appropriate swapping of z and x components, and the 90 degree offset already corrected for by the base. Notice that posZ has angZ subtracted from it to offset the translation-by-bug which will be applied in the next step. At the end of the second attachment there is now a dummy prop is at position (posX,posY,posZ-angZ) with rotation (0,0,0).

The desired prop is then attached to the dummy prop at relative positon (0,0,angZ), with the desired rotation, giving a prop attached at (posX,posY,posZ) with angle (angX,angY,angZ).

With the tricky explanation out the way - An example, for attaching a barrel to another barrel:
void someFunction()
{
   //Come up with some name for the base name - can just append "_base" to the end of each prop name.
   string baseName = "barrel01_1_base";
  
   //Create the base (you only need one base per prop)
   AddAttachedBaseToProp("barrel01_1", baseName, "block_box.ent");
  
   //Attach the prop to the base at (1,0,0) with rotation (45,45,45)
   AddAttachedPropToBase(baseName,"barrel01_attachment","barrel01.ent",1,0,0,45,45,45);
}

(This post was last modified: 06-24-2012, 05:18 PM by Apjjm.)
06-24-2012, 05:01 PM
Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#46
RE: Katamari: The dark descent (Update 24/06)

I don't get any of that but i'm sure it's great.

Hi.
06-24-2012, 05:12 PM
Website Find
The Shanus Offline
Member

Posts: 134
Threads: 15
Joined: Jun 2012
Reputation: 3
#47
RE: Katamari: The dark descent (Update 24/06)

Every time I see Apjjm's work my anus tingles a little.

[Image: theshanusyoutube.jpg]
(This post was last modified: 06-25-2012, 01:03 PM by The Shanus.)
06-25-2012, 12:53 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#48
RE: Katamari: The dark descent (Update 24/06)

I feel if I were to open the .hps to this mod, my computer would explode. I can only imagine what is going on in there.

Also, I never knew there was an issue with the AddAttachedPropToProp. May I ask what it was doing wrong? (unless it was what you said in the parenthesis)
06-25-2012, 04:27 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#49
RE: Katamari: The dark descent (Update 24/06)

(06-25-2012, 04:27 PM)Statyk Wrote: I feel if I were to open the .hps to this mod, my computer would explode. I can only imagine what is going on in there.

Also, I never knew there was an issue with the AddAttachedPropToProp. May I ask what it was doing wrong? (unless it was what you said in the parenthesis)
It's a bug where one parameter is used for two things (probably down to a typo in Amnesia source Tongue). I wrote a topic when i first encountered the issue some time ago:
http://www.frictionalgames.com/forum/thread-9358.html

I updated the wiki with the bug and the no-rotation fix the other day.

The hps source (after pre-processing) currently stands at 2872 lines, but 1800 of those lines are an automatically generated lookup table of information about entities.
(This post was last modified: 06-25-2012, 05:00 PM by Apjjm.)
06-25-2012, 04:58 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#50
RE: Katamari: The dark descent (Update 24/06)

Opening the hps opens a portal into the fourth dimension whose contents your feeble human mind cannot hope to comprehend.

No seriously, he wrote a script for my CS, and it feels like I'm staring at a Matrix screen when I'm trying to understand it. Big Grin

06-25-2012, 06:41 PM
Find




Users browsing this thread: 1 Guest(s)