I've decided, after FG did the first one, that it would be helpfull for everyone to launch challenges once in a while. So I create this thread, that most likely will just fall into the old forums, but well, it's worth the try...All in all I can solve it myself and it is something good already.
So, I decided to launch a challenge every now and then and give you members 24-48 hours to solve it. It will generally be a fast thing and I there's nothing you earn but knowledge. Every solution will be fully explained along with everything it comes with. Whoever wins the challenge will be able to launch the next challenge. If nobody wins the challenge in the given time I will do it. Note that before you launch something you must have solved it before, that includes me of course.
Objective: Pick up hard situations and help people know how they are done and mostly get experience and knowledge.
Rules:
Spoiler below!
- Any attempt to copy/steal/share someone's work on the challenge or if any questions asked here are directly about it will make the current challenge to be left unanswered and new one to be placed.
- Failure to complete the challenge in the given time will result in the challenge creator to give the solution of the challenge.
- If a challenge creator creates an impossible to solve challenge, he will not be able to solve the next challenge.
- It's acceptable for a group of people to work on the challenge as one.
- Everyone can participate, that includes FG.
- If this thread becomes inactive or if most people think this is a bad idea, this thread shall be removed.
- If two solutions are released in the same 2 hours, the one that is more complete/better coded or better in generally will be chosen.
- The solution shall be posted here once complete. Discussion about the challenge is also allowed in the thread, but keep it organized or else solutions might get lost.
- The solution will remain here for eternity after accepted.
- Once you complete the challenge you must place down the exact time the timer had when you finished it(REFRESH THE PAGE FIRST) to avoid having to check by the post hour.
- To participate you must make a post stating that you will try to solve the challenge currently active.
- You can only post one solution. There's no editing after that, if it's not as supposed, you fail.
- The solution consists of a working map with all required assets, an explanation and a commented script.
- Failure to give a solution with everything requested in the challenge details will result in the solver's elimination from the current challenge and his incomplete solution will become available for anyone to use and finish.
- The solution must be as complete as possible and as SIMPLE as possible. If in the challenge time two solutions appear in a close time range and one is a lot better than the other one, the better one will be used unless the first rule is broken.
- The challenger can give more time if no solution comes up at will, but can't do so without guarantee that he already solved the challenge.
"There is a room with a door, a rope and a crate. The player ties the crate to the rope and the door and when the player drops the crate into the hole, the door shall open."
Spoiler below!
Details:
- The room can start with the rope tied up already to the door(to avoid the main question of FG own situation for employment and avoid time wasting trouble), and there should be a support in the ceiling/wall so that the rope will be attached to it and only after that to the crate(to avoid collision errors).
- THERE MUST BE a check to know if the crate is falling down with enough speed to open a door, if it isn't, the door shall not open and the crate must hang by the rope and not fall down.
- You must not use a model as rope, you must use rope areas to solve the problem.
- The door must be a Move Object.
(More details because they were asked)
- There must be two or three rope areas only. Rope failed collision (rope trough floor or other objects) is accepted while controlled.
- The rope pulling actions must look realistic, but remember that this is a test map so it may not be extremely accurate. Other Notes:
Because of the nature of this challenge if FG feels like it should remain unanswered I will remove it ASAP and replace it with another one.
void OnStart() { FadeOut(0.0); //Start with a black screen FadeIn(2.0); //Then slowly fade in^^ AddAttachedPropToProp("scriptCrate_1", "scriptHook_1", "meat_hook.ent", 0, 0.7, 0, 0, 0, 0);//Attach hook to crate so it looks like there's something to attach the rope to. AddUseItemCallback("RopeOnDoor", "rope", "scriptDoor_1", "OnUseItem", false);//This is of no importance to this challenge and as such as no meaning. AddUseItemCallback("RopeOnCrate", "rope", "scriptHook_1", "OnUseItem", false);//This is of no importance to this challenge and as such as no meaning. AddEntityCollideCallback("scriptHoleArea_1", "scriptCrate_1", "OnEntityCollide", false, 1);//When the crate 1 collides with the first script area in the hole, the function OnEntityCollide will be called. AddEntityCollideCallback("scriptHoleArea_2", "scriptCrate_1", "OnEntityCollide", false, 1);//When the crate 1 collides with the second script area in the hole, the function OnEntityCollide will be called. InteractConnectPropWithRope("PropConnectRope_1", "scriptCrank_1", "scriptRope_1", false, 6, 6, 6, true, 0);//Connect the valve with the rope so that the valve controls the rope lenght. When this happens the rope will change it's lenght according to the valve's movement. SetWheelAngle("scriptCrank_1", 2.0, true); //Ensure that the rope lenght is quite good and realistic the easy way. AddDebugMessage("Game Started", true);//Useless SetEntityInteractionDisabled("scriptCrank_1", true);//Make sure that the player can't mess with the wheel since it would harm up the level.
}
//THIS AS NO INTEREST FOR THE CHALLENGE ITSELF...SKIP void OnUseItem(string &in asItem, string &in asEntity)//Called when an item is used. I do it this way for the sake of good coding practices and making the script easier to understand. {
if(asItem == "rope")//If the item being used is the rope { if(asEntity == "scriptDoor_1")//If the object the item is used on is the door {
} else if(asEntity == "scriptCrate_1")//if the object the item is used on is the crate. {
} } }
void OnEntityCollide(string &in asParent, string &in asChild, int alState) //Called when two entities collide with each other {
if(asParent == "scriptHoleArea_1")//If the entity that's receiving the collision from another is the first area in the hole(from top) { if(asChild == "scriptCrate_1")//If the entity that's colliding with asParent is the Crate { AddTimer("MovementTimer", 10.0, "nullFunction");//Creates a time to measure the time between the crate reaches scriptHoleArea_1 and scriptHoleArea_2 } } else if(asParent == "scriptHoleArea_2")//If the entity that's receiving the collision from another is the second area in the hole(from the top) { if(asChild == "scriptCrate_1")//If the entity that's colliding with asParent is the Crate {
if(calcSpeed(10.0-GetTimerTimeLeft("MovementTimer")) > 1) //Only pass this condition if the velocity is enough. It would be unreal to just blow a lock without guarantee it was strong enough for it. { ropeEvent();//Do the rest of the functions that need to be done on the rope event. AddDebugMessage("Rope EVENT triggered", true);//Useless now. } RemoveTimer("MovementTimer");//Make sure the timer is removed so it can be started again if need be. } } }
float calcSpeed(float Time) //Calculates the speed given a time and based on the 9.87 gravitational accelaration on earth. Might not be accurate but it's just a formula and after you can set the values for min speed of the crate as you wish. { float v = Time * 9.87;//Velocity = Time * g(accelaration). I could just take the distance between areas instead of time and use Velocity = Distance/Time. IMPORTANT: The map has a small mistake, the first area should be on the floor level. As it is now it will not be managing the speed the crate has before reaching the first area. But as said before, this is just a reference value.. return v; }
void ropeEvent()//Only exists for clearer reading and is described above. { InteractConnectPropWithRope("PropConnectRope_2", "scriptCrank_1", "scriptRope_2", false, 6, 6, 6, false, 0);//Now connect the second rope with the crank so it doesn't suffer from the first change under OnStart but now is pulled to make a realistic effect. InteractConnectPropWithRope("PropConnectRope_2", "scriptCrank_1", "scriptRope_3", false, 6, 6, 6, true, 0);//Same as above but now the direction is inverted since the rope area and posnode are also inverted unlike before. InteractConnectPropWithMoveObject("PropConnectDoor_1", "scriptCrank_1", "scriptDoor_1", false, false, 0);//Connect the door with the same crank so that it will open when the crank moves in the right direction. Using 1 valve for everything will make sure the movement of ropes are more or less the same. SetWheelAngle("scriptCrank_1", 10, true);//Move the valve. SetSwingDoorLocked("scriptDoor_1", false, false);//Useless, from previous script SetSwingDoorClosed("scriptDoor_1", false, false);//Useless, from previous script RemoveEntityCollideCallback("scriptHoleArea_1", "scriptCrate_1");//Remove the entity collision of the crate with the area to avoid bugging up the level RemoveEntityCollideCallback("scriptHoleArea_2", "scriptCrate_1");//Same as above.
}
April, 12, 2012 - nemesis_567
"A certain monster is especially affected by iron, and when hit severall times by the player with it, it will fade away."
Spoiler below!
Details:
- Throwing iron to the monster must make different damage than hitting the monster itself with your hands.
- Health must be managed script side.
- There must be some indicator that the monster as taken damage, probably the monster already has it(flinch animation), so choose the right monster.
class grunt //Create class grunt { grunt(int nInitialHealth, string asName, string &in asSpawnArea) //Constructor { nHealth = nInitialHealth;//Initialize nHealth sName = asName;//initialize sName CreateEntityAtArea(sName, "servant_grunt.ent", asSpawnArea, true);//Create the monster //AddEntityCollideCallback("scriptShovel_1", asName, "OnEntityCollide", false, 0); I was going to do this but the timer sounded more interesting. bActive=true;//A class tracker, set to true for Active bKilled = false;//Same AddDebugMessage("Succeed", false); } bool isAttacked() const //For use with timer. Check if the monster is being attacked { if(GetEntitiesCollide(sName, "scriptShovel_1")) return true; else return false; } void giveDamage(int nDamage)//give the monster damage { if(bKilled == true) return; nHealth -= nDamage; PlaySoundAtEntity("attackSound", "attack_claw_hit.snt", sName, 0.0f, false); CreateParticleSystemAtEntity("attackPS", "ps_blood_tiny_splash.ps", sName, false); //It's not centered but I won't bother myself with it. if(nHealth <= 0) kill();
- None of the files except the .hps files may be changed (you can look at everything, but you may not make any changes).
- The contents of all of the .hps files must be identical with each other.
- The matchbox must escape from each of the the mazes without player interference (only through script).
"A room contains two bridges. One of the bridges must be lifted by weighing down another enough to permit the player to cross the bridge to the edit door. Barrels and the player both act as weights."
A counterweight puzzle must be designed (as bridge_1 moves down, bridge_2 moves up by the same amount). The movement of the bridges must be affected by the weight of the objects on the bridges (E.g. having one barrel on each bridge, then adding a second one to a bridge should move the second bridge down).
Barrels or the player may be placed on a bridge to weight it down
At least 4 barrels must be placed on the bridge_1 before the puzzle can be completed.
Bridges must move up and down according to the weight difference.
The player must "weigh" more than a barrel.
It should not be possible to weight down a bridge so much that either clips through walls/floor.
Additional Notes:
You are free to change the bridge entity files
You are free to add or remove entities/areas/etc from the map
You may want to download this entity file (it may help depending on your approach).
Barrels should ideally be touching the bridge entities if they acting as weights.
Time: Challenge was solved.
Participants:
- nemesis_567
- homicide13
Winner: nemesis_567
Solution:
PHP Code:
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);
//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); }
Very Hard -"Create a working camera system" Hard -"Create an artificial coordinate system" Medium -"Create a working market system" Easy -"Create a player basic needs system."
Details:
Very Hard:
You must create an system that allows the player to set the camera to move from a place to another using different kinds of motion. Circular, Elliptical, Trigonometrical and so on.
It should be an header file( .h) to be included in a any kind of normal script using Apjjm #include thing.
It must work under any circumstances and fail only at the game limitations. Might affect level editing(like require certain special type entities to be created for the info to be processed)
You can use the level editor for the creation of Areas to tell where to move to if you wish.
Hard:
You must create a system that allows the player to use coordinates for basic artificial functions.
It should be an header file( .h) to be included in any kind of normal script using Apjjm #include thing.
It must work under any circumstances and fail only at the game limitations.
It can(depending on your approach) include a pre-analysis time in the beginning of a level to analyze collision data and thus provide a level layout of sorts. Might affect level editing(like require certain special type entities to be created for the info to be processed)
Coordinates should(or not) use integer values.(To make it easier and less expensive).
Medium:
You must create a system that allows the player to trade.
It should be an header file( .h) to be included in any kind of normal script using Apjjm #include thing.
You must be able to specify the market location, the instrument of trade and for each different market, you have to be able to specify different items.
A market must have a way of activating(script area, on collision preferably) that should be set in the level editor.
Each market must have an items stock. If it ends, and the player didn't sold anything, it will have nothing to sell, so it won't even start.
There should be some sort of interface for each market(can be from GUI if possible to something like pick and drop items inside a location).
Easy:
You must create a system that contemplates sleep deprivation, hunger, thirst, defecation and urinating systems.
It must work well. This is, if the player just ate, he should loose hunger, and only after he must defecate, he can't do that if he is hungry as hell and didn't eat anything.
If he does not find a good place to shit/pee( good places must be specified via script areas, via the areas name), he will pee/shit wherever he is and loose sanity(a lot).
If he does not find a bed to sleep, he shall sleep wherever he is, if the place is not safe(if there is a monster near him somewhere or something you decide), he should die and a message explaining why shall appear, otherwise he should just wake up.
Drinks and food can be any item specified in the source file later on.(Mustn't be static)
If the player is too hungry he should loose sanity and if he is too thirsty he should loose both health and sanity(sanity at a bigger rate than health).
Note: I myself couldn't finish the challenges, but I know they are all solvable since I've planned correctly them all. I just have no interest in keep you all waiting. They're all safe to try to solve. The reason for difficulty levels is due to a certain post in this thread. Time:
How to get employed by Frictional Games:
1. Read employee test.
2. Make challenge thread.
3. Have the whole community solve the challenge for you.
4. Claim that you solved the test all by yourself.
5. Get employed by Frictional Games.
6. Get fired after a week because you can't work.
(04-10-2012, 05:12 PM)Cranky Old Man Wrote: How to get employed by Frictional Games:
1. Read employee test.
2. Make challenge thread.
3. Have the whole community solve the challenge for you.
4. Claim that you solved the test all by yourself.
5. Get employed by Frictional Games.
6. Get fired after a week because you can't work.
I will definitely take that as an insult. If the challenge is not solved within the time I will give the solution. One of my rules is to have it solved before, something I did. If you are not interested, do not participate.
(04-10-2012, 02:49 PM)nemesis567 Wrote: Because of the nature of this challenge if FG feels like it should remain unanswered I will remove it ASAP and replace it with another one.
^I have an idea of how this can be done, but I'll stay out until this has been confirmed.
Oh. I hope they do since this is not even the hard part of their challenge, it's a modified version of the easy part of it. I don't see why shouldn't they allow it.