Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

MARS_999

Member Since 06 Mar 2001
Offline Last Active Yesterday, 01:18 AM
-----

Topics I've Started

Big G the same at various screen sizes....

14 April 2013 - 04:17 PM

I am using Box2D for my physics, and I am calculating magnetism on objects. What I have noticed now is when I change the screen size the objects take longer to attract to each other vs. a small screen size, which makes logical sense as the distance is less.

 

So how can I take this formula and make it use the same BIG G constant and be screen size independent?

 

Thanks!!

 

 

const float BIG_G = .2f;

b2Vec2 pk = b2->GetWorldCenter();
float mk = b2->GetMass();
b2Vec2 delta = pk - pi;
float r = delta.Length();
float force = BIG_G * mi * mk / (r*r);
delta.Normalize();

How to sort a vector and push object down e.g. like a stack...

09 April 2013 - 07:28 PM

I am trying to figure out how to sort my top 10 score list, and put the greatest  score and players name at the top and then push down the other 9 and make the last one fall off the vector...

 

Is there something in the std:: lib that can do this?

 

struct GameData

{

    irr::core::stringw name;

    long score, level;

    GameData() : name("NA"), score(0), level(0){}

    ~GameData(){}

    inline bool operator < (const GameData& rhs)

    {

        return score < rhs.score;

    }

    static bool SortGreater(const GameData& lhs, const GameData& rhs)

    {

        return lhs.score > rhs.score;

    }

    static bool SortLess(const GameData& lhs, const GameData& rhs)

    {

        return lhs.score < rhs.score;

    }

};

 

that is the struct for the game score data....

 

and I call this for now...

 

for(unsigned int i = 0; i <p->GetScores().size(); ++i)

                {

                    //need to keep old score and shift it down one like a stack?

                    if(player->GetScore() > p->GetScores()[i].score)

                    {

                        p->GetScores()[i].score = player->GetScore();

                        p->GetScores()[i].name  = playerEditbox->getText();

                        p->GetScores()[i].level = player->GetLevel();

                        break;

                    }

                }

                std::sort(p->GetScores().begin(), p->GetScores().end(), NX::GameData::SortGreater);

 

so as you can see the first occurrence is replaced and not pushing the other ones down... do I want to move to a stack or just cheat and push onto the vector and save out the top 10...

 

Thanks!


SDL 2.0 status?

07 April 2013 - 07:31 PM

I was just told SDL 2.0 is close to being released?

 

Is Sam still working on SDL? Last I knew he dropped it, and didn't have time for it anymore?

 

I quit using SDL after 1.2 as it seemed a waste of time if no one was going to keep the project going and moved to SFML and now that seems like a dead end also....

 

Thanks!


How to calculate polyhedra in realtime...

30 March 2013 - 09:35 PM

I would like to start off with a tetrahedron or if there is a simpler shape and morph into a complete sphere shape based on a level the player has attained...

 

Is there some math formula I can use to calculate the shapes in real time to calculate the vertex and normals for each vertex on the shape?

 

or better yet is there a lib out there that has this already that I can use....

 

C++ and OpenGL will be used BTW if that matters...

 

Thanks!


constant variables in a .txt file load at run time?

30 March 2013 - 05:37 PM

I read somewhere about putting your constant variables in text file and reading them at run time, and setting the constants that way... Is this possible? If so how would you go about this? I didn't think you could do this...

 

Thanks!

 

 


PARTNERS