Input
  • erik:

    Great that you've started to code. However, for stuff that changes how the input system works I think I need to hear more about your thoughts, basically since we want to have a stringent user interface.

    The way it's planned is to have the mouse wheel control zoom in and out when in a) movement mode b) in gui mode with the mouse over the "render window", i.e. not over any gui element. The first one is easy to implement using the keymappings in ember.conf (though I have to add key events for the mouse wheel buttons; there aren't any right now since mouse wheel movements are not technically keyboard events); the second one is harder though since there's no way to do that by using the key mapping code as Ember technically will be in the "gui mode" state, even though the cursor is over the render window. So we might want to wait with the latter one.
    The keymappings are defined in ember.conf. There's currently three different keymapping "states". "general" applies all the time, "gui" applies when in gui mode and "movement" applies when you're in movement mode.

    I don't see why you want to move the camera around while pressing the left mouse button: this already happens when in movement code. A special case is the entity renderer widget, which is shown when creating a new character and in the modeleditor, but that doesn't affect the main camera.

    The way the main camera works is that the user is free to change the camera independent of the Avatar. At a certain interval (which can be set in ember.conf) Ember will however update the direction of the Avatar to face the way the camera currently points and send this update to the server (it's a certain interval to prevent swamping the server with data).

    Input is handled in a way that decouples the actual action from the input through using both the key mapper and console objects. I.e. almost all input operations should be expressed as console commands, so that they can be dynamically bound to different keys, or scripted in console scripts etc.. So for example for moving forward:


    * the user pressed "w"
    * a n
    * the keymapper iterates over all input event since the last frame, and tries to see if there's a matching console command
    * it does a lookup for "w" and find the command "+move_forward", which it then executes
    * the AvatarController class listens for the "+move_forward" console command and when it recieves it, it updates the state of the avatar to be moving forward
    * later on, in the same frame, the AvatarController will recieve a command to process the avatar for this frame: it then checks what the current state is and moves the avatar accordingly

    Console commands that start with "/" are one shot commands. Those that start with "+" will make something happen until a similiar command prefixed by "-" (such as "-move_forward") is sent. The keymapper handles the matching of "+" and "-" commands and key presses and releases. (So that when the user later on releases the "w" key a "-move_forward" console command is sent.)

    So for a camera zoom function, we would need to create console commands for "/camera_zoom_in" and "/camera_zoom_out", make the AvatarCamera understand and act on these commands and then add bindings in ember.conf which binds them to the mouse_wheel_up and mouse_wheel_down events (which aren't there yet).


    I understand how the Lua code works about mapping the keys and where the console command needs to be more general.

    OK so I would put in (after the zoom events are in of course):

    /camera_zoom_in" and "/camera_zoom_out" 


    within the /home/Mark/Projects/WorldForge/forge/clients/ember/src/components/ogre/
    files it seems maybe in the AvatarController constuctor.

    The Lua imput code looks like this?
    if button == EmberOgre.Input.MouseButtonLeft


    Mainly I just want to have a timed jump so I dont jump too fast which I have the code for and the mouse wheel zoom.

    So until zoom is in I will work on timed jump.
    It's a full OGRE event package but I kinow how to add in the frame event. This just has the timer aspect.

     class myFrameListener: public ExampleFrameListener
    {
    protected:
    float buttonTimer;
    public:
    myFrameListener(RenderWindow* win, Camera* cam): ExampleFrameListener(win, cam)
    {
    buttonTimer = 0;
    }
    bool frameStarted(const FrameEvent& evt)
    {
    float time = evt.timeSinceLastFrame;
    buttonTimer -= time;

    if (/*is KeyDown?? */ && buttonTimer <= 0)
    {
    buttonTimer = 0.5;
    //jump code
    }
    return true;
    }
    };


    Then I would have to add the ember.conf code
  • EXAMPLE:
    At the bottom

    AvatarController::AvatarController(Avatar* avatar, Ogre::RenderWindow* window, GUIManager* guiManager, Ogre::Camera* camera) 
    : mEntityUnderCursor(0)
    , mSelectedEntity(0)
    , mGUIManager(guiManager)
    , mWindow(window)
    , mAvatarCamera(0)
    , mCamera(camera)
    , mMovementCommandMapper("movement", "key_bindings_movement")
    , RunToggle("+run", this, "Toggle running mode.")
    , ToggleCameraAttached("toggle_cameraattached", this, "Toggle between the camera being attached to the avatar and free flying.")
    , CharacterMoveForward("+character_move_forward", this, "Move the avatar forward.")
    , CharacterMoveBackward("+character_move_backward", this, "Move the avatar backward.")
    , CharacterStrafeLeft("+character_strafe_left", this, "Strafe left.")
    , CharacterStrafeRight("+character_strafe_right", this, "Strafe right.")
    , CharacterMoveUpwards("+character_move_upwards", this, "Move the avatar upwards.")
    , CharacterMoveDownwards("+character_move_downwards", this, "Move the avatar downwards.")
    , CharacterJump("/character_jump", this, "Jump your avatar.")
    , mMovementDirection(Ogre::Vector3::ZERO)
  • I would assume charecterMoveUpwards and charecterMoveDownwards is for climbing or maybe up and down the terrain.
  • I see all the server work that I would need to do for jump in Avatar.cpp. I am organizing some code too. I try to keep it the main style too.
  • I'm sorry to discourage you, but the cyphesis server has no support for a jump operation, so it can't really be implemented right now. Jumping requires a physics simulation, and since we're implementing that in Indri we're not going to be adding any such functionality to cyphesis (it has a very simple collision detection system). Since we're so tightly bound to the server we're very much dependent on what's supported there.

    The character_move_upwards and *_downwards commands are for moving the character upwards or downwards, for example if he/she would be levitating. They also moves the camera while in free flight mode.

    The code that should handle camera zoom in and out shuold not be in Lua. It should be in C++, such as the current set_camera_distance command in AvatarCamera. There's no need to check for the button presses youself, that will be taken care of by the KeyBinder instance. As long as you have a console command defined in AvatarCamera and then adds a binding for it to a key in ember.conf, you only need to listen for that command.
  • OK, um , basically I will wait for those two then. Also I want to add .particle scripts but I guess you dont have support for that as well yet on the server?
    How long until that gets going? i would like that to be done before I continue with the UI. The game is virtually unplayable and I can't even connect to other terrains. There is no point in creating a Journal yet or advanced entity creation if I can't even throw something.
    With a game, the physics is the first thing that should be working before anything else, even graphics (the raw mechanics). Before all the fancy stuff the charecter needs to move around in the world very well and the modelers have to be able to place objects right. This is like a core mathimatical principal for me since.
    I see that there was a meeting on modeling a month ago. How are the modelers supposed to model for the world I dont understand.
    Just let me know when you're working on the server stuff and I'll finish the UI as it shouldnt take me to long to do, that stuff is easy. I just don't want to start something that's surface and not have it work the way I want because of critical stuff not working in the engine.
    It's just one of those things where I would like to pollish the UI last.
    Anyhoot I am checking this game out too but I really like WF's potential because it's totally 3D and free unlike Planeshifts media.
    http://www.black-legacy.com/
  • Particle scripts are supported. Right now the only particle script is for the fire. Look at: http://purple.worldforge.org/cvs/forge/ ... deldef.xml
    By using <bindings> attributes you can bind an Atlas attribute to a particle, n this case the atlas attribute "status" (which goes from 1.0 to 0 I think) will affect the particle script attribute "emission_rate" (whicih affects how many particles are emitted each second). Thus, when the status of the fire decreases, the particle represenation becomes smaller.

    Physics simulation is probably nowadays one of the most core things for a single player game; however, for a game such as worldforge there are many other things we got to have nailed down before we start implementing it. If you want to do work on the server stuff you should speak to Al or James.
  • Thanks.

    I'll try to work on the server stuff first to get the physics and terrain corrected so people can put some decent structures in first or at least it will be easier to move stuff around and build.

    About Ember, most of what you have done seems finished. Pretty much the basics are in except a full game which I don't think is a s important for a MOG since players usually like to make there own stuff up.. Not sure about combat though. Maybe snag the SEAR code for that and digging/building later but I want to get to the server first. There is just so much stuff in, like combat, digging, and building in SEAR; yet noone can really play it yet.

    I think it would be great to have it just basically running smoothly since this is really the only type pf MMORPG of it's kind out that's totally free. In MMOGS people usually don't mind if they just run around and stuff.

    I posted in the server forums but because the forum auto-responders aren't working James hasn't replied I will try to email them or post in the dev journals etc.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID