• Content count

  • Joined

  • Last visited

Community Reputation

157 Neutral

About asvsfs

  • Rank
  1. a very important aspect in such games is game control being Deterministic that means player should know what exactly he should expect from what he builds , as in usual TD games you exactly knows what tower does what and in what range and in what shape! well if you design a system that let players to design their own towers its very unlikely to get such result if you do so you are a genius , but just ignore it if you don't have the idea. stick to the fact Determinstic , its like jumping in a platformer game , player doesn't expect character jumping to random height , he expect to jump as high as he wants ( based on time he keeps touching the screen for example).   but you could just limit the idea in very smaller range of possibilities maybe then you could have the enough control over the gameplay
  2. What does your IDE look like?

    I've used     attach your setting files please  
  3. Hey ,   changing it to an "a" ?!   well that doesn't work   its a comma distinct parameter from each other
  4. im using gcc on windows and its not the latest version i guess its 4.4.1 or 4.5.2
  5. here is an example of what it do   ObjectFactory<Shape *(int), std::string> shape_factory; shape_factory.Register<Triangle>("triangle"); shape_factory.Register<Square>("square"); Shape *shape1 = shape_factory.Create("triangle", 10); Shape *shape2 = shape_factory.Create("square", 20);   it gives error at first line   its working nice when compiling with msvc default compiler , and no related warning
  6. Hi,   i have a bit of problem with getting a macro working with gcc compiler , im working with marmalade SDK and when compiling my code with arm gcc compiler it shows an error , im using one of gamedev article source code for object factory   Source Code Attached.   and here is the errors Error    9    error : macro "MACRO_REPEAT_1" passed 5 arguments, but takes just 4    Error    10    error : unterminated argument list invoking macro "MACRO_REPEAT_1"     Thanks Amir
  7. Hi,   i have a list of 50 games (+ source code) made by cocos2d + box2d ready to  sell, the price is pretty nice and i'll provide you an example of games with source code, there many types of regular games   Regards
  8. [quote name='Danny02' timestamp='1296053337' post='4765064'] the fastes way would be to just replace your spirit geometry, with 4 new geometrys. Either threw calculations or with prcalculated geometry. This has the possitiv effect that u don't need to copy the texture data around, you can use the same texture for everything. [/quote] could you give some details about it?
  9. another way i thought is maybe i could define every thing in world as a polygon with triangles , and when i want to divide an object i just create new polygon and with triangulation make new triangles to render i don't know which way is more efficient,
  10. Hello everybody, my question is how can i divide my sprite into (for instance) 4 sprites, for example i have a circle and i want to divide it into 4 unequal pieces and every new sprite would be a quad with texture on it, [img][/img] i want an efficient way for doing it Thx , Regards
  11. i tried it , it didn't work in case when you have a group of agents selected and you give them a target somewhere and they are too close to each other , then when they get near target they will never get there exactly and that solution will not work at all because they are pushing each other and none of them will ever arrive .( it is always some tiny displacement so distance to target never reach zero.) Is There any alternative to this method for rts games?! efficient and works well when there is large amount of units on screen,and its 2d for now. [Edited by - asvsfs on October 20, 2010 2:41:09 PM]
  12. ah , i totally forgot to mention about AccumulateForce This function first determines how much of the maximum available steering force is remaining, and then one of the following happens: If there is a surplus remaining, the new force is added to the running total. If there is no surplus remaining, the method returns false. When this happens, Calculate returns the current value of SteeringForce immediately and without considering any further active behaviors. If there is still some steering force available, but the magnitude remaining is less than the magnitude of the new force, the new force is truncated to the remaining magnitude before it is added. and there is maxspeed and maxforce . and the problem arise when units want to arrive same position if you test a rts game and select some units and move them to some position inside their bounding box they will all go to there position but they will found their proper positions , but in this case when im trying to do that units will found some balance between themselves but they rotate all the time because of velocity changes , i did use some smoothing solution that made that much better but they still have the same behavioure( rotate time after time) and about your third statement , it seems reasonable i'll check that but i guess i checked that already , i don't remember ! there is thousands of way i tested!
  13. Hello Again, is this even possible to stabilize such system in the situation when units are stopped ?( with arrive behaviour) because it seems reasonable that we always have some forces in different directions seperation and arrive are always opposite and because seperation depends on length it will change time after time , arrive push units to get its target and seperatin do opposite if there is more than one unit around it... i find some smoothing solution for that but even with that i still have some changes in direction sometimes . i need a movement simulation like strategy games. i don't know if its the right way to do that. whats your advice about the whole situation? Thanks
  14. thanks for your answer here is flocking algorithm that i used and parameter m_sepw = 1240; m_alignw = 100; m_cohesionw = 20; m_arrivew = 200; they were all 200 at first place but i changed them for more stability .... the Whole logic is from ai by example book, This is Calculation Force function hgeVector cforce; cforce =SeparationPlus(GameWorld::GetInstance()->Objects) * m_sepw; if (!AccumulateForce(force, cforce)) return force; cforce =AlignmentPlus(GameWorld::GetInstance()->Objects) * m_alignw; if (!AccumulateForce(force, cforce)) return force; cforce =CohesionPlus(GameWorld::GetInstance()->Objects) * m_cohesionw; if (!AccumulateForce(force, cforce)) return force; cforce = Arrive(m_target, m_Dec) * m_arrivew; if (!AccumulateForce(force, cforce)) return force; return force; //----------------------------------------------------------------------------// hgeVector Vehicle::SeparationPlus(const std::vector<Vehicle*> &neighbors) { Vector SteeringForce; bool change =false; //iterate through the neighbors and sum up all the position vectors for (Vehicle* pV = GameWorld::GetInstance()->CellSpace()->begin(); !GameWorld::GetInstance()->CellSpace()->end(); pV = GameWorld::GetInstance()->CellSpace()->next()) { //make sure this agent isn't included in the calculations and that //the agent being examined is close enough if(pV != this)//&&pV->arrive ==false) { change = true; hgeVector ToAgent =position - pV->position; //scale the force inversely proportional to the agents distance //from its neighbor. double len = ToAgent.Length(); ToAgent.Normalize(); SteeringForce +=( (ToAgent)/len); } } return SteeringForce; } //------------------------------------------------------------------------// hgeVector Vehicle::CohesionPlus(const std::vector<Vehicle*> &neighbors) { //first find the center of mass of all the agents hgeVector CenterOfMass, SteeringForce; int NeighborCount = 0; //iterate through the neighbors and sum up all the position vectors for (Vehicle* pV = GameWorld::GetInstance()->CellSpace()->begin(); !GameWorld::GetInstance()->CellSpace()->end(); pV = GameWorld::GetInstance()->CellSpace()->next()) { //make sure *this* agent isn't included in the calculations and that //the agent being examined is close enough if(pV != this) { CenterOfMass += pV->position; ++NeighborCount; } } if (NeighborCount > 0) { //the center of mass is the average of the sum of positions CenterOfMass = CenterOfMass/(double)NeighborCount; //now seek towards that position SteeringForce = Seek(CenterOfMass); } //the magnitude of cohesion is usually much larger than separation or //allignment so it usually helps to normalize it. SteeringForce.Normalize(); return (SteeringForce); } //--------------------------------------------------------------------------// hgeVector Vehicle::AlignmentPlus(const std::vector<Vehicle*> &neighbors) { //This will record the average heading of the neighbors hgeVector AverageHeading; //This count the number of vehicles in the neighborhood double NeighborCount = 0.0; //iterate through the neighbors and sum up all the position vectors for (Vehicle* pV = GameWorld::GetInstance()->CellSpace()->begin(); !GameWorld::GetInstance()->CellSpace()->end(); pV = GameWorld::GetInstance()->CellSpace()->next()) { //make sure *this* agent isn't included in the calculations and that //the agent being examined is close enough if(pV != this) { AverageHeading += pV->heading; ++NeighborCount; } } //if the neighborhood contained one or more vehicles, average their //heading vectors. if (NeighborCount > 0.0) { AverageHeading = AverageHeading/NeighborCount; AverageHeading -= heading; } return AverageHeading; } //----------------------------------------------------------------------// hgeVector Vehicle::Arrive(hgeVector TargetPos, Deceleration deceleration) { hgeVector ToTarget = TargetPos -position; //calculate the distance to the target position double dist = ToTarget.Length(); if (dist > 0) { if(arrive) arrive = false; //because Deceleration is enumerated as an int, this value is required //to provide fine tweaking of the deceleration. const double DecelerationTweaker = 0.3; //calculate the speed required to reach the target given the desired //deceleration double speed = dist / ((double)deceleration * DecelerationTweaker); //make sure the velocity does not exceed the max speed = min(speed, maxSpeed); //from here proceed just like Seek except we don't need to normalize //the ToTarget vector because we have already gone to the trouble //of calculating its length: dist. hgeVector DesiredVelocity = ToTarget * speed / dist; hgeVector res =DesiredVelocity -velocity ; return res; } return hgeVector(0,0); }
  15. hello everyone, i'm really confused with flocking algorithm it works right but when i combine it with arrive behaviour it don't look really good! specially in case of direction, units rotates all the time and they don't have balance (forces are not balanced) i changed parameters for 1 hour now but i couldn't get ideal result , i was just wondering how everyone manage group movement and forces between them ! for these specific goals *units shouldn't overlap(not very precise) *units should stop when they rich their target ( some times there is already something in target position , and they should solve their problem on their own! thanks