Farcry modding

Started by
45 comments, last by fagiano 19 years, 7 months ago
Guys, don't forget the far cry modding manual they put up on their website. Anyways, very informative background info on lua and far cry. I also thought that the GC is going to be a culprit for real time apps. Thanks a bunch for the info fagiano.
Advertisement
Hi fagiano!

Can you answer some new questions on design FarCry entity sytem ?

Some entitys do not have client or server functions , like baseentity.lua ( functions not included into client or server table). In this case, what will be doing on server , and what on client ?

What data are transfered across network from server to clients ?
Physic are server side ? As i seen , entitys do not have functions to send messages across network. Entitys do not have any network functions. How entity knows what data needs to be transfered across network from server to client ?
As i understand all entitys working(handling messages/collisions) on server side ?

Thanks!Thanks!Thanks!Thanks!Thanks!Thanks!

P.S.
Sorry for my bad english.
Hi,

Quote:Original post by Anonymous Poster
Some entitys do not have client or server functions , like baseentity.lua ( functions not included into client or server table). In this case, what will be doing on server , and what on client ?

That's because those entities are ment to be single player only, btw if no Client and Server are specified, the entity behaves in the same way on client and server(the same stuff is called/spawned).

Quote:
What data are transfered across network from server to clients ?
Physic are server side ? As i seen , entitys do not have functions to send messages across network. Entitys do not have any network functions. How entity knows what data needs to be transfered across network from server to client ?
As i understand all entitys working(handling messages/collisions) on server side ?


physics is simulated on both sides but the server one is authoritative(if they get too different the client get whipped and adjust according to the server).

if the entity is "update enabled", that means self:EnableUpdate(1) is called at initialization; physical snapshot(Position, orientation, velocity etc..) and state are sinchronized automagically. If is not only the state is synchronized. That's all. However 90% of the time you can just rely on state change, for instance if the entity doesn't move(doors/elevators).
players and vehicles have extra synchronized stuff like firing/crouching/running flags etc...

there is a way to send commands from Cli to server and vice versa Client:SendCommand() or something like that..and you catch it in gamerules.lua OnClientCommand() (not sure about the function names but is something very similar). from server to client serverslot:SendCommand() and you catch it on the clientstuff.lua OnServerCommand(). However this funcz are used mostly for changing GUI or mod related satates.

is as simple as that.


ciao
Alberto
-----------------------------The programming language Squirrelhttp://www.squirrel-lang.org


Alberto,
I'm interested in making aircraft in Far Cry that can taxi, take off and land - oh, yes, and fly! There have been a number of threads about this but I don't think they're getting very far. Sadly Crytek don't seem to be helping people on the forums, despite their initial promises. So I wonder if you'd mind if I asked a few related questions?

1. To achiev a vehicle that can taxi as well as fly, could you recommend the best approach to achieve this? Did Crytek do any work on this?

2. I would favour modding the 4wd vehicle, as it can already taxi. One idea was to modify its gravity setting. I found that gravityx works as well as gravityz - but I didn't find a way of changing the gravity dynamically (when the game is running).

Can gravity be modified in real time as a function of some other variables such as speed? For example, could Update() be used to do this (I understand it's called on every frame).

3. Can the vehicle script read key presses in real time? This would give a means of controlling the vehicle, for example gear up and down.

4. Can scripts call Windows API functions? This would allow, for example, reading the joystick.

Many thanks.

Best regards,
Chris
Quote:Original post by cwright
1. To achiev a vehicle that can taxi as well as fly, could you recommend the best approach to achieve this? Did Crytek do any work on this?

For the taxi I guess you'll have to ack a bit with SetPos()(I'll post a better solution if anything comes to mind) while for flying you can take a look a the Glider script, it flies so I guess is the closest thing to what you want to archieve.

Quote:
2. I would favour modding the 4wd vehicle, as it can already taxi. One idea was to modify its gravity setting. I found that gravityx works as well as gravityz - but I didn't find a way of changing the gravity dynamically (when the game is running).

I do not think you can change such thing in a physics based entity it without respawning it.

Quote:
Can gravity be modified in real time as a function of some other variables such as speed? For example, could Update() be used to do this (I understand it's called on every frame).

You can do it on players, ladder.lua works this way.(disable the gravity so the player can move up and down).

Quote:
3. Can the vehicle script read key presses in real time? This would give a means of controlling the vehicle, for example gear up and down.

Yes I think there is Input:GetXKeyPressedName(), but
I suggest to remap the current key events, take a look at the player config file(.cfg) it shows how to create an action map. YOu can switch action maps dinamically from script.

Quote:
4. Can scripts call Windows API functions? This would allow, for example, reading the joystick.

nop. But the engine had joystic support, if they didn't explicitly removed it you can probably map it to standard commands.(the question is I have no clue what's the name of the bindings fo the joystic).

ciao
Alberto
Many thanks for the info.

I suspect it would be easier to mod the jeep - it would probably be easier to make it fly than to make the glider taxi!

ladders.lua sounds interesting - I'll take a look straight away.

It will be ironic if Far Cry does support joysticks - I'm just about to release a utility that gives proportional joystick support!

Best regards,
Chris
Lots of great info in this thread, thanks Alberto:) Could you spare a couple more minutes to go over the use of OnTimer() for multiple timers in a script? I need some 'pauses' in my entity script similar to the Delay Trigger, but 2 or 3 in sequence.
Quote:Original post by Anonymous Poster
Lots of great info in this thread, thanks Alberto:) Could you spare a couple more minutes to go over the use of OnTimer() for multiple timers in a script? I need some 'pauses' in my entity script similar to the Delay Trigger, but 2 or 3 in sequence.


This is how things work, OnTimer only supports one timer at the time. However there is: Game:SetTimer()

this function generates an OnEvent(id,param) with ScriptEvent_Timer , you can set a 'infinite' number of this timers on the same entity.

Game:SetTimer(entity,msecs,table)

entity
is the entity that will receive the event
msecs
duration of the timer
table
a table that will be passed back as parameter of the event(can be obmitted)

the function returns a timerid that you can use to kill the timer before it expires. Game:KillTimer(timerid);

ciao
Alberto
-----------------------------The programming language Squirrelhttp://www.squirrel-lang.org
<official mode on>

I'm currently working on a farcry mod ... I put a post about it in the Help Wanted forum here -
http://www.gamedev.net/community/forums/topic.asp?topic_id=268330

FarCry Isn't a game that I've modded before, there's quite a lot of talent on the team at the moment though. If anyone wants to join feel free to e-mail me at tx101.sk33j@gmail.com

<official mode off>


Actually I am surprised that you seem to think that there isn't many mods for FarCry, there are not many mods for FarCry that have been completed but many are in development, which isn't bad when you consider that the game is actually quite new.
Thanks fagiano for the help with the timer stuff:)

I decided to register this time, hehe...

This topic is closed to new replies.

Advertisement