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!


Álvaro

Member Since 07 Mar 2002
Offline Last Active Today, 07:32 AM

#5218653 Tips for reading mathematic formulae?

Posted by Álvaro on 23 March 2015 - 06:06 PM

"That R looking thing with the extra line" is the symbol for the set of real numbers. Most formula-heavy books have a couple of pages at the beginning describing the notation they use. Does your book have that?




#5218568 c++ count lines in txt file and then read these lines without reopening a file

Posted by Álvaro on 23 March 2015 - 01:48 PM

You can also use a std::deque, which also provides a push_back method, gives you O(1) access to elements (although probably slower than std::vector's), and doesn't reallocate.

Of course it's not the best solution in all cases, but it should be considered.


#5217313 C++ do while error

Posted by Álvaro on 18 March 2015 - 04:33 AM

What function is that do-while loop supposed to be in? As it stands, it's in the class block for `President', but not in any function.
 

ph34r.png




#5217310 GUI Ideas for a Tower Defense Game

Posted by Álvaro on 18 March 2015 - 04:12 AM

One detail that most tower-defense games get wrong: Allow the user to use keys to do most things: select a type of tower to build, upgrade the selected tower, sell the selected tower (if this is expected to be a common action), etc.

Other than that, play a few TD games and see what you like or don't like in their interfaces.


#5216240 How to make bot playing game with neural net

Posted by Álvaro on 13 March 2015 - 03:53 AM

The four outputs are probably wrong, as a large part of the output space (going both up and down or both left and right) is nonsensical. You could instead adopt two continuous-valued outputs, x and y velocity, which could have both signs to represent all directions of desired movement and could be jointly quantized in arbitrary ways to move along a grid or another type of pathfinding graph.


I don't think there is anything wrong with having those four outputs, if those really correspond to the actions available. See for instance what DeepMind did with Atari 2600 games (paper) (video).


#5215956 how much time it takes to arrive?

Posted by Álvaro on 11 March 2015 - 07:59 PM

If I understand the constraints correctly, this can't be done. If you can synchronize their clocks (say, by using GPS on both sites), sending timestamps works. Otherwise neither side can tell which of the two legs took longer.


#5215756 Confused about linear forces and rotation

Posted by Álvaro on 10 March 2015 - 08:06 PM

That is how it works. You have the wrong intuitions in the case of the pen, probably because there is too much friction involved.

This should help.


#5215491 Picking a random value from array with priority

Posted by Álvaro on 09 March 2015 - 02:46 PM

You can take the table of probabilities and transform it by computing partial sums.

{{100, 10},
 {50 , 10},
 {10 , 5},
 {3  , 2}}
turns into
{{100, 10},
 {50 , 20},
 {10 , 25},
 {3  , 27}}
Now take a random number 0 <= r < 27 and see where it fits in the table (using binary search, for instance).


#5214943 PathNodes: array or list

Posted by Álvaro on 06 March 2015 - 07:08 AM

Just keep in mind that you will need a modified heap, as you need to update the node cost (you can also update the values and call the heapify operation, if your implementation allows it).


The problem with trying to update the node cost in the heap is that you need another structure to keep track of where things are in the heap, or you need to keep the costs in a separate structure... An easier solution is to allow a node to be inserted multiple times in the heap. When you take a node out of the heap, you check if it is in the closed list, and in that case you skip it.


#5214756 Lighting of 2D clouds

Posted by Álvaro on 05 March 2015 - 10:11 AM

We had an awesome thread about this back in 2002: http://www.gamedev.net/topic/86024-sky-rendering-techniques/

Unfortunately all the images seem to be broken by now, so I don't know how useful it still is.

You can also probably find some useful info here: http://vterrain.org/Atmosphere/Clouds/


#5214382 Tetris Help

Posted by Álvaro on 04 March 2015 - 12:14 AM

You are reading from tBlock and writing to the same array, which muddles things in strange ways. Try to use a different array as destination and then copy the result over to the original array.


#5214287 Calculate normal vectors for 'elliptic' torus

Posted by Álvaro on 03 March 2015 - 02:00 PM

You can always compute the partial derivative of (x,y,z) with respect to u and with respect to v, and then take their cross product. You can then scale it by any amount you want. For instance, if you divide by r, I think you get:

nx = cos(u) * cos(v) * (b + r * cos(v))
ny = sin(u) * cos(v) * (a + r * cos(v))
nz = sin(v) * (cos(u)^2 * (b + r * cos(v)) + sin(u)^2 * (a + r * cos(v)))

But perhaps I made a mistake somewhere.

EDIT: I just saw a simplification for nz:
nz = sin(v) * (cos(u)^2 * b + sin(u)^2 * a + r * cos(v))


#5214273 unique_ptr doubt

Posted by Álvaro on 03 March 2015 - 01:17 PM

Nuno, one comment that might help with your English: The correct translation for the Portuguese "dúvida" or the Spanish "duda" is "question", not "doubt". When I saw the title of the thread I knew the author's native language was either Portuguese or Spanish. I grew up speaking both and I used to make the same mistake in English.


#5213791 Converting Axis Angles (forward, right, up) to Euler.

Posted by Álvaro on 01 March 2015 - 07:58 PM

Those three vectors you describe are the columns of a rotation matrix. So search for "rotation matrix to euler angles" (157,000 hits in Google).

EDIT: Good explanation here: http://staff.city.ac.uk/~sbbh653/publications/euler.pdf


#5213712 How to make bot playing game with neural net

Posted by Álvaro on 01 March 2015 - 02:09 PM

If the number of enemies is large, you probably want to summarize it by dividing the space around the agent in a few regions (say, 30) and then use the number of enemies in each region as your input. That would work well for any number of enemies.




PARTNERS