Jump to content

  • Log In with Google      Sign In   
  • Create Account

Josh Petrie

Member Since 11 Jun 2003
Offline Last Active Private

Posts I've Made

In Topic: Should the player be just another entity in the etities list?

17 December 2014 - 10:56 AM

Both.

 

A significant portion of the player's interactions with the game world can be modeled exactly the same as other entities' interactions, so it makes sense to have the player be just another entity. However, the player will also usually require additionally bookkeeping data that doesn't apply to other entities, so it makes sense to have a dedicated structure for that.

 

I usually model this by having a "player controller" or some similar object which has a reference to the game entity representing the player. This allows the best of both worlds, and if done cleanly can also allow you to temporarily take control of other entities in the world for diagnostic purposes.

 

Of course, for games where the player has no avatar in the world itself (Tetris and other puzzle games, for example), this doesn't really apply.


In Topic: Anyone using the Open Source "Brackets" Code Editor (By Adobe)?

16 December 2014 - 05:41 PM

And don't MS still use C++ for VS, Office?

 

 

Parts, yes.


In Topic: declare custom types of ints?

16 December 2014 - 05:39 PM

 

"EnumA a = static_cast<EnumA>(someValueOfTypeEnumB);" is quite legal in C++. Did you mean something else when you said "cast?"


I meant that it's not performing an implicit cast. Using static_cast to cast between different enum types defeats the purpose of enums somehow. biggrin.png

 

 

Almost certainly, but the term you want in that case is "implicit conversion," as "cast" and "conversion" are different (a cast is defined as an explicit type conversion).

 

 

Please don't. That enables operator| for _all_ enums. It was deleted from enum class types for a good reason.

 

 

This.


In Topic: declare custom types of ints?

16 December 2014 - 04:31 PM

Ok, I just tested something about the old enum. You can't cast one EnumA into EnumB. Didn't remember that as I haven't used that enum type for a while. However you can pass both EnumA andEnumB into a function expecting an int. That shouldn't be too much of a problem though, if one is consitent in the use of enums.

 

 

"EnumA a = static_cast<EnumA>(someValueOfTypeEnumB);" is quite legal in C++. Did you mean something else when you said "cast?"


In Topic: Tagging the OP

16 December 2014 - 02:40 PM

I beleive it would help people keep track of the person who asked the question.

 

 

Which is important... why, exactly?

 

I've never found a need to know this information once the thread got beyond the point where it was trivial to page up and remind myself the original posters name. What's important is the content and context of the discussion (which is always available when you post), not necessarily the name of the person who started it.


PARTNERS