Jump to content
  • Advertisement

elbenko

Member
  • Content Count

    6
  • Joined

  • Last visited

Everything posted by elbenko

  1. elbenko

    Composing Music For Video Games: Chords

    You're welcome mate!   Yeah, agreed on the lack of thought behind the use of some scores. My best guess is that it's due to lack of communication more than anything. Either that, or someone not qualified took the final artistic decision. Not uncommon for team managers to switch scores for something other than the composer originally intended them for, perhaps in some cases it's warranted, but I would like to think the musician usually knows best.   Yeah, please do use my suggestions for something if you get the time, but only if you think it would make for an interesting subject to read about. I'd do it myself but I don't know all the proper terms for everything related to music composition (not properly schooled), and I'm not half as good with words as you.   The blog sounds like an awesome idea! I've only ever read devblogs from either the programmer or the team manager viewpoint before - would love to follow the work of the audio guys.
  2. elbenko

    Composing Music For Video Games: Chords

    Great article series!   Even if most (serious) musicians learn these things pretty early on, either through school or self-experimentation, it's a great read for someone just starting out, and even for game designers in other departments in order to create a cohesive game experience.   When it comes to conveying / asserting a certain feeling there really isn't anything that trumphs a good musical score. Even a lack of music (where you normally would expect some) can have a powerful effect, given the right situation.      Some suggestions for a possible addendum/part 2 of this Chords article, or perhaps even a whole new article subject in itself.   How to make your pieces musically interesting through contrasting parts:     - Parts with varied chord progressions (for example low movement monotonous verse progression into high movement w/ added progression complexity chorus)   - Varying the tone (for example going from minor verse to major chorus)   - Varied chord inversion (for example low movement inversion chord progression verse into a high movement inversion chord progression chorus)   Obviously contrasting tempo, rhythm, melody, velocity (volume) etc. come into play aswell, but if you're going to restrict it to the subject of chords these "techniques" are good to have in the back of your head when composing.   Anyhow, as I mentioned previously, great articles. Thoroughly explained and put in words I can see people new to composing music would understand.   Looking forward to reading more stuff by you guys.
  3. Hi mate,   Just a thought, but which directions does the 4 corner points return? If they return Left / Right it would probably cause detection issues when your character stands on top of a solid.     Personally I'd probably structure my detection code like this: (easier to follow in terms of readability)   1. Check for collsion & set the appropriate collision flags -> 2. Set / apply velocity for each axis if collision hasn't been flagged -> 3. Update sprite position.   In either case, it would probably be easier to find the problem with the actual code rather than pseudo code.
  4. Hello everyone!   First time posting here on GD, although definitely not my first visit to these forums   Been studying C# (+ .NET framework) give or take 5 months now, done some basic PHP/HTML/Javascript in the past. I figured, now that I know a lot more about OO design principles, and being a gamer at heart, I'd take a more serious look at game development.   So after recreating an ugly (codewise) but functional Pong in MonoGame, i thought I'd start looking at writing code I can recycle in future projects. Decided to start with the inputs (keyboard, gamepads, mouse), seeing as it's a core part of any game, and a fairly general-purpose one at that.   I googled the topic for a few hours, and most people seemed to favour a 3-layer approach. But seeing as XNA/MonoGame takes care of all but the last layer I've focused on that.   So basicly, my motive behind this post is to get your feedback and ideas on how to improve / expand upon what I've come up with so far. Everything from broader design ideas to small performance optimizations are of value and greatly appreciated. (I'm a sucker for smart "best practice" code)   So here's my InputHandler class: // rough, unfinished input handler class // // primary focus (so far) has been: // - learning C#, XNA/MonoGame and general design choices in game development. :) // - centralized handling of all inputs. // - event-driven top layer "abstraction" // - reusable code. // // obviously there's lots of room for improvement, and a couple of ideas are: // - custom collection class which incorporates all relevant bindings for a specific playerIndex. // - expand upon above idea using inputs (Keyboard, GamePad, Mouse) as component objects referenced in a List // and loop through this List in the Update() method. // - adding more modularity & abstraction in general, perhaps allowing for actions/events being added dynamicly. // i.e. making the handler a better fit for a general-purpose top layer game framework. // - gamestate-aware/intelligent bindings, some configurable and some static. class InputHandler { private KeyboardState _keyboardStateCurrent, _keyboardStatePrevious; private Dictionary<InputActions, Keys> _keyboardBindings; private GamePadState _gamePadStateCurrent, _gamePadStatePrevious; private Dictionary<InputActions, Buttons> _gamePadBindings; private List<PlayerIndex> _playerIndexes; public List<PlayerIndex> PlayerIndexes { get { return _playerIndexes; } } public delegate void InputEvent(); // define events // ("dead" default subscribers to avoid having to null check before invokes) public event InputEvent onMoveLeft = delegate { }; public event InputEvent onMoveLeftHold = delegate { }; public event InputEvent onMoveLeftRelease = delegate { }; public event InputEvent onMoveRight = delegate { }; public event InputEvent onMoveRightHold = delegate { }; public event InputEvent onMoveRightRelease = delegate { }; public event InputEvent onJump = delegate { }; public event InputEvent onJumpHold = delegate { }; public event InputEvent onJumpRelease = delegate { }; public event InputEvent onNavigateBack = delegate { }; public InputHandler() { _keyboardStatePrevious = Keyboard.GetState(); _playerIndexes = new List<PlayerIndex>() { PlayerIndex.One }; _gamePadStatePrevious = GamePad.GetState(_playerIndexes[0]); // if config file exist then load it here, else... ResetBindings(); } private void PollKeyboard() { _keyboardStateCurrent = Keyboard.GetState(); foreach (KeyValuePair<InputActions, Keys> keyBinding in _keyboardBindings) { // fire events when key pressed if (_keyboardStateCurrent.IsKeyDown(keyBinding.Value) && _keyboardStatePrevious.IsKeyUp(keyBinding.Value)) { switch (keyBinding.Key) { case InputActions.MovementLeft: onMoveLeft(); break; case InputActions.MovementRight: onMoveRight(); break; case InputActions.MovementJump: onJump(); break; case InputActions.NavigationBack: onNavigateBack(); break; } } // fire events key held else if (_keyboardStateCurrent.IsKeyDown(keyBinding.Value) && _keyboardStatePrevious.IsKeyDown(keyBinding.Value)) { switch (keyBinding.Key) { case InputActions.MovementLeft: onMoveLeftHold(); break; case InputActions.MovementRight: onMoveRightHold(); break; case InputActions.MovementJump: onJumpHold(); break; } } // fire events when key released else if (_keyboardStateCurrent.IsKeyUp(keyBinding.Value) && _keyboardStatePrevious.IsKeyDown(keyBinding.Value)) { switch (keyBinding.Key) { case InputActions.MovementLeft: onMoveLeftRelease(); break; case InputActions.MovementRight: onMoveRightRelease(); break; case InputActions.MovementJump: onJumpRelease(); break; } } } _keyboardStatePrevious = _keyboardStateCurrent; } private void PollGamePad(PlayerIndex playerIndex) { _gamePadStateCurrent = GamePad.GetState(playerIndex); foreach (KeyValuePair<InputActions, Buttons> buttonBinding in _gamePadBindings) { // fire events when button pressed if (_gamePadStateCurrent.IsButtonDown(buttonBinding.Value) && _gamePadStatePrevious.IsButtonUp(buttonBinding.Value)) { switch (buttonBinding.Key) { case InputActions.MovementLeft: onMoveLeft(); break; case InputActions.MovementRight: onMoveRight(); break; case InputActions.MovementJump: onJump(); break; case InputActions.NavigationBack: onNavigateBack(); break; } } // fire events when button held else if (_gamePadStateCurrent.IsButtonDown(buttonBinding.Value) && _gamePadStatePrevious.IsButtonDown(buttonBinding.Value)) { switch (buttonBinding.Key) { case InputActions.MovementLeft: onMoveLeftHold(); break; case InputActions.MovementRight: onMoveRightHold(); break; case InputActions.MovementJump: onJumpHold(); break; } } // fire events when button released else if (_gamePadStateCurrent.IsButtonUp(buttonBinding.Value) && _gamePadStatePrevious.IsButtonDown(buttonBinding.Value)) { switch (buttonBinding.Key) { case InputActions.MovementLeft: onMoveLeftRelease(); break; case InputActions.MovementRight: onMoveRightRelease(); break; case InputActions.MovementJump: onJumpRelease(); break; } } } _gamePadStatePrevious = _gamePadStateCurrent; } // update method to call in gameloop public void Update() { PollKeyboard(); foreach (PlayerIndex playerIndex in _playerIndexes) { if (GamePad.GetState(playerIndex).IsConnected) { PollGamePad(playerIndex); } } } // add plauyerIndex to list of gamepads to poll public void AddPlayerIndex(PlayerIndex playerIndex) { if (!_playerIndexes.Contains(playerIndex)) { _playerIndexes.Add(playerIndex); } } // remove playerIndex from list of gamepads to poll public void RemovePlayerIndex(PlayerIndex playerIndex) { if (_playerIndexes.Contains(playerIndex)) { _playerIndexes.Remove(playerIndex); } } // set default bindings // (future: add more bindings obviously; hardcoded defaults or move them to a default config file?) public void ResetBindings() { _keyboardBindings = new Dictionary<InputActions, Keys>() { { InputActions.MovementLeft, Keys.Left }, { InputActions.MovementRight, Keys.Right }, { InputActions.MovementJump, Keys.Space }, { InputActions.NavigationBack, Keys.Escape } }; _gamePadBindings = new Dictionary<InputActions, Buttons>() { { InputActions.MovementLeft, Buttons.DPadLeft }, { InputActions.MovementRight, Buttons.DPadRight }, { InputActions.MovementJump, Buttons.A }, { InputActions.NavigationBack, Buttons.Y } }; } public void ChangeBinding(InputActions inputAction, Keys key) { if (_keyboardBindings.ContainsKey(inputAction)) { _keyboardBindings[inputAction] = key; } } public void ChangeBinding(InputActions inputAction, Buttons button) { if (_gamePadBindings.ContainsKey(inputAction)) { _gamePadBindings[inputAction] = button; } } // various enumerated actions // (future: maybe seperate input actions for each gamestate into seperate enums?) enum InputActions { MovementLeft, MovementRight, MovementJump, NavigationBack } } I'm using it by creating an instance of InputHandler in my Game1 class, calling InputHandler.Update() in the gameloop, passing it around and hooking up game entity movement methods to the InputHandler events.   Aside from the class itself, any ideas on how to improve the design in terms of where I should instanciate it? Perhaps instanciate it in a StateHandler? Or use seperate instances of InputHandler for each Player? Or should I rather make the InputHandler a singleton? (I keep reading that singletons are evil )   Thanks in advance for taking the time to help a newbie out! Cheers!   Edit: Anyone know if there are any drawbacks to using events for inputs? Does it scale well performancewise? Do I need to worry about timing issues? Any specific buffering techniques I could/should implement?
  5. Ah yes, you're right. Was actually thinking of moving them to the update later on, so i'll change it according to what you guys suggested :)   Thanks for the added explaination.
  6. Lactose (and SeanMiddleditch):   perhaps i'm just slow, or totally just missing something, doesnt this effectively do the same thing (only with reversed declaration)?   // prevState = getStateFromInput(); in class constructor.   pollingMethod() { currState = getStateFromInput();   // polling code goes here   prevState = currState; }   i mean, the polling _does_ work in my handler, i'm checking key down, key held and key released and they all invole their respective events as they should.
  7. Trueerror:   Thanks mate! The purpose of the class is to handle player inputs only. For multiplayer-games I guess the AI could use the input handler aswell, atleast for actions that are shared between human player and AI controlled player. Something I havn't thought off until now, so thanks for bringing it up. As for movement/actions unique to AI, I planned to handle that elsewhere. The handler will only ever handle the inputs for 4 players max, so I guess I won't have to worry about performance.     SeanMiddleditch:   In regards to the KeyboardStates/GamepadStates, I'm not sure why I should move the assignment of the old state, wouldn't it effectively be the exact same thing having it assigned in the end of the method as in the beginning? The rest of your post gave me a lot to think about in regards to the design, especially in terms of abstraction and dynamic bindings. Once I get some more free time I'll have a new look at the handler and try to implement your concept.     Thanks for taking the time guys, I really appreciate it!
  8. elbenko

    15 Good DAWs

    my 5 cents on the topic:   these are the DAWs i'd personally suggest, should anyone ask me what to use for (or atleast get started with) music production. there are plenty more worthy candidates, but these are the ones i'd narrow it down to.   old (as in mature), bit expensive but tried and true industry go-to's with a more traditional workflow: - Logic - Cubase - Pro-Tools   less mature, less pricey, more or less traditional workflow: - Reaper - Studio One   less mature, less pricey, different take on the workflow, emphasis on ease of use, quick prototyping, jamming and live perfomances: (although FL Studio is a bit messy at first glance, luckily there's tons of tutorials on youtube for it) - Ableton Live - FL Studio - Bitwig   1. the more traditional DAWs usually take a bit longer time to get comfortable in. 2. less traditional DAWs, due to their workflow design being geared towards ease of use, usually take shorter amount of time to get comfortable in. 3. cheaper (in DAW universe atleast) doesn't necessarily mean a major difference in quality, although amount of / quality of plugins and added material vary with price tag. 4. mastering how to use one particular DAW adds way more to your production quality than the actual choice of DAW does. 5. mastering different aspects of several DAWs is a good idea, as they excel in different areas.     Ableton Live has a great workflow, but not so good mixing, Logic on the other hand is great for mixing and mastering. 6. best choice of DAW is _always_ the one that makes you most happy working in, no matter which features the competition has that your DAW lacks  :)   good luck, and happy sequencing!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!