"strlen" Addition - LANGUAGE Retrieval

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: "strlen" Addition - LANGUAGE Retrieval

Re: "strlen" Addition - LANGUAGE Retrieval

by GooberMan » Fri Oct 04, 2013 7:19 am

I suppose this could be alleviated if multiplayer sessions had a forced language set. Not a fantastic solution when a game is played with people of several different nationalities, but it would solve the problem.

Re: "strlen" Addition - LANGUAGE Retrieval

by Blzut3 » Fri Oct 04, 2013 6:18 am

PRINTNAME_LEVEL is determinate so you can use the length of that for whatever. Basically you just need to ask: Can I know this value without knowing the client's exact configuration? In terms of strparam, using k, l, and most of n can potentially put your script into an indeterminate state.

Re: "strlen" Addition - LANGUAGE Retrieval

by Xaser » Thu Oct 03, 2013 5:11 pm

That'd be fine for plain message queues, though I can imagine folks would want to use this proposed library for cutscenes that interact with the world as well, if it were made available.

(Though "folks" could easily mean "just Xaser", but still :P )

Re: "strlen" Addition - LANGUAGE Retrieval

by randi » Thu Oct 03, 2013 5:08 pm

As long as you're just using your delays with hud messages and to sync up hud messages, then you have nothing to worry about.

Re: "strlen" Addition - LANGUAGE Retrieval

by Xaser » Thu Oct 03, 2013 5:07 pm

Blzut3 wrote:The level name (and skill name) would not be sync safe either since those can be references to language strings. If they don't reference language strings then those are indeed determinate.
Oh, poo. Bad example -- pretend I said "strlen(strparam(n:PRINTNAME_LEVEL))" instead. :P

The point is I'm trying to investigate the feasibility of this working even if a sync-safe default-LANGUAGE lookup gets added. No sense in barking up that tree if it's already been cut down, basically. ;)

Re: "strlen" Addition - LANGUAGE Retrieval

by edward850 » Thu Oct 03, 2013 3:15 pm

It would be more technically broken if it did work that way. ;)

Re: "strlen" Addition - LANGUAGE Retrieval

by Blzut3 » Thu Oct 03, 2013 3:11 pm

All of the map names for vanilla's levels are references to LANGUAGE so I would think the feature would be kind of broken if it didn't work that way. It'd be a bit of a hassle for me to confirm atm.

Re: "strlen" Addition - LANGUAGE Retrieval

by edward850 » Thu Oct 03, 2013 2:48 pm

Blzut3 wrote:The level name (and skill name) would not be sync safe either since those can be references to language strings.
Can you check this (i.e does it actually work)? I really wouldn't like that to be a thing, but at-least it's simple enough to lookout for in debugging.

Re: "strlen" Addition - LANGUAGE Retrieval

by Blzut3 » Thu Oct 03, 2013 2:33 pm

Xaser wrote:This is probably pretty much the same thing the OP is doing, so I'm basically repeating things. To ask a different question to Graf, independent of the LANGUAGE scenario: Is it considered not sync-safe to do the same thing with a dynamic string that's guaranteed to be in-sync between players (e.g. level name as strlen(strparam(n:PRINTNAME_LEVELNAME)))? I'm not seeing the harm in this case unless there's something going on behind-the-scenes that I don't know about. Which is of course totally plausible.
The level name (and skill name) would not be sync safe either since those can be references to language strings. If they don't reference language strings then those are indeed determinate.

Note, as Graf said, that there's nothing wrong with using such lengths for delays as long as any code following does not affect the playsim. (Corrolary point to that, calling random can affect the playsim if used in indeterminate code.)

Re: "strlen" Addition - LANGUAGE Retrieval

by Graf Zahl » Thu Oct 03, 2013 2:29 pm

The only problems arise when you use the length in delays or use it for some gameplay related effect. If all you use it for is to calculate text output coordinates I don't see any sync issues.

Re: "strlen" Addition - LANGUAGE Retrieval

by Xaser » Thu Oct 03, 2013 1:55 pm

That still leaves a rather large hole in a potential dialogue system I'm planning on writing, myself. The plan is to be able to write a generic dialogue library that takes a string as input (preferably from LANGUAGE since that's where these things tend to live), displays a nicely formatted dialog box, and returns a delay value that could then immediately be used inside Delay() (if desired) as a means to abstract away a lot of the timing pain that usually comes with these sorts of things. I can't think of any way to do this with LANGUAGE strings (without murderating multiplayer sync, of course) without some sort of mapping on the ACS side between strings and numeric delays, which of course defeats the purpose. :P

[Granted, I might extend the system to support voice eventually, at which point the text length would be moot since the time to play the audio would be the metric at hand. And that certainly isn't measurable in-engine (unless someone's willing to add that, which of course seems less likely). An irrelevance to the suggestion, but a related one.]

This is probably pretty much the same thing the OP is doing, so I'm basically repeating things. To ask a different question to Graf, independent of the LANGUAGE scenario: Is it considered not sync-safe to do the same thing with a dynamic string that's guaranteed to be in-sync between players (e.g. level name as strlen(strparam(n:PRINTNAME_LEVELNAME)))? I'm not seeing the harm in this case unless there's something going on behind-the-scenes that I don't know about. Which is of course totally plausible.

Either way, it'd be super-great to not have to manually type in a number somewhere. I can imagine the user unfriendliness that would occur if someone else wanted to add lines of dialogue and extend my system. :(

Re: "strlen" Addition - LANGUAGE Retrieval

by Graf Zahl » Thu Oct 03, 2013 12:03 pm

It would cause sync issues if you use the value for gameplay timing. But what to do? The clear advice here is: Don't do that! You can do anything you like with the string length as long as it's only being used for positioning text or other HUD related things.

Re: "strlen" Addition - LANGUAGE Retrieval

by Xaser » Thu Oct 03, 2013 11:51 am

Hmm, strlen(strparam(l:"...")) indeed seems to work but wouldn't that still cause sync issues in multiplayer?

Although this is a separate feature suggestion at this point (such that I"ll probably open my own thread here soon), a new cast type for "string from default language" to be used alongside strparam would do it. Seems like less of a pain to implement as well, but I'm saying this blindly of course.

Re: "strlen" Addition - LANGUAGE Retrieval

by Graf Zahl » Thu Oct 03, 2013 12:50 am

I'd say the advice should be nhot to use string length and message duration for ANY playsim related event. But implementing measures to enforce it will probably cause more problems than it solves.

As for the suggestion, no. It'd require changes to the ACC compiler and wouldn't provide anything that can't already be done with some existing features.

Re: "strlen" Addition - LANGUAGE Retrieval

by Ral22 » Wed Oct 02, 2013 11:52 pm

Okay, well, I feel really embarrassed... I was able to achieve the effect I wanted by combining both strlen and strparam, thanks to Blzut3's mention of it. Basically, by doing "strlen(strparam(l:"MUKULINE3"))" I essentially get the "strlen(l:"MUKULINE3")" I suggested.

So, at this point, I am unsure of the fate of my suggestion, if it is even still necessary at all. However, if you all manage to find a use for this proposed feature or some branch of it, then by all means please carry on with this. I will continue to keep an eye on the activities here, though.

I thank everyone for their words and advice, the community here has been incredibly helpful to me.

Top