Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!

Dave Hunt

Member Since 30 Dec 2002
Offline Last Active Yesterday, 05:38 PM

#5237017 Can't convert array of strings to char array

Posted by Dave Hunt on 26 June 2015 - 07:38 PM

If you already have the items in a std::string array, why do you need to put them in a char array at all?

#5235686 Monogame convert pixel coordinate to 3D units

Posted by Dave Hunt on 19 June 2015 - 08:31 AM

I think what you're looking for is Viewport.Unproject. The method takes a vector and the projection/view/world matrices and returns the unprojected 3D vector.


edit - BTW, your subject says 3D unit to pixel, but your question says pixel to 3D unit...

#5233973 It is better for performance to use a lot of rectangles or a lot of vectors?

Posted by Dave Hunt on 09 June 2015 - 07:21 PM

Yes but how do i get to know where its colliding? Ahh i'll look online fine i did it already and nothing...well i'll try again.

A quick google search for "libgdx collision detection" returned tons of interesting links.


Also, the java docs for libgdx show that Intersector.intersectRectangles returns the intersection of the two rectangles. That intersection rectangle will tell you where the intersection occurred.

#5233349 what is the best way to design ai for games like x-o or chess

Posted by Dave Hunt on 07 June 2015 - 09:06 AM

Is the name of "x-o" a different name for Tic-Tac-Toe?




Is "x-o" a different name for Tic-Tac-Toe?

yes my friend.


#5231579 what is the best way to design ai for games like x-o or chess

Posted by Dave Hunt on 28 May 2015 - 06:36 PM

i want to know what can be best choice to implement ai for these kinds of games.

The best choice is whatever makes your game work the way you want it to. There is no "best" way to do AI.


Check out the links provided in the previous posts and make use of Google to add to your research. Gather the ideas together and see what best fits the needs of your game.

#5231405 Why does this code work? (Drawing in screen space)

Posted by Dave Hunt on 27 May 2015 - 11:22 PM

Also I read that I have to account for the pixel center/cell center and subtract 0.5f from everything, but my textured quad is displayed correctly as it is? Why?

This was changed in DX10. Texels are now pixel centered, so you don't have to make the adjustment manually.

#5231320 Create many factory methods

Posted by Dave Hunt on 27 May 2015 - 01:16 PM

Upcasting from a base class to a derived class is a warning sign of a potentially bad design. Normally, the interface methods would make calls to any additional methods to provide extra functionality, but would not require the user of the API to call those methods directly.


If you are set on using the this particular library, then you're pretty much stuck creating factory methods for whatever derived classes you plan to use.


I'm sorry if you didn't find my first answer helpful. I though you were interfacing with your own C++ code, as you stated in your first post. In that case, my answer was intended to give you an opportunity to rethink the design of the C++ API and possibly eliminate the need for upcasting.

#5231175 Create many factory methods

Posted by Dave Hunt on 26 May 2015 - 08:53 PM

You should be coding to an interface, not an implementation. Your java code shouldn't care whether it's a "A", "B", or a "Z", only that it is a Letter.

#5226618 Game testing - debug vs release configuration

Posted by Dave Hunt on 30 April 2015 - 07:10 PM

You really should retest everything. Often, bugs show up in release builds that didn't show up in debug builds.

#5226146 Why Does Everyone Tell Newbies To Make Games?

Posted by Dave Hunt on 28 April 2015 - 02:16 PM

The last time I checked, this was gamedev.net. What else would we recommend a newbie to create? ;-)


As for someone totally new to development, many early programming assignments are text-based games like word guess, hang-man, etc. They're great tools for introducing new concepts.

#5226075 Why would a mesh appear to be stretched out?

Posted by Dave Hunt on 28 April 2015 - 09:05 AM

In simple terms, X, Y, Z represent the rotational axis and W represents the amount of rotation around that axis.


As you found, you can't just assign an arbitrary value to W.

#5225852 Basic C program what am I doing wrong?

Posted by Dave Hunt on 27 April 2015 - 08:38 AM

v = p*1+r doesn't give you what you think it does. If you want to multiply p by 1 + r, then you need some parentheses: v = p * (1 + r)


BTW, I hope this isn't a homework assignment...

#5223963 XNA Ghost Attack Behaviour

Posted by Dave Hunt on 17 April 2015 - 07:57 AM

Also, you shouldn't use floating point variables for storing time values, since most of the system functions return time values as an unsigned integer. If you convert the system's time values to float, aside from that extra conversion, you're also just throwing away bits of precision, and forcing floating point operations where integer operations would be sufficient (and faster).

XNA's GameTime class uses TimeSpan structures, which return seconds as doubles.


And if that's not it, then it's most definitely because your "float time" variable is not static or global, so it gets set to 0 every frame (or every time you call the Attack() function), and then to the elapsed frame time, instead of accumulating the time since the collision was detected.


#5215732 What IDEs are recommended for Lua and/or Python?

Posted by Dave Hunt on 10 March 2015 - 05:59 PM

I use PyCharm Community Edition for python.

#5214262 Directx11 Sprite class

Posted by Dave Hunt on 03 March 2015 - 12:24 PM

Unless you're set on implementing your own sprite API, I would recommend the SpriteBatch class in the DirectX Tool Kit.