Jump to content

Ending Credits

Members
  • Posts

    85
  • Joined

  • Last visited

Ending Credits's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. I'm really suprised about the lack of support for newton.
  2. Linepicks seem a much quicker way of doing things, especially if you have a lot of bullets at once. Personally I use a firepivot which I rotate by a certain random offset dependant on the recoil and spawn the bullet there.
  3. I'm sure it's been mentioned before but proper multithreading support.
  4. Could you not override the MM by keeping a reference to every object in a global vector or list? I'm a C++ newb so I'm not 100% but shouldn't this stop the objects from going out of scope? EDIT: of course it depends what's causing the crash so you'll have to do some investigating.
  5. Wat the hell happened on October the 5th? (Check the history)
  6. I took this idea and modified it a wee bit. My idea was to have behavious as things attributed to game objects (but they don't have to be) which act on attributes and modify them, importand variables such as controllers are kept as part of the object for memory management purposes plus it allows things to be accessed directly if needs be. This is what I did for player movement (I'm not a great programmer, sorry if the code is a bit shoddy): //#################### class AttributeType{ public: AttributeType(){} }; template <class T> class Attribute : public AttributeType{ private: T data; public: Attribute(T _data) { data = _data; } T GetValue() { return data; } void SetValue(T value) { data = value; } }; class UTNBehaviour { public: map<string,AttributeType*>* attributes; void SetAttributeList(map<string,AttributeType*> * att) { attributes = att; } template <typename T> T GetAttributeValue(map<string,AttributeType*>* att, string name) { return reinterpret_cast<Attribute<T>*>((*att)[name])->GetValue(); } template <typename T> void SetAttributeValue(map<string,AttributeType*>* att, string name, T value) { return reinterpret_cast<Attribute<T>*>((*att)[name])->SetValue(value); } virtual void operator()()=0; virtual void operator()(map<string,AttributeType*>* att)=0; }; float mx = 0; float my = 0; class PlayerMovement : public UTNBehaviour{ public: virtual void operator()() { (*this)(attributes); } virtual void operator()(map<string,AttributeType*>* att) { TVec3 * rotation = GetAttributeValue<TVec3*>(att,"orientation"); rotation->X = rotation->X + my*0.1; rotation->Y = rotation->Y - mx*0.1; UpdateController(*GetAttributeValue<TEntity*>(att,"controller"),rotation->Y,(KeyDown(KEY_W)-KeyDown(KEY_S))*5,(KeyDown(KEY_D)-KeyDown(KEY_A))*5,0,10); } }; //#################### class UTNGameObject{ private: static list<UTNGameObject *> liveObjects; public: UTNGameObject(); map<string,AttributeType*> attributes; map<string,UTNBehaviour*> behaviours; void AddAttribute(string name, AttributeType* att) { attributes[name] = att; } void AddBehaviour(string name, UTNBehaviour* bhv) { behaviours[name] = bhv; } template <typename T> T GetAttributeValue(string name) { return reinterpret_cast<Attribute<T>*>(attributes[name])->GetValue(); } template <typename T> void SetAttributeValue(string name, T value) { reinterpret_cast<Attribute<T>*>(attributes[name])->SetValue(value); } map<string,AttributeType*> * GetAttributeList() { return &attributes; } virtual ~UTNGameObject(); virtual void Update(); }; //########## enum PLAYERTYPE {LOCAL_PLAYER,FOREIGN_PLAYER,NPC}; class UTNCharacter : public UTNGameObject{ public: void Update(); TController controller; TVec3 orientation; PLAYERTYPE playertype; }; //########## list<UTNGameObject *> UTNGameObject::liveObjects; UTNGameObject::UTNGameObject(){ liveObjects.push_back(this); } UTNGameObject::~UTNGameObject(){ } void UTNGameObject::Update(){ } //########## void UTNCharacter::Update() { } //########## And then the creation of a player object: void CreateGame() { SetWorld(world.GetWorld(MAINWORLD)); Collisions(1,2,true); SetWorldGravity(Vec3(0,-20,0)); TEntity scene = LoadScene("abstract::scene.sbx"); EntityType(scene,1); //world.AddObject(&scene); UTNCharacter *newplayer = new UTNCharacter; newplayer->playertype=LOCAL_PLAYER; newplayer->controller = CreateController(1.8f,0.4f,0.3f,40.0f); newplayer->AddAttribute("controller",new Attribute<TEntity*>(&newplayer->controller)); SetBodyMass(*newplayer->GetAttributeValue<TEntity*>("controller"),60.0); EntityType(*newplayer->GetAttributeValue<TEntity*>("controller"),2); PositionEntity(*newplayer->GetAttributeValue<TEntity*>("controller"),Vec3(0.0,5.0,0.0)); newplayer->orientation=Vec3(0); newplayer->AddAttribute("orientation",new Attribute<TVec3*>(&newplayer->orientation)); UTNBehaviour * bhv = new PlayerMovement; bhv->SetAttributeList(newplayer->GetAttributeList()); newplayer->AddBehaviour("playercontrols",bhv); world.player = &newplayer->controller; world.playerrotation = &newplayer->orientation; world.AddObject(newplayer); appstate = GAME_RUNNING; } And the world update loop (UTNWorld is my framework substitute which can be rendered by a renderer object) void UTNWorld::Update() { SetWorld(GetWorld(MAINWORLD)); for(list<UTNGameObject *>::iterator ita=worldObjects.begin(); ita!=worldObjects.end(); ) { UTNGameObject *ptr=(*ita); ++ita; ptr->Update(); //Fairly redundant if you use behaviours for(map<string,UTNBehaviour*>::iterator itb=ptr->behaviours.begin(); itb!=ptr->behaviours.end(); ) { UTNBehaviour * ptrb = (*itb).second; //(*ptrb)(&(ptr->attributes)); (*ptrb)(); ++itb; } } PositionEntity(cam,EntityPosition(*player)+Vec3(0,1.8,0)); RotateEntity(cam,*playerrotation); SetWorld(GetWorld(MAINWORLD)); UpdateWorld(AppSpeed()); } Sorry if it's a bit confusing and a bit long, it's from a WIP and I din't want to spend too much time editing it. So is this a good way of working (I can see myself easily being able to build up an array of usefull behaviours and objects this way)? As I said before, I'm a pretty poor programer in that I don't have very much real world experience so this whole thing might be disasterous.
  7. The slide shouldn't go forward after the magazine is inserted if the hand is going the pull back the slide otherwise it seems a bit redundant.
  8. Remember to divide the Force by the square of the distance from the centre of gravity if you want to make it realistic. Fortunately the distance squared is simply the the sum of the squares of the difference in x, y and z. i.e (x1 - x2)2 + (y1 - y2)2 + (z1 - z2)2
  9. Are you going to include Track IR support in this?
  10. Check all your cables and try booting the PC in different memory and hard drive configurations. Sometimes it can even be stuff like the DVD drive fouling up the boot process so the more you can strip away the more chance you have of fixing the problem and then you can continue adding components back in until you find the faulty one. Personally I don't think it is a motherboard problem and if it is I imagine you can fix it with a BIOS reflash (although I wouldn't recommend this until you have no other options left as theres a risk that you could brick your motherboard if you do it wrong).
  11. I'm in the same position as you as knowing how to code in C++ but not knowing how to code properly. One thing that has helped is looking at all the code snippets that other people have posted here and now that I look at all the stuff I've coded it seems far more messy than it did when I originally coded it.
  12. I think he means "is there's something built in so that the models won't intersect each other".
  13. I'll report it later as I'm a bit time-connstrained right now but none of the quick bbcode buttons seem to work. ....except now they do. Has the feature just been added because they definitely weren't working for me on two occassons in the past?
  14. Isn't it all relative anyway, so setting the barrell mass to 1 or 100 is fine as long as the player mass and forces are scaled by the same amount. I'd decide on a standard for masses and stick to that.
×
×
  • Create New...