Skip to main content
added 62 characters in body
Source Link
Peter
  • 10k
  • 2
  • 35
  • 46

In the book, the subsection 5.4.3 you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept.

Yes, you can substitute any hash map.

"how would you then access the hash table in the rest of the game engine?"

From the book, below the example:

When using string ids, the strings themselves are only kept around for human consumption. When you ship your game, you almost certainly won’t need the strings—the game itself should only ever use the ids.

In the book, the topic of that section is unique string identifiers for internal use. You will want to access the map for debugging only, and how you do so is up to you.

The book also mentions looking at FName as a working implementation of a similar concept.*

Strings that are presented to the player need to be handled differently - here you have to look into localization first, because that's where most of the constraints come from.


PS: As a bit of unsolicited advice, this introduces a level of complexity that is unnecessary for a home-built first game engine. Just make a class that looks like FName, only declare the parts you currently need (constructor and comparison), but implement it with std::string and operator== as a first draft. When you later need the additional performance you can then change the implementation to one that uses integer comparisons.

In the book, the subsection 5.4.3 you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept.

Yes, you can substitute any hash map.

"how would you then access the hash table in the rest of the game engine?"

From the book, below the example:

When using string ids, the strings themselves are only kept around for human consumption. When you ship your game, you almost certainly won’t need the strings—the game itself should only ever use the ids.

In the book, the topic of that section is unique string identifiers for internal use. You will want to access the map for debugging only, and how you do so is up to you.

The book also mentions looking at FName as a working implementation of a similar concept.*

Strings that are presented to the player need to be handled differently - here you have to look into localization first, because that's where most of the constraints come from.


PS: As a bit of unsolicited advice, this introduces a level of complexity that is unnecessary for a home-built first game engine. Just make a class that looks like FName, but implement it with std::string and operator== as a first draft. When you later need the additional performance you can then change the implementation to one that uses integer comparisons.

In the book, the subsection 5.4.3 you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept.

Yes, you can substitute any hash map.

"how would you then access the hash table in the rest of the game engine?"

From the book, below the example:

When using string ids, the strings themselves are only kept around for human consumption. When you ship your game, you almost certainly won’t need the strings—the game itself should only ever use the ids.

In the book, the topic of that section is unique string identifiers for internal use. You will want to access the map for debugging only, and how you do so is up to you.

The book also mentions looking at FName as a working implementation of a similar concept.*

Strings that are presented to the player need to be handled differently - here you have to look into localization first, because that's where most of the constraints come from.


PS: As a bit of unsolicited advice, this introduces a level of complexity that is unnecessary for a home-built first game engine. Just make a class that looks like FName, only declare the parts you currently need (constructor and comparison), but implement it with std::string and operator== as a first draft. When you later need the additional performance you can then change the implementation to one that uses integer comparisons.

added 76 characters in body
Source Link
Peter
  • 10k
  • 2
  • 35
  • 46

TheIn the book, the subsection 5.4.3 you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept.

Yes, you can substitute any hash map.

"how would you then access the hash table in the rest of the game engine?"

From the book, below the example:

When using string ids, the strings themselves are only kept around for human consumption. When you ship your game, you almost certainly won’t need the strings—the game itself should only ever use the ids.

In the book, the topic of that section is unique string identifiers for internal use. You will want to access the map for debugging only, and how you do so is up to you.

The book also mentions looking at FName as a working implementation of a similar concept.*

Strings that are presented to the player need to be handled differently - here you have to look into localization first, because that's where most of the constraints come from.


PS: As a bit of unsolicited advice, this introduces a level of complexity that is unnecessary for a home-built first game engine. Just make a class that looks like FName, but implement it with std::string and operator== as a first draft. When you later need the additional performance you can then change the implementation to one that uses integer comparisons.

The subsection you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept.

Yes, you can substitute any hash map.

"how would you then access the hash table in the rest of the game engine?"

From the book, below the example:

When using string ids, the strings themselves are only kept around for human consumption. When you ship your game, you almost certainly won’t need the strings—the game itself should only ever use the ids.

In the book, the topic of that section is unique string identifiers for internal use. You will want to access the map for debugging only, and how you do so is up to you.

The book also mentions looking at FName as a working implementation of a similar concept.*

Strings that are presented to the player need to be handled differently - here you have to look into localization first, because that's where most of the constraints come from.


PS: As a bit of unsolicited advice, this introduces a level of complexity that is unnecessary for a home-built first game engine. Just make a class that looks like FName, but implement it with std::string and operator== as a first draft. When you later need the additional performance you can then change the implementation to one that uses integer comparisons.

In the book, the subsection 5.4.3 you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept.

Yes, you can substitute any hash map.

"how would you then access the hash table in the rest of the game engine?"

From the book, below the example:

When using string ids, the strings themselves are only kept around for human consumption. When you ship your game, you almost certainly won’t need the strings—the game itself should only ever use the ids.

In the book, the topic of that section is unique string identifiers for internal use. You will want to access the map for debugging only, and how you do so is up to you.

The book also mentions looking at FName as a working implementation of a similar concept.*

Strings that are presented to the player need to be handled differently - here you have to look into localization first, because that's where most of the constraints come from.


PS: As a bit of unsolicited advice, this introduces a level of complexity that is unnecessary for a home-built first game engine. Just make a class that looks like FName, but implement it with std::string and operator== as a first draft. When you later need the additional performance you can then change the implementation to one that uses integer comparisons.

added 376 characters in body
Source Link
Peter
  • 10k
  • 2
  • 35
  • 46

The subsection you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept.

Yes, you can substitute any hash map.

"how would you then access the hash table in the rest of the game engine?"

From the book, below the example:

When using string ids, the strings themselves are only kept around for human consumption. When you ship your game, you almost certainly won’t need the strings—the game itself should only ever use the ids.

In the book, the topic of that section is unique string identifiers for internal use. You will want to access the map for debugging only, and how you do so is up to you.

The book also mentions looking at FName as a working implementation of a similar concept.*

Strings that are presented to the player need to be handled differently - here you have to look into localization first, because that's where most of the constraints come from.


PS: As a bit of unsolicited advice, this introduces a level of complexity that is unnecessary for a home-built first game engine. Just make a class that looks like FName, but implement it with std::string and operator== as a first draft. When you later need the additional performance you can then change the implementation to one that uses integer comparisons.

The subsection you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept.

Yes, you can substitute any hash map.

"how would you then access the hash table in the rest of the game engine?"

From the book, below the example:

When using string ids, the strings themselves are only kept around for human consumption. When you ship your game, you almost certainly won’t need the strings—the game itself should only ever use the ids.

In the book, the topic of that section is unique string identifiers for internal use. You will want to access the map for debugging only, and how you do so is up to you.

The book also mentions looking at FName as a working implementation of a similar concept.

Strings that are presented to the player need to be handled differently - here you have to look into localization first, because that's where most of the constraints come from.

The subsection you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept.

Yes, you can substitute any hash map.

"how would you then access the hash table in the rest of the game engine?"

From the book, below the example:

When using string ids, the strings themselves are only kept around for human consumption. When you ship your game, you almost certainly won’t need the strings—the game itself should only ever use the ids.

In the book, the topic of that section is unique string identifiers for internal use. You will want to access the map for debugging only, and how you do so is up to you.

The book also mentions looking at FName as a working implementation of a similar concept.*

Strings that are presented to the player need to be handled differently - here you have to look into localization first, because that's where most of the constraints come from.


PS: As a bit of unsolicited advice, this introduces a level of complexity that is unnecessary for a home-built first game engine. Just make a class that looks like FName, but implement it with std::string and operator== as a first draft. When you later need the additional performance you can then change the implementation to one that uses integer comparisons.

Source Link
Peter
  • 10k
  • 2
  • 35
  • 46
Loading