Jump to content

  • Log In with Google      Sign In   
  • Create Account

NEXUSKill

Member Since 20 Aug 2008
Offline Last Active Nov 19 2014 06:32 AM

Topics I've Started

The template paradox

13 March 2014 - 09:31 AM

I just wrote this, it works perfectly, but I don't know what to make of it in terms of what the concept means...

 

public class SerializedData<DataType> where DataType: SerializedData<DataType>
 
This is a template class in which its template type must be derivate of the same clase with the same template type.... sounds terribly weird

Calculating arrival with soft turn (help!)

12 November 2013 - 12:35 PM

So, we have a mobile that behaves very much like a car, with some rules simplified.

 

The mobile has a maximum turning speed and a turning acceleration, this goes to both directions of the car relative to its forward vector.

It also has a top forward speed, which is limited to a linear interpolation between the maximum in straight line and the maximum while using top turning speed.

In order to reach this top speed and to stop it has an acceleration as well, considered to be constant.

Unlike a car, we are not meant to move backwards.

 

For the purposes of this task we are in a wide open empty parking lot, so room to move and manouver is plenty, we start in a given position facing a given angle and we are given the goal of arriving at another specific spot at another specific orientation.

This goal may very well be to end up standing in the same spot but facing the opposite direction.

Acceleration and speeds for both translation and rotation will make the beggining of our movement process look very nice, but arrival is more complicated, we need to arrive from a specific direction in order to end up looking in the angle we were given.

 

My first instinct is to try to extrapolate the arrival turn from the goal backwards, but I have no idea how to do this mathematically. Formulas? hints? alternative solutions? it needs to look soft and obey the rules stated above.

Acceleration and deceleration may have different magnitudes.


Dynamically distributing multiple agents within a tile

04 November 2013 - 02:21 PM

So my goal is to fit a squad of units within a tile, the number of units that compose the squadron is variable, worst case scenario I need to fit 50 in a hexagonal tile, later of course when the squad takes damage it will lose units and the surviving ones should reorganize in such a way that they seem to make the bes use of the space of the hexagon.

 

My first approach was to make a vector of vectors and define them by hand, this of course is horrybly tedious but even worse it doesn't provide a clear critera to reorganize the units when one dies.

 

can anyone provide some pointers as to how can I accomplish this proceduraly?

The size of an individual unit is yet to be determined, mainly by how good/bad they would look if I fit 50 distiguishable units in one tile, so consider units to be circles of a variable radius that fits our needs.

 

getting the units to go to a particular position is already solved by flocking behaviors, my problem is establishing where they should go in the first place

 

Any ideas? papers? working algorithms? techniques?


Deprecation fail

15 May 2013 - 02:01 PM

I once found this in a c++ long method while searching for optimizable loops and unnecessary processes, it was a rendering update for a skeletal animated actor, the method itself was a good 150 lines long total and in the midst of its implementation there was this while loop:

 

//The following block of code should not be executed anymore, keeping it around for fallback reasons
while(0)
{
    ... do about 20 lines of stuff...
}

 


Seeing this actually hung my brain for about a minute before I yelled "Who the F* doesn't know how to comment a block of code on C++?" to the whole office.

The perpetrator was no longer working for the company and was responsible for many ridiculous pieces of code of which this was one of the last that didn't get deleted and fell through the cracks.

Granted, the code didn't actually get executed and the compiler likely did away with the whole loop, but it was still blasphemous.


Hierarchy conflict

02 November 2012 - 08:02 AM

A bit of a background, I am working on a home brew engine for learning and hobby purposes, based on XNA, though thats not really relevant for this question, I am faced with a bit of a design dilemma:

The engine is split in different systems, that manage hierarchies of objects, in this problem GUI elements, Collision structures and Nested transformations are the hierarchies in conflict, all three systems use nTrees as the main object structure, i.e. a GUIs, Collision structures and transformations are composed by trees of those kinds of objects.

When a child is added to an object, the transformation will reflect the same hierarchy, the transformation of a child GUI will be itself a child of that GUI's parent's transformation. Thus when the parent is transformed all children are affected accordingly.
It works very well for the composition but collision checking, for mouse interaction in this case, presents a problem.
Collision structures do the same thing, a collision structure might be complex, and each component of the tree has its own transformation, and the hierarchy of that transformation reflects the hierarchy of the collision tree.
Hierarchy allows collision to only turn true when the check between two leaf nodes is true.

Since collisions are a component of a GUI, their transformation is added to the transformation tree of the GUI, at first I made the collision structure reflect the GUI structure in the same way transformation did, but that resulted in collision transofrmations having two parents, one from the owner gui and one from the parent collision body. So I had to stop doing that, now the collision structure of a GUI is independent of that of the parent.

When trying to identify the gui under the mouse pointer now, I end up having multiple results, because if the mouse is over a button, both the button and the parent gui it belongs to are under the mouse, since their collision bodies do not belong to the same hierarchy.
Giving no collision body to the parent GUI simplifies the problem, but it forces the parent to be non interactive, so its not a good solution. I'm about to try having the parent pass the collision event to its childs when handling it, but I was wondering if someone can think of a more elegant solution.

PARTNERS