Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.

Muzzy A

Member Since 25 May 2007
Offline Last Active Nov 17 2014 02:35 AM

#5144409 DirectX 11 Drawing multiple instances of the same object

Posted by Muzzy A on 04 April 2014 - 12:39 PM

Well this Tutorial explains everything I need. Thanks for the post.

#5143109 A question about where to store the Camera!

Posted by Muzzy A on 29 March 2014 - 01:09 PM

Hi, I'm building my own little renderer and there's a couple things that I get undecided about.


Where exactly do most of you store things like the Camera and Projection matrix?

I've seen and tried several different ways of doing so, but I'm not satisfied by any of them.

  • Save it in the renderer, pass them as parameters to the render functions - Probably the best way, but I don't want Parameters!
  • Make a singleton for the camera ( HORRIBLE! ) to access it anytime.
  • Make a static variable in the render objects that holds a reference to the camera and projection matrix.


I'm just a little curious at how others would do this minor little thing.

#5123221 SIMD Function - Illegal instruction?

Posted by Muzzy A on 12 January 2014 - 11:59 PM

It doesn't support AVX. Thanks for making me double check.

#5097523 WT* ?

Posted by Muzzy A on 28 September 2013 - 06:37 PM

LOL this topic brightened my day.

#5097500 Circle vs Line Segment collision

Posted by Muzzy A on 28 September 2013 - 04:02 PM

struct Segment
    Vector3 start;
    Vector3 end;
struct Sphere
    Vector3 center;
    float fRadius;

This code will find the closest point to the sphere that is on the line segment.

Vector3 point = sphere.center;
// Get the direction of the line segment from start to end
Vector3 line = segment.end - segment.start;
float length = Math::Length(line); // The length of the line
line /= length; // Normalize
// The Vector from the center of the sphere to the start of the line seg
Vector3 toStart = segment.start - point;
// How far up the line the closest point is
float dist = Math::DotProduct(toStart,line);
// ensure that the closest point is on the line segment
if( dist < 0 )
dist = 0;
else if(dist > length)
dist = length;
// Calculate the closest point
ClosestPoint = segment.start + line * dist;

Now you have the closest point, just do a simple radius check

Vector3 toPoint = sphere.center - ClosestPoint;
// For optimization you can use the square distances
float dist = dot_product( toPoint,toPoint ); // Equivelant to LengthSqu()
if( dist <= sphere.fRadius*sphere.fRadius )
    // There is a collision

#5095040 Question about programming in team, and svn...

Posted by Muzzy A on 18 September 2013 - 04:10 PM

There is usually an Interface which tells you what lines of code were changed in a file.  You have to see where they made their changes and merge it with yours into one copy, and usually you can see what that final copy looks like as well.  It's not hard, you just have to be careful when doing it because you can easily leave out someone else's code by accident and they'll have to either redo it, or revert back.

#5094833 Calculus Vs Algebra based Physics

Posted by Muzzy A on 17 September 2013 - 10:02 PM

you don't really need to go to those classes, If you want to do a game just start learning DirectX or OpenGL and as you learn it by osmosis you just start making more and more complex things, and as you go you will find everything you need on the internet. Going to university(in programming) is more about meeting other people.

this actually depends on the person, some people learn much better when being taught the subject in person rather than reading it online.



Anyways assuming this is a standard physics class and not for game programming, yes I agree with Hodgens. Formulas used in programming are all usually derived from calculus, but look like simple Linear Algebra and are usually common and can be found online.  Linear Algebra is the only real thing you need to know. I would say Linear Algebra is a requirement for Game Programming, but that's just me.

#5084492 Box vs Plane Collision Detection

Posted by Muzzy A on 09 August 2013 - 03:28 PM

if it's an Axis Aligned box, things are easy, you can actually treat the center as a radius

struct Sphere { float m_Radius; Vector3 m_Center; };
struct AABB { Vector3 min,max; };
struct Plane { Vector3 normal; float offset; };
int SphereToPlaneCollision(const Plane& plane, const Sphere& sphere)
    float dot = dot_product(plane.normal,sphere.m_Center) - plane.offset;
    if(dot > sphere.m_Radius)
        return 1; // The sphere is in front of the plane
    else if(dot < -sphere.m_Radius)
        return 2; // The sphere is behind the plane
    return 3; // The sphere collides/straddles with the plane
int AabbToPlaneCollision(const Plane& plane, const AABB& aabb)
    // Get the Extense vector
    Vector3 E = (aabb.max - aabb.min)/2.0f;
    // Get the center of the Box
    Vector3 center = aabb.min + E;
    Vector3 N = plane.normal;
    // Dot Product between the plane normal and the center of the Axis Aligned Box
    // using absolute values
    float fRadius = abs(N.x*E.x) + abs(N.y*E.y) + abs(N.z*E.z);
    Sphere sphere;
    sphere.m_Center = center;
    sphere.m_Radius = fRadius;
    return SphereToPlaneCollision( plane,sphere );

#5082678 std::vector<> vs cli::array<>

Posted by Muzzy A on 03 August 2013 - 12:02 AM

The fact that it's managed makes me want to remove it from my computer =P


Thanks for the explanation. I probably wont be using any cli::arrays in the near future lol. I enjoy managing my own memory, I have an attachment to it.

#5079081 Orbit (ellipse) collision detection between many many objects

Posted by Muzzy A on 19 July 2013 - 09:48 PM

There's this thing called the KD Tree I think? It can get quite complex, but basically puts every object in to a list of AABB's and objects only check collision in the surrounding AABB's.


You can define the size of your AABB's yourself obviously. And there's no limit to how big you can make this tree, there's alot of overhead for it, but it's extremely useful when you have a large amount of objects like that.

#5078377 Jumping - What did I do wrong?

Posted by Muzzy A on 16 July 2013 - 11:28 PM

@Muzzy A
  The code has been remade and re-posted  smile.png (see comment right before yours)

You still have this

if(m_pos.y != 0);
// Should be
if(m_pos.y <= 0);

Though you're only adding or subtracting '0.5', in an actual game/project time is a factor and '0.00001 != 0.0', just a heads up. It will only work in your case.



I had to stop myself from writing a tutorial :P

#5078375 D3DXVECTOR3 with doubles

Posted by Muzzy A on 16 July 2013 - 11:22 PM

I imagine negative positions wouldn't be hard to add in there, try that out and see what happens. If it doesn't work you can easily create your own Vector3 with doubles. If that doesn't work, then it's in your math.


100,000 shouldn't be to high for you to get those jerky results IMO. Do some optimizations so that you're doing as little math as possible on those large numbers is my suggestion. But I could be wrong. Good Luck :)

#5078311 D3DXVECTOR3 with doubles

Posted by Muzzy A on 16 July 2013 - 05:28 PM

I don't know why you would be having movement so far away from the origin, 100,000 is a pretty good distance. I made a scale model of the solar system that didn't even go out to 100,000 units lol.



The game I'm working on atm has a HUGE world, bigger than World of Warcraft I think. And it's entire world is about 10,000 units wide and we have yet to cover half of it.

#5074710 Can't find memory leak

Posted by Muzzy A on 02 July 2013 - 06:29 AM

// Include these in main.cpp
#include <stdlib.h>
#include <crtdbg.h>
// Put this at the top of your winmain function
_CrtSetBreakAlloc( -1 ); // Important line
// Run the code and get your memory leaks, it will give you a number in brackets for the memory leak in the output window
// Change the -1 value on the important line to the number you were given and run again
// It will break when you allocate memory to that same exact object that was leaked before, this is very helpful for finding leaks.



If that doesn't help you I'll take a look at your code. Good Luck :)

#5074405 Rendering model, getting seams between each mesh

Posted by Muzzy A on 01 July 2013 - 04:33 AM

It's .001 right now. Could it just simply be that I'm not doing any depth sorting? Now that I think about it that would actually make sense lol.





That was the problem, as soon as I set up depth sorting everything just turned out perfectly fine. Thanks for your time!