Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Lactose!

Member Since 16 Oct 2013
Offline Last Active Yesterday, 06:59 PM

#5243915 Beginner Projects ?

Posted by Lactose! on Yesterday, 05:16 PM

Pong, Tetris, Break-Out.




#5243883 Unity Animation Help

Posted by Lactose! on Yesterday, 02:11 PM


I'm getting this error now. I tried adding in the SerializeField command.

You're still creating a new Animation in Start (and overriding whatever you link via the inspector), like AthosVG said.




#5243700 Mouse pointer out of applicationresolution when running fullscreen

Posted by Lactose! on 30 July 2015 - 07:26 PM

The following thread has some discussion about essentially the same problem, and some pointers on how to solve it:

http://www.gamedev.net/topic/670408-resolution-scaling-and-world-screen-coords/




#5243284 Old-School 3D Wireframe Modelling Tool

Posted by Lactose! on 28 July 2015 - 04:56 PM


I assume his end goal is to draw those models like they were wireframed. instead of adding the overhead of generating a bunch of redundant vertices for his model in line mode, to instead just use built in api features for drawing models as wiremeshs.
if this is not his end goal, then disregard my comment.

Fair point :)

 

Also, check PM :P




#5243281 Old-School 3D Wireframe Modelling Tool

Posted by Lactose! on 28 July 2015 - 04:51 PM


why can't you simply set draw mode to wireframe?
(OpenGL: glPolygonMode, DX11: rastdescriptor.fillmode)

Create/model, not draw.




#5243094 Resolution scaling and World / Screen Coords

Posted by Lactose! on 27 July 2015 - 07:28 PM

Do logic in whatever size you feel like. Then draw it at whatever size you (or the user, depending on what you allow) feel like.

Scale input to your logic, instead of trying to scale your logic based on screen size.

 

If your logical window is 640 x 360, and the render resolution is at 1280 x 720, just treat input at coordinate 500 x 250 as if it were at 250x 125.

The exact process will depend a bit on what kind of stuff you're using -- some frameworks operate in normalized values from -1 to 1 across the entire screen, others might only give you access to the pixels and the window size. Regardless, you don't really care what size the window is, you care what size your world and logic is.




#5242996 SFML + Box2D Camera (Or just "Camera" Concept in general)

Posted by Lactose! on 27 July 2015 - 10:34 AM


Or does anyone know if there is a way to track specific variables and act like a breakpoint when their value changes?

 

If you're using Visual Studio, you can set a breakpoint, and then set a Data Breakpoint (Debug --> New Breakpoint --> New Data Breakpoint...).

Set your address and it should notify you when the memory is written to.

 

That said, it sounds like maybe your not actually using the same camera as you're constructing.I would guess that your camera instance goes out of scope, and you're using a different (not correctly initialized) camera instance later on, or something like that...




#5242626 Calculating points of rectangle after rotation (Trig) help!

Posted by Lactose! on 25 July 2015 - 11:21 AM


It seems like maybe it's rotating around (0,0) instead of the players pos

I don't have time to read through in more depth right now, but if that's the case...

 

When rotating around a point, you want to subtract the rotation point, do the sin/cos stuff, and then add the rotation point back in.

You might, as you say, also need to verify if your functions expect radians or degrees.




#5242415 Vector cast

Posted by Lactose! on 24 July 2015 - 09:11 AM


You mean sample code that compiles only if you have Microsoft language extensions enabled (i.e. no /Za).
Else you're gonna have to change that to a const reference, like Brother Bob already mentioned.

Good catch. Thanks for the correction :)




#5242404 Vector cast

Posted by Lactose! on 24 July 2015 - 08:31 AM

EDIT: See other responses in thread for more information.

 

Assuming C++...

Ensure that your Vector class has a constructor that fits. In your example, it seems like it would Vector::Vector(int x, int y, int z). Doing that should make it work.

 

Sample code that compiles (in Visual Studio, your mileage may vary -- see Mona2000's reply):

class Vector
{
public:
	Vector(int a, int b, int c) { x = a; y = b; z = c; }
private:
	int x, y, z;
};

void Add(Vector &data)
{
	//Stuff here
}

void test()
{
	Add(Vector(1, 2, 3));
}



#5241997 Custom environment macro

Posted by Lactose! on 22 July 2015 - 01:46 PM

You can create a new solution configuration, and add the define to the preprocessor for that configuration:

1. From the Solution Configurations drop-down (by default containing Release, Debug and Configuration Manager...), select Configuration Manager....

2. In the Active Solution Configuration drop-down, select <New...>.

3. Name your solution configuration something appropriate, e.g. MemLeak Debug or MemLeak Release.

4. Copy settings from an existing solution configuration if appropriate.

5. Close the Configuration Manager.

6. Go to Properties on your project (e.g. right click your project in the Solution Explorer and select Properties).

7. Ensure your new solution configuration is selected as the configuration to be edited.

8. Go to Configuration properties --> C/C++ --> Preprocessor.

9. Under Preprocessor Definitions, add the wanted preprocessor definition -- in your case KHATBOX.

10. Select OK, and you should be good to go.

 

#ifdef KHATBOX will now be true for your newly created solution configuration, and false for the other ones.




#5241133 New Game Programmer!

Posted by Lactose! on 17 July 2015 - 06:59 PM


I have a for loop.

Yes, but in that for loop, you have a piece of code that will essentially restart the current iteration of the for loop if the randomly chosen card has already been randomly chosen.

As you keep choosing unused cards, the chance of choosing an already chosen card will increase, which means constantly trying to select a new card, taking more and more time.

 

Other than the issue mentioned above, there's also an issue with how you randomly select a card. You currently choose a card between 1 and 52.

However, your arrays are only initialized to [51], so if card 52 is chosen (which will try to index into your arrays at [52]), you'll be comparing against uninitialized values, which might be what's causing your code to never finish.

Arrays are zero-indexed -- meaning that the first item in an array is at [0], not [1].

 

The fix for this issue is to simply remove the + 1 part of the random number generation.

Math.Rand() returns a number from 0 (0 is included) up to 1 (1 is not included).

Math.Floor(Math.Rand() * 52) -- this includeds the fix I mentioned -- yields a minimum of 0 and a maximum of 51. This is exactly what we want for indexing into our arrays.




#5240839 How do you write this down?

Posted by Lactose! on 16 July 2015 - 11:07 AM

My attempt at shortening it... Not really pretty, but should be equivalent. This is starting to feel like a coding horror post.

while (true)
{
	if !((v > 0) && (x < 0))
		if !((v <= 0) && x > 0))
			break;
		
	int n = (x < 0) ? 1 : -1;

	y += x;
	z += y + n;
	x += n;
	
	if ((x - n) < 0)
		if (doA())
			doB();
	else
		if (doB())
			doA();
}

If the second clause only happens if v is negative (instead of not negative AND zero, as is currently the case), it could be condensed further:

while ((x * v) < 0)
{
	int n = (x < 0) ? 1 : -1;

	y += x;
	z += y + n;
	x += n;
	
	if ((x - n) < 0)
		if (doA())
			doB();
	else
		if (doB())
			doA();
}



#5240833 How do you write this down?

Posted by Lactose! on 16 July 2015 - 10:54 AM

I may be wrong, but isn't this equivalent?
 

while(x)
{
	int n = (v > 0 ? 1 : -1);

	x += n;
	y += (x - n);
	z += (y - n);

	if(doA()) doB();
}
Very hard to be sure without understanding what this does.

 

Doesn't seem equivalent to me. Firstly, x is never stated to have to reach 0. E.g. if v is positive and x is positive, nothing should happen (in the original code).

Additionally, the x, y and z things also seem wrong. I got this for the stuff inside the while loops:

int n = (x < 0) ? 1 : -1;
 
y += x;
z += y + n;
x += n;

I rejigged the order the variables are adjusted, so if the order is important in the actual code (it isn't in the posted snippet), then this wouldn't work.




#5240830 How do you write this down?

Posted by Lactose! on 16 July 2015 - 10:40 AM

 

[…] how do you solve the while clause?

if( v > 0 )

    while( x < 0 );

else

    whle( x > 0 );

while( abs(x + v) > 0) {
    // blah
}

What on earth are you doing?

 

That seems wrong to me.

v might be positive/negative 10000, while x might be positive/negative 5 -- the actual value of v doesn't matter, just whether it's positive or not.

In the posted code, v is never adjusted, while x is. In my example, the while loop should execute 5 times (given valid signs for x and v), which your abs version would not.






PARTNERS