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


Thread Rating:
  • 14 Vote(s) - 2.93 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Challenge Threadᆦ ᆦ ᆦ
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
RE: [CHALLENGE THREAD]

(05-01-2012, 05:20 AM)Homicide13 Wrote: Hm Wait a second, why are you using the "->" to reference the class' member functions?

Most likely a C++ habit he unconsciously let through.

Tutorials: From Noob to Pro
05-01-2012, 11:22 AM
Website Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
RE: [CHALLENGE THREAD]

Alright, that's what I thought, but I just wanted to make sure. ;_;

05-01-2012, 12:37 PM
Find
nemesis567 Offline
Posting Freak

Posts: 874
Threads: 65
Joined: May 2011
Reputation: 10
RE: [CHALLENGE THREAD]

Huh? Maybe. I thought, array, pointer, pointer requires ->.

Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
05-01-2012, 01:35 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
RE: [CHALLENGE THREAD]

(05-01-2012, 01:35 PM)nemesis567 Wrote: Huh? Maybe. I thought, array, pointer, pointer requires ->.

You're confusing yourself with something else. Then again, even in C++ arrays or classes aren't always allocated with the new keyword (though, only classes can have methods).

Tutorials: From Noob to Pro
05-01-2012, 02:07 PM
Website Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
RE: [CHALLENGE THREAD]

My solution:
void OnStart()
{
    //Attach some prop detectors to the bridges
    AddAttachedPropToProp("bridge_1","collider_1","bridgeCollider.ent",0,0,0,0,0,0);
    AddAttachedPropToProp("bridge_2","collider_2","bridgeCollider.ent",0,0,0,0,0,0);
    
    //Callbacks
    AddEntityCollideCallback("barrel01_*","collider_1","cbAddPropBridgeDown",false,0);
    AddEntityCollideCallback("Player","collider_1","cbAddPropBridgeDown",false,0);
    AddEntityCollideCallback("barrel01_*","collider_2","cbAddPropBridgeUp",false,0);
    AddEntityCollideCallback("Player","collider_2","cbAddPropBridgeUp",false,0);
    
}


//Add/Remove a prop to the bridge we need to pull down
void cbAddPropBridgeDown(string &in asParent, string &in asChild, int alState)
{    
    if(asParent == "Player")
        AddLocalVarInt("BridgeDown",3 * alState); //Player ways 3x more than a barrel...
    else
        AddLocalVarInt("BridgeDown",alState);
    moveBridges();
}

//Add/Remove a prop to the bridge we need to pull up
void cbAddPropBridgeUp(string &in asParent, string &in asChild, int alState)
{
    
    if(asParent == "Player")
        AddLocalVarInt("BridgeUp",3 * alState); //Player ways 3x more than a barrel...
    else
        AddLocalVarInt("BridgeUp",alState);
    moveBridges();
}

//Determine what levels the bridges should move to
void moveBridges()
{
    //Relative weights on bridges
    int up   = GetLocalVarInt("BridgeUp");
    int down = GetLocalVarInt("BridgeDown");
    int diff = up - down;
    AddDebugMessage("Up: " + up + " Down: " + down + " Diff: " + diff,false);
    
    //Work out relative weights & clamp (to stop bridges going through the floor).
    float state = diff * 0.1f;
    if(state>1.0f)       state = 1.0f;
    else if(state<-0.5f) state = -0.5;
    
    //Move based on relative weights
    SetMoveObjectStateExt("bridge_1",-state,0.65f,1.5f,0.125f,true);
    SetMoveObjectStateExt("bridge_2",state,0.65f,1.5f,0.125f,true);
}
I used the Bridge Collider entity which i provided as an addition file.
05-01-2012, 03:47 PM
Find
nemesis567 Offline
Posting Freak

Posts: 874
Threads: 65
Joined: May 2011
Reputation: 10
RE: [CHALLENGE THREAD]

quite simpler than mine.

Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
05-01-2012, 04:04 PM
Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
RE: [CHALLENGE THREAD]

Hm I don't know much about physics, but wouldn't even one object's worth of imbalance cause the bridges move to their respective maximum/minimum positions?

05-01-2012, 06:01 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
RE: [CHALLENGE THREAD]

(05-01-2012, 06:01 PM)Homicide13 Wrote: Hm I don't know much about physics, but wouldn't even one object's worth of imbalance cause the bridges move to their respective maximum/minimum positions?
Not always, but you are free to make that interpretation. The behaviour depends on the mechanics "behind the scenes" of the balancing on the bridges (Obviously if it is just bridge->pulley->pulley->bridge then yes). The specification I gave wanted a counterbalance puzzle, I am not too concerned how people interpreted that (and how the bridges should behave - assuming it isn't totally unintuitive) past the point of putting boxes onto bridge 1 effects bridge 2 in a proportional and opposite manner - so either is/was acceptable.
(This post was last modified: 05-01-2012, 06:47 PM by Apjjm.)
05-01-2012, 06:39 PM
Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
RE: [CHALLENGE THREAD]

So what is the new challenge? Smile

05-02-2012, 05:45 AM
Find
Theforgot3n1 Offline
Member

Posts: 192
Threads: 20
Joined: Apr 2012
Reputation: 6
RE: [CHALLENGE THREAD]

First i was like: Yeah, there will be some guy solving everything instantly anyway. But I just noticed that you are answering most of the challenges. Which means that people don't know how to answer these.
If you could make the challenges slightly easier, maybe I can actually participate. Big Grin

Or ah, don't mind me.

Confusion: a Custom Story - Ch1 for play!
http://www.frictionalgames.com/forum/thread-15477.html
About 50% built.
Delayed for now though!
05-02-2012, 09:19 PM
Website Find




Users browsing this thread: 1 Guest(s)