Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 07 Mar 2002
Online Last Active Today, 03:36 PM

#5191891 I want to do a game with this sprite sheet

Posted by Álvaro on 08 November 2014 - 09:38 PM

This thread reminds me of this TV commercial:


#5191590 Connect 4 building methods suggestions?

Posted by Álvaro on 06 November 2014 - 05:26 PM

I understand you are putting some real effort into this, but you just ignored my advice to make those variables into an array and get rid of repetitive code.

About detecting four in a row, can you describe how you would do it in English? Maybe we can help you translate that into code.

#5191445 Extracting From Final Transform Matrix

Posted by Álvaro on 05 November 2014 - 09:01 PM

Confirming what? I still don't think we have an understanding. The only confusing part of the question is the "in any order" part. Other than that, it's a perfectly reasonable question, and then I gave you a solution, which also works with non-uniform scalings.

If you insist on the "in any order" part, then it's obviously impossible, as evidenced by the following example:

Transform A := Translate (1,0,0) and then rotate 90 degrees around (0,0,1).
Transform B := Rotate 90 degrees around (0,0,1) and then translate (0,1,0).

Those two transforms are the same transform, actually, so you can't possibly reconstruct the steps from the combined result.

#5191385 Connect 4 building methods suggestions?

Posted by Álvaro on 05 November 2014 - 01:14 PM

static int row0 = 6, row1 = 6, row2 = 6, row3 = 6, row4 = 6, row5 = 6, row6 = 6;


I won't continue reading that code. Use a freaking array!!

#5191338 continous velocity aligned rotation problem

Posted by Álvaro on 05 November 2014 - 09:43 AM

I have the exact opposite advice to Norman Barrow's: The math is much easier if you store headings as unit vectors. It is true that switching back and forth between angle and vector representations is a bad idea, but you basically never need to use angles.


In your code, you use atan2 to convert a vector to an angle, and then you call `rot'. The only thing `rot' is going to do with the angle is compute its sine and cosine... which are the components of the vector you started with!!


Now, to your question: I am not sure what all those "points" represent, but I bet life will be easier if you keep an unrotated version of the points and then apply the absolute rotation each frame, instead of trying to apply incremental rotations.

#5191244 Extracting From Final Transform Matrix

Posted by Álvaro on 04 November 2014 - 07:29 PM

What HappyCoder said is correct. If you create a matrix that represents the composition of a scaling, a rotation and a translation --in that order--, you can recover all the information from the matrix.

The translation is actually neatly spelled out in the final matrix. Then you are left with a 3x3 matrix that encodes the rotation and the scaling. You can extract the rotation by normalizing the columns of that 3x3 matrix (or rows, depending on your conventions). Finally, the factors by which you had to divide the columns to make them unit-length are the scaling coefficients.

Oh, the 3x3 rotation matrix can be converted to Euler or quaternion if you want. Google is your friend.

#5190834 Handle as a struct vs standalone value

Posted by Álvaro on 02 November 2014 - 08:58 PM

I think the main advantage is type safety. If you accidentally assign an int value to a handle or perform some arithmetic operation on a handle, the struct version will not compile, but the typedef version will happily let you do something you probably didn't intend to do.

#5190779 Connect 4 building methods suggestions?

Posted by Álvaro on 02 November 2014 - 02:44 PM

The data needs to be held by your class, not inside a method.

Can you describe in English what data you think you will need to represent the board? I'll help you from there.

#5190770 Connect 4 building methods suggestions?

Posted by Álvaro on 02 November 2014 - 01:04 PM

Very repetitive code is a bad sign.

            int row0 = 6;
            int row1 = 6;
            int row2 = 6;//Might have to go into another class to be stored becasue it will keep reseting if its placed here and cant be initialized outside the static class
            int row3 = 6;//Unless you want 7 methods or if you know a more effecient way of doing it?
            int row4 = 6;
            int row5 = 6;
            int row6 = 6;

Have you heard of arrays?

You need to come up with a board representation. Make a class `Board' that provides methods to make a move, to generate a list of available moves, to determine if the game is over... If you have any repetitive code, you are doing it wrong.

#5190768 Correct analogy about ordinals and combinatronics?

Posted by Álvaro on 02 November 2014 - 12:53 PM

You have to be a lot more precise with language than that, JohnnyCode. I don't know what the dimension of a combination is, I don't know what it means for a combination to spawn permutations. A permutation is not a set, so the cardinal of a permutation is a rather meaningless concept. Etc. etc.

Your post is such a mess that I don't know what you are saying. Still, not a down-ratable offense. smile.png

#5190330 Where to start making my very first Flash game

Posted by Álvaro on 31 October 2014 - 05:21 AM

If you want to finish the game, a design document describing every feature of the game (what Shippou mentioned) is a very good idea.

However, if you are inexperienced, you probably should concentrate on small achievable goals first, perhaps writing a few technical demos that require implementing some aspect of the game only.

I would personally start with some core aspect of the gameplay and implement that, with placeholder art to begin with. For instance, if the game is a 2D platformer, I would make a character (or a rectangle, to get started) that I can control with the keyboard, so it can move left and right and it can jump. Making this little demo is a lot less overwhelming than making a complete game, but it will teach you important skills to make your game. You can play around with parameters of the movement until it feels right.

Another little program you can make is something that reads a level and shows it on the screen. Perhaps here you just use the keyboard to move around the level, with no characters or anything else inside.

It is perfectly OK to then throw away the code from these little prototypes and start from scratch. But you will be much more confident that you know how to implement several key parts of the game.

Anyway, that's the kind of process that works for me, but programming is an art and you need to find what works for you.

#5189826 Recommend a book on differential geometry

Posted by Álvaro on 28 October 2014 - 06:04 PM

There might be some uses for differential geometry in computer graphics (texture synthesis following a flow on a surface comes to mind), but you can almost certainly get by with some intuitive understanding of the situation without having to learn this complicated subject. So I agree with duckflock.

#5189306 A radiometry question for those of you who own Real Time Rendering, 3rd Edition

Posted by Álvaro on 26 October 2014 - 07:20 PM

You need to imagine multiple light sources, or light sources that are not points. You are interested in summing the contributions from light sources in the circle.

#5189305 Error: unique_ptr constructed with null deleter pointer

Posted by Álvaro on 26 October 2014 - 07:18 PM

The most useful thing you could produce would be a tiny complete program that reproduces the problem. We can then be sure that you haven't left out any important detail, and we can try to reproduce the problem. It's also very likely you will find a mistake in your code in the process of producing that tiny program.

#5189008 Fullscreen trouble

Posted by Álvaro on 24 October 2014 - 06:50 PM

This seems to require very specialized knowledge of SDL. I would post in the SDL forums. This one seems like the right place to ask about this type of problem.