Jump to content

Ending Credits

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by Ending Credits

  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.
  15. Actually, player is just a reference to the player's character so I can place the camera, all the rest will be done in methods (this is probably a really silly/weird way to do things). I'll have a look at maps though, they look quite usefull.
  16. I have a line in code that goes: UTNCharacter * newplayer = world.CreatePlayer(); world.player = &newplayer->controller; (Where world.CreatePlayer(); returns a pointer to the UTNCharacter type.) However, when I use the following code: UTNCharacter newplayer = world.CreatePlayer(); world.player = &newplayer.controller; (Where world.CreatePlayer(); returns a UTNCharacter object.) The world.player pointer seems to be made null and PositionEntity(*player,...) with the world class methods produces a memory access error. Am I doing something stupid?
  17. Have a look at the water tutorial, it explains how to do reflections.
  18. I think it would look really good with some over-the-top bloom like this: Link
  19. Last time I tried Networking I couldn't get anything to work. Have there been any updates to the networking in 2.23 recently?
  20. We also need a LoadScene that only loads physics bodies and not materials and meshes.
  21. YOu can always render the model without Framework, depends what you want to do.
  22. I believe the shader will work with any orientation. It's the rendering that has to be oriented with the mirror.
  23. The Leadwerks engine is incredibly similar in style to the Blitz3D language: int main(int argc, char** argv) { Initialize(); Graphics(640, 480); CreateWorld(); TCamera cam = CreateCamera(); while(!KeyHit(KEY_ESCAPE)) { TurnEntity(cam,Vec3(mx,my,0)); UpdateWorld(); RenderWorld(); Flip(); } return Terminate(); } translates to: Graphics3D 640,480 Global cam = CreateCamera() While Not KeyHit(88) Cls TurnEntity(cam,mx,my,0) UpdateWorld RenderWorld Flip Wend End
×
×
  • Create New...