Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 03 Jul 2012
Offline Last Active Aug 21 2015 12:23 AM

Posts I've Made

In Topic: Pointer Clarification

20 August 2015 - 12:04 AM

Say you went to a party, you are with a heavy coat, you pass by the cloakroom and leave your cloak, the guy working there gives you a paper that says "Wardrobe 16". You enjoy the party and before you leave you go back to the cloakroom and deliver the paper, the guy gives your coat back


I like this metaphor!

In Topic: Pointer Clarification

19 August 2015 - 12:56 AM

As you already know, pointers are just addresses of stuff in memory (plus some type information). It's okay that you don't understand what they are good for, it was the same for me when I started. But you will stumble upon a use case sooner or later and then it will probably be like "whoa, it's not that complicated actually".


There are several cases, where pointers (or in modern idiomatic C++ increasingly often smart pointers, but that's a somewhat more complicated concept) play an important role:


  • You use dynamically allocated memory, say with new or malloc. These things return the address of the memory they allocated, which you have to store somehow in order to use the memory. That "somehow" would be a pointer of some kind. Again, in C++ you usually use a container class instead of that.
  • You want to pass around a piece of memory to be used in other parts of your program. Either you want this other part to directly manipulate a piece of data you have in the local part or the data is just to big to pass it as a function argument by value. In both cases you would pass a pointer (or a reference, which is a related concept).

There are more use cases, but these may be the most common ones. For your Goblin class, there is nothing I would see where you could use a pointer to your advantage. But using a pointer usually results from the interaction of different code parts (and you show only a declaration of a class, no actual code).

In Topic: Disk Area Light

28 June 2015 - 11:42 PM

I'm not sure about the last minus lightPos. If I'm not mistaken, pos - dot(dir, _LightNormal) * _LightNormal should already be the point on the plane. Minus lightPos makes it a vector pointing from the center of the light to the point on the plane closest to pos (which is actually what you need in the end, but the name planeIntersect is a bit misleading here).

In Topic: Disk Area Light

28 June 2015 - 11:15 PM

Here's what I would do: First project your point onto the plane of the disk. Then check if the distance from the projected point to the center of the disk is less than the disk's radius. If if is, voila, closest point. If it is not, scale this distance to the radius of the disk, which will give you the point on it's perimeter that is closest to your original point.


Actually, I think this should be pretty close to what you have do with your rectangle light.

In Topic: I would like some help

23 June 2015 - 02:45 AM

As Ashaman73 already said, in the beginning any language that does not cause too much frustration will do. If you want something that can give you quick results (which is really good for staying motivated), you might want to check out Löve2D (http://love2d.org), which is a cross-platform framework which you program in Lua. Lua is relatively easy to learn, as is Löve.


Python is a nice beginner language too, but I have not found any easy to use game framework for it yet. Others might have had better experiences with it though.