Jump to content

Ending Credits

Members
  • Posts

    85
  • Joined

  • Last visited

Posts posted by Ending Credits

  1. 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.

  2. 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.

  3. I think the icon looks a bit bare, especially when it's large, after all, we are missing the bottome left quadrant.

     

    Perhaps you should put the old logo (the boxes) in where the empty space is :lol:

  4. 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.

  5. 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

  6. //I am going to assume, you don't have collisions on those models?

     

    Of course, they are :)

     

    Thanks, guys, for replies :)

     

    I think he means "is there's something built in so that the models won't intersect each other".

  7. Ah, that's what causes that. I have seen that happen on a few profiles.

     

    There's a section in the bug tracker for website bugs now, FYI.

     

    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?

  8. 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.

  9. Use STL map instead of pointers, since you will need multiple players also.

     

    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.

  10. I am far from an expert (learning C++ as I go along with Leadwerks) but I believe your first example creates an object on the heap, whereas your second example creates an object on the stack. Characteristic of the stack is that when "newplayer" goes out of scope, it is no longer valid.

     

    Someone will probably come along to correct me :blink:

     

    That would explain it.

  11. 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?

  12. Apparently e-IPS aren't really as good as proper IPS panels (they're more like PVA quality which is still much better than TN). I have heard some really good things about that monitor though.

     

    I was lucky enough myself to pick up a 24" PVA panel for £170 just under a year ago.

  13. As far as I am aware the water shader used requires a plane thats facing directly up, so you'd probably have to write your own reflection shader to uses a plane in a different orientation. Your best bet is to use a camera, render buffer and render to a texture.

     

    I believe the shader will work with any orientation. It's the rendering that has to be oriented with the mirror.

  14. 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...