Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

CD Projekt's Cyberpunk 2077 Update 2.0 + Phantom Liberty Expansion Thread

agris

Arcane
Patron
Joined
Apr 16, 2004
Messages
6,925
Twiglard can you break it down to the level appropriate for someone who can pseudo interpret the code as I did, but only understands bitmasking in the context of masking (filtering) a binary data stream, such as over a RS232 connection, to extract usable information?
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,508
Location
Poland
Strap Yourselves In Codex Year of the Donut
Twiglard can you break it down to the level appropriate for someone who can pseudo interpret the code as I did, but only understands bitmasking in the context of masking (filtering) a binary data stream, such as over a RS232 connection, to extract usable information?

It's a set of boolean values in the form of an integer.
 
Joined
Jan 14, 2018
Messages
50,754
Codex Year of the Donut
According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"

7jPAwLM.png

I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?
they're essentially just constant values, at most they'll take up a small amount of space in the .rodata section(or whatever the pe32 equivalent is)
 

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,334
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.
According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"


I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?

Yes, but this is normal. "enum" by itself does not guarantee any specific size and explicitly specifying Uint32 you make sure that it uses a 32bit number regardless of what the compiler would pick by itself (by default "enum" would be like "int" which in some platforms is 32bit while in others is 64bit). As these flags are parts of structures serialized to disk you need to have them use a constant size regardless of compiler, platform, etc.

Now in this very specific case it'd "waste" 3 bytes indeed, but aside from that being an irrelevant number, if someone declared it as "enum CenshorshipFlags : Uint8", it'd still waste 3 (or actually, most likely 7) bytes regardless: the reason is these flags are used in "struct" and "class" declarations which have members that are going to be aligned in memory anyway by inserting "padding" (ie unused) bytes between smaller members.

Regardless these numbers are tiny and it is pointless to even try and think about them - a single texture is most likely going to use more memory than all these tiny pieces of unused memory all over the engine combined.
 

agris

Arcane
Patron
Joined
Apr 16, 2004
Messages
6,925
Twiglard and rusty_shackleford while I understand Twig’s response more than rusty’s, in either case I fail to see how reserving a uint32 memory chunk makes any sense for, at implementation, 8 different binary flags.

Are the binary equivalent values of the variable names stored in the enumerated sequence as well? Ie “Censor_nudity”? If so, 32 bit makes more sense.
 
Joined
Jan 14, 2018
Messages
50,754
Codex Year of the Donut
Twiglard and rusty_shackleford while I understand Twig’s response more than rusty’s, in either case I fail to see how reserving a uint32 memory chunk makes any sense for, at implementation, 8 different binary flags.

Are the binary equivalent values of the variable names stored in the enumerated sequence as well? Ie “Censor_nudity”? If so, 32 bit makes more sense.
it could have been done with a byte-sized value but the sizes are so small that it really doesn't matter, and they likely didn't know how many values they'd actually have so they gave themselves some room to add more
in reality, the values will probably never exist because they've been merged with something else via constant propagation and merging
 

agris

Arcane
Patron
Joined
Apr 16, 2004
Messages
6,925
According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"


I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?

Yes, but this is normal. "enum" by itself does not guarantee any specific size and explicitly specifying Uint32 you make sure that it uses a 32bit number regardless of what the compiler would pick by itself (by default "enum" would be like "int" which in some platforms is 32bit while in others is 64bit). As these flags are parts of structures serialized to disk you need to have them use a constant size regardless of compiler, platform, etc.

Now in this very specific case it'd "waste" 3 bytes indeed, but aside from that being an irrelevant number, if someone declared it as "enum CenshorshipFlags : Uint8", it'd still waste 3 (or actually, most likely 7) bytes regardless: the reason is these flags are used in "struct" and "class" declarations which have members that are going to be aligned in memory anyway by inserting "padding" (ie unused) bytes between smaller members.

Regardless these numbers are tiny and it pointless to even try and think about them - a single texture is most likely going to use more memory than all these tiny pieces of unused memory all over the engine combined.
Thanks, your response clearly demonstrates I’m asking questions for which answers are over my head. One point tho regarding your comment:

“Regardless these numbers are tiny and it pointless to even try and think about them - a single texture is most likely going to use more memory than all these tiny pieces of unused memory all over the engine combined.”

Isn’t this the sloppy thinking that gives us computationally inefficiency code such as Unity which merely takes computing power increases and translates them to a lower and lower programming standard such that mouth breathers such as myself can code, without concern for how code is compiled to assembly and executed on bare metal?

for example, in searching uint32 for C++ enumeration, I stumbled upon a description of cache efficiency and branch predictor accuracy during run time as a function of “wasted” bits for enumeration. If you call a list a lot in a piece of code and it’s written poorly such that there’s a lot of wasted computation in simply parsing the enum, its size (32 bit) isn’t really relevant vs the size of a texture. Its construction IS relevant tho in how it impacts the execution of code at an instructions per cycle (IPC) level, ie on bare metal.
 
Last edited:

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,334
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.
Thanks, your response clearly demonstrates I’m asking questions for which answers are over my head. One point tho regarding your comment:

“Regardless these numbers are tiny and it pointless to even try and think about them - a single texture is most likely going to use more memory than all these tiny pieces of unused memory all over the engine combined.”

Isn’t this the sloppy thinking that gives us computationally inefficiency code such as Unity which merely takes computing power increases and translates them to a lower and lower programming standard such that mouth breathers such as myself can code, without concern for how code is compiled to assembly and executed on bare metal?

Not really, i mentioned it is pointless because they wont make much of a difference in terms of unused memory. These are all over the place in the OS, memory allocator, etc and they are often needed to make things faster (aside from other uses like ensuring the values stay disk compatible): the CPU does not access memory byte-by-byte but actually in chunks of memory and alignment allows it to avoid having data that "span chunks" (ie. some piece of data would otherwise fit in one chunk is placed in memory so that it crosses two chunks, causing the CPU to read more memory than necessary just to access it).

for example, in searching uint32 for C++ enumeration, I stumbled upon a description of cache efficiency and branch predictor accuracy during run time as a function of “wasted” bits for enumeration. If you call a list a lot in a piece or code and it’s assembled poorly such that there’s a lot of wasted computation in simply parsing the enum, it’s size (32 bit) isn’t really relevant vs the size of a texture. It’s relevant in how it impacts the execution of code at an instructions per cycle (IPC) level, ie on bare metal.

Yes but that is something that is orthogonal, the aligned memory enables faster speed so unaligned memory accesses aren't going to be a bottleneck but that doesn't mean they are going to be your bottleneck in a specific case.

(also FWIW aligned memory is enforced by the C++ standard anyway so it isn't like you can avoid it - you can configure compilers to use minimum alignment, but this will slow down your program, especially in non-x86 CPUs which are incredibly bad at accessing unaligned memory... actually some CPUs may even cause the program to crash :-P)

EDIT: also this is really moot for the vast majority of software anyway, a scripting language (like used in most games and a lot of software) is going to shit all over your memory accesses and I/O (like in most game streaming) is going to shit all over your scripting languages performance. In terms of performance that stuff is only relevant in "hot loops", ie. code that is executed very frequently in a loop (e.g. physics calculations) which are only a very tiny part of an game's codebase. Usually performance issues come from algorithmic and architectural issues, not microoptimizations like that.
 
Last edited:

agris

Arcane
Patron
Joined
Apr 16, 2004
Messages
6,925
I don’t understand all aspects of the answer, but I appreciate you engaging on it. This is what happens when a hardware dilettante knows a smidge about programming - total chaos!
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,508
Location
Poland
Strap Yourselves In Codex Year of the Donut
Isn’t this the sloppy thinking that gives us computationally inefficiency code such as Unity which merely takes computing power increases and translates them to a lower and lower programming standard such that mouth breathers such as myself can code, without concern for how code is compiled to assembly and executed on bare metal?

No.

Read some SICP/PAIP/AMOP instead.

for example, in searching uint32 for C++ enumeration, I stumbled upon a description of cache efficiency and branch predictor accuracy during run time as a function of “wasted” bits for enumeration. If you call a list a lot in a piece of code and it’s written poorly such that there’s a lot of wasted computation in simply parsing the enum, its size (32 bit) isn’t really relevant vs the size of a texture. Its construction IS relevant tho in how it impacts the execution of code at an instructions per cycle (IPC) level, ie on bare metal.

You have to stick it in a GPR anyway so it doesn't matter.

Cycles per insn don't matter as cache miss is at least 100 cycles.

Insn per cycle of

kill_all |= jews;
kill_all &= ~feminists;

is nothing.

When branch prediction is a problem, you remove branching.

As you can see, premature optimization is the root of all evil. After 10 years of experience you can try to stop believing that.
 
Last edited:

agris

Arcane
Patron
Joined
Apr 16, 2004
Messages
6,925
Twiglard I selfishly wish you were more verbose so I could learn from you - as is, your answers are cryptic verging on the indecipherable.

although I do take your point about optimization; as does specter, meltdown and the other associated microcode vulnerabilities!
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,508
Location
Poland
Strap Yourselves In Codex Year of the Donut
Twiglard I selfishly wish you were more verbose so I could learn from you - as is, your answers are cryptic verging on the indecipherable.

although I do take your point about optimization; as does specter, meltdown and the other associated microcode vulnerabilities!

Learning programming is incremental. Find something useful you can write right now that doesn't exist. Write it and use it, then repeat. I started by writing Irssi scripts in Perl. A person was using script kiddie tool to flood using multiple connections. So I wrote a script that closes query windows when multiple people send idempotent messages.

Then I wrote my own kiddie tools that were even better. There was a whole lot of theory behind writing tools for taking over IRCnet channels. I kid you not, it's like metagaming. We were debating on Usenet (and not even alt.*, mind you) whether it's better to kick 6 people immediately or 7 with an intermediate 1-second delay.

Once wrote a 'cancelbot', i.e. a tool that removes Usenet articles from the server. Nobody used Google Groups back then.

Wrote the first app with a UI only after some 7 or more years after starting out.

So you can be a pretty retarded internet pest and still succeed at learning programming. Then graduate to some 30k SLOC open-source projects, and so on.
 
Last edited:

Tavar

Cipher
Patron
Joined
Jun 6, 2020
Messages
1,145
Location
Germany
RPG Wokedex Strap Yourselves In
Wait, the game source code was leaked.
Is it "open"? Can people actually use it?


So the game is essentially broken at an engine level?
Does that mean there's no way to fix it, except by fixing the engine first?
You cannot use a leaked source code for anything useful without opening yourself up to a lawsuite and/or cease and desist letters. Hence, it doesn't make a difference for modders or other developers. You can, however, look at the leak source code and educate yourself on how it works. Given that it is probably multiple million lines of code, it will be hard to find the actually interesting parts. Progams of this size can turn into an incredible mess if you're sloppy and I think we savely assume that CDPR was sloppy during their development.
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,508
Location
Poland
Strap Yourselves In Codex Year of the Donut
You cannot use a leaked source code for anything useful without opening yourself up to a lawsuite and/or cease and desist letters.

So what? OpenXray is a thing and Falcon BMS actually achieved legal status.
 
Joined
Jan 7, 2012
Messages
15,207
According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"


I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?

A 32 bit integer does not have 2^32 "values" in memory. A 32 bit integer has 32 bits. 32 bits can represent a number up to 2^32. In this case they are using 8 of those 32 bits as flags instead of as a number. This way you can have 00000000 for no flags, 00000001 for just nudity censored, 00000011 for nudity + sexually explicit, 01010101 for nudity + suggestive + gore + religion censored, and so on. Yes they are only actually using 8 of those 32 bits, but this ensures they have room for expansion and is incredibly minor to begin with. A single megabyte of memory has 8 million bits, "wasting" 24 of them is irrelevant unless this is some kind of insanely important performance-critical code that needs to fit into a tight CPU cache or something because it's executed thousands or millions of times per frame, which this isn't.
 

toro

Arcane
Vatnik
Joined
Apr 14, 2009
Messages
14,760
According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"


I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?

A 32 bit integer does not have 2^32 "values" in memory. A 32 bit integer has 32 bits. 32 bits can represent a number up to 2^32. In this case they are using 8 of those 32 bits as flags instead of as a number. This way you can have 00000000 for no flags, 00000001 for just nudity censored, 00000011 for nudity + sexually explicit, 01010101 for nudity + suggestive + gore + religion censored, and so on. Yes they are only actually using 8 of those 32 bits, but this ensures they have room for expansion and is incredibly minor to begin with. A single megabyte of memory has 8 million bits, "wasting" 24 of them is irrelevant unless this is some kind of insanely important performance-critical code that needs to fit into a tight CPU cache or something because it's executed thousands or millions of times per frame, which this isn't.

Delete this post.
 

typical user

Arbiter
Joined
Nov 30, 2015
Messages
957
Wait, the game source code was leaked.
Is it "open"? Can people actually use it?





So the game is essentially broken at an engine level?
Does that mean there's no way to fix it, except by fixing the engine first?


As far as I know the engine and tools to make CP2077 are fine. The game is broken on the design level, like perks, features, quests.

Can people fix it? Sure, but without documentation and large team not really.
 

Ravielsk

Magister
Joined
Feb 20, 2021
Messages
1,734
Too lazy to read through the whole forum but has anyone linked here the leaked footage from the 2013 build?
 

Ravielsk

Magister
Joined
Feb 20, 2021
Messages
1,734

Nothing "activist" about it. This is how investors usually behave. When they invest their money into stuff they expect a return on that investment and when you straight up lie to them about what that potential return might be and (maybe even) cause them a loss on top of that its absolutely normal for them to demand that heads should roll. Its only unusual or "activist" in the sense that it does not happen often in the video game industry.
 

Mebrilia the Viera Queen

Guest
Careful people now if you say the marketing was deiciving in cdpr forum they band you for desrespect. Cdpr truly went low.
 

Mebrilia the Viera Queen

Guest
This is how it works. If you have criticism that involved the game is amazing but... Then you get a pass.

If instead you dare to say their marketing was basically nothing that trow around features that never existed to start with in order to deiceve the costumers then off you are unrespectful.

Moderation in CDPR has the bad habit to act like a bounch of fascist.

Is the only moderation i recall that they banned whole discussions and words.

They started with banning "Third person"

Now they ban "Lies and Deiceving"

Wow.. They truly hit the bottom.

Pretty sure the same that banned me is still Sardoukar.

That moderator in past was caught for his biased attitude promoting in the forum how CDPR were the saviour of the game industry. In fact his activity in the forum after one of the oldest member called him out to be biased is disappeared now we have this new moderator that acts just like him.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom