Not logged inOpenClonk Forum
Up Topic Development / Scenario & Object Development / Mountain climbing scenario help
1 2 Previous Next
- - By MrFoamy [gb] Date 2011-05-30 01:08 Edited 2011-05-30 02:19
Hi

I first heard about clonk yesterday and me and my friend had so much fun climbing the outside of Shiver Peak that i decided to have a go at making it a bit more of a challenge. So far i've got it pretty challenging and it works well but as i've never coded in C4Script before and i dont understand the way the engine works so my knowledge of C can only take me so far.

Firstly in order to get the spawn out of the mountain i moved it to the edge and used the checkpoint dynamite clearing method to open it up. The problem is that the explosives cause rubble which hurts the players when they spawn. Is there any way of either clearing the space without rubble or of making the people invulnerable for a short while?

On the other hand we have found that the fall damage is almost non existent and so i'm wondering if it would be possible to make it a bit more powerful?

Lastly, my vision is to make it a highly cooperative climbing experience so i'd love to be able to give each player a different kit load-out when they spawn but i cant seem to get the map to differentiate between players when they spawn.

And for a bonus question it would be awesome if the grappling hook didn't attach to ice or snow very reliably.

Thanks for the help.

EDIT: I also seem to have run into a problem with eclipse as whenever i try to run a scenario it immediately crashes the engine. It also says that debugging is not supported when i try to use the debugger. Not sure what i did as even stock scenarios crash.
Reply
Parent - - By Newton [de] Date 2011-05-30 02:48
Hi MrFoamy
Glad to hear that you like the scenario and would even like to improve it! I for my part always played it very... non-cooperative ;-)

>Is there any way of either clearing the space without rubble


have you tried the function DigFree?

>On the other hand we have found that the fall damage is almost non existent and so i'm wondering if it would be possible to make it a bit more powerful?


There is no falling damage in Clonk. IMO it shouldn't be enabled for just one scenario. If, it should be standard but I reckon that many people would not like that, to have his clonk vulnerable like that. Anyway, this would require a bit more knowledge about C4Script. You basically catch the Hit callback and check for the speed the clonk had on impact - then you deal damage accordingly.

>so i'd love to be able to give each player a different kit load-out when they spawn but i cant seem to get the map to differentiate between players when they spawn.


I haven't looked into the (respawn) code yet, but each player is numbered in the script. This number should be passed around in any function that deals with the respawning of the player as well as the initial spawn of the player (InitializePlayer function).

>And for a bonus question it would be awesome if the grappling hook didn't attach to ice or snow very reliably.


I think that feature would be considered as a bug then ;-). You would have to write an #appendto script to the grappler which you then put into System.ocg/Grappler.c (or something) of your scenario which overwrites the parts of the grappler where it is about attaching to surfaces. Could be not-so-easy to do.

>have run into a problem with eclipse as whenever i try to run a scenario it immediately crashes the engine. It also says that debugging is not supported when i try to use the debugger. Not sure what i did as even stock scenarios crash.


Do you use the release version or a nightly build/development snapshot? You should use a development snapshot for developing (IMO).
Parent - - By MrFoamy [gb] Date 2011-05-30 03:39 Edited 2011-05-30 03:42
Thanks for the fast response.

>have you tried the function DigFree?


No but i'll give it a go when i get the editor working again.

>I haven't looked into the (respawn) code yet, but each player is numbered in the script. This number should be passed around in any function that deals with the respawning of the player as well as the initial spawn of the player (InitializePlayer function).


Thinking about it now when i tried to do it before with a couple if statements i didn't know what the syntax was so it probably would work if i fixed that.

>Do you use the release version or a nightly build/development snapshot? You should use a development snapshot for developing (IMO).


I downloaded the snapshot but found lots of textures to be missing and so didn't use it for the editing. Is that not supposed to happen? I've only tried the 64bit version.

I think i'll experiment for a bit when i get it running again and then have a go with the more advanced parts. Good to know that theoretically it should all be possible though.

EDIT: Actually thinking about it I remember the first time i downloaded the dev snapshot i got a bunch of errors extracting it with winrar. I just tried again and they're still there. Maybe the file on the server is corrupt?
Reply
Parent - - By Zapper [de] Date 2011-05-30 06:06 Edited 2011-05-30 06:14
I just tested the latest snapshot - there seems to be a ".c4*"-file in the archive that cannot be extracted. But I think that this file shouldn't be there in the first place, so everything else should run fine (at least it did for me :)  )

And since you mentioned you know C: If you already worked with revision control systems, you could use HG (for example TortoiseHG (windows)) to get the up-to-date-version from the repository we work with. But if not, the development snapshot works just as well :)

PS:

>I downloaded the snapshot but found lots of textures to be missing and so didn't use it for the editing.


That could be related to the introduction of the new, fancy landscape shader (see http://forum.openclonk.org/topic_show.pl?pid=13511#pid13511 ). The shader needs a fixed size of the textures. You can deactivate it by deactivating "High Res Landscapes" in the options (and maybe "Shaders", too).
Parent - - By MrFoamy [gb] Date 2011-05-30 06:24
Yeah i just set up tortoise and have been playing around with the test scenarios. I'll get it set up with eclipse tomorrow.

As for the snapshot when i load a scenario around half of the textures are just transparent. Not sure how some are missing if it's all in one package.

Thanks for all the help. I should be able to get a lot more done now.
Reply
Parent - - By Newton [de] Date 2011-05-30 11:32
Uh oh. Can it be that Peter by accident broke the "normal" landscape shading when he introduced the new one? I already wondered why everything gets so dark when not using the shader.
Parent - - By Zapper [de] Date 2011-05-30 11:46
I did my before/after-screenshot with the same version of the engine (just with the Shaders+HighRestLandscape deactivated). So at least in Shiver Peak the textures work - I had the feeling that everything was too dark, though
Parent - - By PeterW [gb] Date 2011-05-30 12:21
On the brightness: I still think it's the FoW on one side and this bug in the brightness calculation on the other. The landscape shader should now be about 15% darker than before as well. When it works, that is.
Parent - - By MrFoamy [gb] Date 2011-05-31 06:31
Is it normal that the FoW does not work on the dev build? Well by that i mean it only works for outside areas and everything that is inside is visible.
Reply
Parent - - By Ringwaul [ca] Date 2011-05-31 08:09
This is what I'm getting (without high-res landscape on):


FoW bug; quite recent as far as I can tell. If it becomes a nuisance just turn the Fog of War off: /script SetFoW(false)
Reply
Parent - - By Newton [de] Date 2011-05-31 11:01
Even after this patch from yesterday?: http://hg.openclonk.org/openclonk/rev/eda4092454fd
Parent - By Ringwaul [ca] Date 2011-05-31 11:25 Edited 2011-05-31 11:30
It might be I haven't built the engine since then. I'll try and see if it fixes the problem.

Edit: Yeah, I had an old engine. Your patch did fix it quite nicely.
Reply
Parent - By Günther [de] Date 2011-05-31 11:47
Sorry about that. I only tested two out of the three landscape modes we have: Classic landscape plus Shader-FoW and Peters Landscape, and the patch Newton reverted did improve the classic-landscape-with-shader-fow case. I'll add a comment to the engine to prevent this from happening again.
Reply
Parent - - By MrFoamy [gb] Date 2011-05-31 17:01
This is what i get with everything turned on:



If high res is off then it's fine.
Reply
Parent - - By Newton [de] Date 2011-05-31 17:09
Whats wrong in that screenshot?
Parent - - By MrFoamy [gb] Date 2011-05-31 17:44
The rocks are all visible even when they should be covered by FoW.
Reply
Parent - - By Zapper [de] Date 2011-05-31 18:10
Ah, yes. FoW does not work with the new landscape shader at the moment :)
Parent - By MrFoamy [gb] Date 2011-05-31 19:03
Ah that's good then.
Reply
Parent - By PeterW [gb] Date 2011-05-31 18:13
The new landscape doesn't have FoW so far. The way FoW works, that's not a bug, but a missing feature.
Parent - - By PeterW [gb] Date 2011-05-30 12:17
I guess he is seeing the same bug as you do? With high-res active, that is. He was seeing the warnings about misfit textures as well, which should only show with high-res landscape active. My hunch is that the texture indexing is wrong somehow, we'll have to check that.

The "classic" landscape rendering should really be the same as before. I ended up not touching any rendering code of it, just moved the shading calculation to C4LandscapeRenderClassic.cpp. That's pretty conservative.
Parent - By Newton [de] Date 2011-05-30 12:33
It's not the same. I can show you later on skype or something.
Parent - - By MrFoamy [gb] Date 2011-05-30 19:55

>I'll get it set up with eclipse tomorrow.


I've got the nightly build loaded into eclipse now but i still crash every time i try to run a scenario. Would it be worth reinstalling eclipse or is this a known issue?

EDIT: It also crashes when starting in debug mode.
Reply
Parent - - By MrFoamy [gb] Date 2011-05-30 20:26
I just reinstalled eclipse and it is still crashing.
Reply
Parent - - By MrFoamy [gb] Date 2011-05-30 20:39 Edited 2011-05-30 21:17
Found the problem was a screwed up player file.

EDIT: Seems that it dies when the player is named. the error it's giving before it crashes is:

>[21:10:40] File not found or invalid: C:\...\OpenClonk\\Foamy.ocp\Foamy.oci\Portrait.png
>[21:10:40] File not found or invalid: C:\...\OpenClonk\\Foamy.ocp\Pancakes.oci\Portrait.png


EDIT 2: Fixed the errors by deleting and remaking the player but not i'm just back to it crashing with no error.
Reply
Parent - - By Newton [de] Date 2011-05-30 22:46
That looks more like an engine error than an eclipse error. So you can start Clonk normally just like that but if you start it with Eclipse it crashes?
Parent - - By MrFoamy [gb] Date 2011-05-30 23:50
Yeah basically.

If i remove all of the player files it doesn't crash and you can view the map but obviously it doesn't spawn anyone so testing is impossible.

It's not a major problem though as now i'm using the repository it's able to just save the scenario directly and i can leave the game running and just abort/reload whenever i need to test something new.

I've no idea what i did to cause the crash but i was playing around with several bits just before it happened. The most likely thing i was messing with was the player files.
Reply
Parent - - By Zapper [de] Date 2011-05-31 05:33
Mh, you could try creating a new player from within the version of OC you use for developing. We recently changed something about the player-file format, so there might be some unexpected results if you created the player with an older version than you are trying to use right now
Parent - By MrFoamy [gb] Date 2011-05-31 05:46
I tried that earlier and unfortunately it did not help. The problem actually started before i changed versions though.
Reply
Parent - - By MrFoamy [gb] Date 2011-05-31 19:21
Is it possible to export a scenario made using the nightly build in a format that can be used by the release version?
Reply
Parent - By B_E [de] Date 2011-06-01 10:44
Yes, the format is .ocs which is a C4group in which the data is packed (like as in gzip). You can create them by using the c4group-tool in the planet/-folder with the -p Parameter to pack the scenario-folder.
Parent - - By MrFoamy [gb] Date 2011-05-31 02:00 Edited 2011-05-31 03:05

>I think that feature would be considered as a bug then ;-). You would have to write an #appendto script to the grappler which you then put into System.ocg/Grappler.c (or something) of your scenario which overwrites the parts of the grappler where it is about attaching to surfaces. Could be not-so-easy to do.


I've got the code working so that the hook wont attach to digable terrain but amusingly the bit i've got stuck on is making it work as an #appendto file. What have i done wrong?

my code:

// Stop the grappling hook working on diggable terrain

#appendto Hook

public func Hit(x, y)
{
  if(GetMaterialVal("DigFree","Material",GetMaterial(x, y)))
  {
    return;
  }
 
  else
  {
    Stick();
  }
   
}



EDIT: I've also tried to get the fall damage to work but i'm having some trouble. If i use "Explode" instead of "DoDamage" then it works perfectly. Do i need to be sending something else for the damage instruction?

func Hit(int iXSpeed, int iYSpeed)
{
  if(iYSpeed < 350) return;
  if(GetAction() != "Walk") return;
  if(iYSpeed >= 450) DoDamage(500);
  var iKneelDownSpeed = 18; // Fall damage
  SetXDir(0);
  SetAction("Kneel");
  PlayAnimation("KneelDown", 5, Anim_Linear(0, 0, GetAnimationLength("KneelDown"), iKneelDownSpeed, ANIM_Remove), Anim_Linear(0, 0, 1000, 5, ANIM_Remove));
  ScheduleCall(this, "EndKneel", iKneelDownSpeed, 1);
}
Reply
Parent - - By Ringwaul [ca] Date 2011-05-31 03:15 Edited 2011-05-31 03:31
The script file should be within a System.ocg folder, for example:

GrappleHookMod.ocd\System.ocg\HookNoStick.c

Edit:
To deal damage to the clonk you should use a negative value of "DoEnergy(int change)" instead of DoDamage(). Damage is another variable unrelated to 'Energy' (used for 'health' for living objects). Damage is more script friendly for vehicles, because the object does not require to be alive. Have a look at the Airship's Hitbox object for a clean example of how 'damage' works.

For fall damage for the clonk, you'd probably want something like this:

var yhurt = 60;
if(GetYDir() >= yhurt) DoEnergy((GetYDir() - yhurt) * -1)

60 is a relatively fast falling speed (from a fall of around 200pixels, or the height of 10 clonks), so damage would start being taken from there (yhurt). The greater the clonk falls past 60px/s would equate to the damage taken (so a hit-speed of 75 would deal 15 damage).
Reply
Parent - - By MrFoamy [gb] Date 2011-05-31 04:19 Edited 2011-05-31 05:35
Thanks i got the fall damage working perfectly now.

The append files are already inside a system folder though. Do i have the id set correctly for them?

EDIT: Seems that my hook code is having some problems. I was wondering why it was being so unpredictable and so i added a line to display the material at the hook's position. When testing it just gives random results with the most common being "vehicle". I've tried offsetting it but cant get a reliable reading.
Reply
Parent - By Ringwaul [ca] Date 2011-05-31 08:01

>Do i have the id set correctly for them?


Good thinking; the id for the Hook is actually "GrappleHook". You can check the DefCores of objects to find out their IDs by the way.

Edit: I see Zapper already got that. :X Heh.
Reply
Parent - - By Zapper [de] Date 2011-05-31 05:36 Edited 2011-05-31 05:38

>I've got the code working so that the hook wont attach to digable terrain but amusingly the bit i've got stuck on is making it work as an #appendto file. What have i done wrong?
>#appendto Hook


The ID of the grappler's hook is "GrappleHook" :)

PS: And you might want to divide the speed (x and y) by 10, since the parameters of Hit() have a higher precision than the usual 10pixel/frame. (So if you would use SetYDir(-y) instead of SetYDir(-y/10) in Hit(x, y) the hook would not only bounce back but it would accelerate! )
Parent - - By MrFoamy [gb] Date 2011-05-31 05:42 Edited 2011-05-31 05:53
I'm not sure i understand, aren't x and y position coordinates rather than speed values?

EDIT: Also the grapple append file works now, thank you! You wouldn't happen to know the ID for the fall damage or how to find it would you?

EDIT2: Never mind i got it working. Must have been a small mistake somewhere before but it works and the ID was correct after all.
Reply
Parent - - By Zapper [de] Date 2011-05-31 05:55

>I'm not sure i understand, aren't x and y position coordinates rather than speed values?


The x and y value in Hit(x, y) are the value of the old speed before hitting the landscape, since the speed was probably already reset there. Usually the unit is pixels/10frames so a speed of 35 would mean 3.5 pixels/frame. In Hit(x, y) the unit is pixels/100frames so instead of the expected 35 you would get a 350 (and to get the real value in pixels you might even want to divide it by 100 instead of 10).
Thinking about it, you could also just cap the value to the closest pixels around the impact point: x = BoundBy(x, -2, 2);
The reason why your GetMaterial(x, y) works even though the values are speed values instead of coordinates is, because the coordinates of GetMaterial are local coordinates - that means they are relative to the object from where you call the function.
So GetMaterial(3, 5) would use the coordinates that are equal to GetX()+3 | GetY()+5

>You wouldn't happen to know the ID for the fall damage or how to find it would you?


There is no fall damage object.
You could try appending your script to "Clonk" if that is what you mean. But I could imagine that there are some subtle problems with the Hit-callback there where you don't always get the correct parameters (since the speed was already reset before the callback). But that might also have been fixed since CR
Parent - By MrFoamy [gb] Date 2011-05-31 06:17
Thank you so much. The hook now behaves perfectly. It even only hooks onto ice and dirt occasionally.
Reply
Parent - By Maikel Date 2011-05-30 14:47

>Lastly, my vision is to make it a highly cooperative climbing experience so i'd love to be able to give each player a different kit load-out when they spawn but i cant seem to get the map to differentiate between players when they spawn.


In the scenario script there is a function OnPlayerRespawn(int plr, object cp) where you can differentiate between players and checkpoints.
- - By MrFoamy [gb] Date 2011-05-31 19:16 Edited 2011-05-31 20:52
I tried to test the map in multi-player a while ago and we were having a lot of problems. We tried with both the nightly build and the snapshot and for both we were unable to play even the included scenarios. Half the time the person connecting to the host would crash before the map started and the other half we lost synchronisation and disconnected as soon as we spawned.

Is this a known problem? Both running windows by the way.

I can upload the logs if it would be helpful.

EDIT: The pickaxe has also stopped working which is strange because i have not modified it with an append and i just tried reverting everything back to the repository version and it still does it. The problem is that when you swing it it just stays in the hit position while looping the hit sound and shooting sparks without removing any material.
Reply
Parent - - By Newton [de] Date 2011-05-31 21:10
Haha, yeah. A few weeks ago we wanted to play some multiplayer matches too. It also crashed every time we tried to start. It ended up in us trying to find bugs via stacktraces and that kind of stuff. Dunno exactly what was the outcome of this.
Parent - - By Zapper [de] Date 2011-06-01 05:35

>Dunno exactly what was the outcome of this.


We (as in: Guenther) fixed one bug with the player loading. But that was not the "main" crash reason. Maybe we should just try to get the engine to crash using debugbuilds this evening to see whether we can find those crashes.
Having good game content is great and all - but doesn't help a lot if noone can play it ;)
Parent - By Günther [de] Date 2011-06-02 13:02
That bug didn't even occur in release builds or with new player files.

Someone making the engine crash with a build with debug informations (not necessarily a debug version of the engine, just enough for the debugger to generate a stacktrace) and a debugger attached would really help.
Reply
Parent - - By MrFoamy [gb] Date 2011-06-22 23:13
Just thought i'd mention that i've not given up on this. I've got a load of ideas for improving stuff, just want to wait until i can test things in multiplayer.
Reply
Parent - - By Gurkenglas [de] Date 2011-06-24 19:57 Edited 2011-06-24 21:08
Try to use the release version of OpenClonk, it is relatively stable in multiplayer.
http://www.openclonk.org/download/
Just remember that the file endings are c4d, c4g, etc. instead of ocd, ocg, etc.
Reply
Parent - By Zapper [de] Date 2011-06-24 20:24
No, it is not.
Parent - - By MrFoamy [gb] Date 2011-06-25 00:12
Wait so do the file extensions mean much? the impression i got was that the release version uses an older file format and the new version has different extensions to reflect that and so when you package something using the new packager it is not simply a case of editing the extension to make it compatible with the older one. I must admit that i haven't tried though.
Reply
Parent - - By Zapper [de] Date 2011-06-25 09:38
I believe at this point the extensions are really just renamed and the file format stayed the same. I am not 100% sure, though
Parent - By Gurkenglas [de] Date 2011-06-25 10:07
Same statement from me. Should push it further to the 100%
Reply
Parent - By Caesar [de] Date 2011-06-25 19:11
They were just renamed and remain fully compatible. However, some of the fields like the Author-property aren't set anymore.
Up Topic Development / Scenario & Object Development / Mountain climbing scenario help
1 2 Previous Next

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill