Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

464 Neutral

About SonicD007

  • Rank
  1. SonicD007

    Problem setting up SDL with Dev-C++

    Not sure if this is still the case or not but I believe Dev C++ has been abandoned.  Most people recommend using Code::Blocks or Visual Studio.  I've used all three and would say Code::Blocks has better features than Dev C++.  Visual Studio has become my favorite although it can be intimidating at first.
  2. SonicD007

    Unity 2D tiled maps

    Is there any easy way to create tiled maps in unity 2D?  If not, I would like to use tiled to create a map in the tmx file format to then import that tmx file into unity.  I realize I'll probably have to create an importer for unity to be able to understand the file but I'm not sure how to create custom importers for unity 2D.  Is it only available in the Pro version?
  3. SonicD007

    Having trouble accessing an objects properties.

    I'm not 100% sure what the problem your running into is aside from accessing the derived classes data.   You could have character have a virtual method called DoAttack() where each derived class can override it to do whatever they have todo.  Another approach to the problem is to use composition and instead of creating bladewarrior, fistwarrior, drunkenwarrior, you could have a single class called GameMonster (or w.e) which would contain a pointer to another class that has more information on the type of monster it is.   This article should help you. http://gameprogrammingpatterns.com/type-object.html   The cool part about doing it that was is you can have all your different monsters in an xml file and modify attributes without having to recompile.  You can also make sub-monster types without having to specify every attribute and instead have it "inherit" from it's parent monster type.   EDIT: Since it's C# that you're using, you don't have to worry about pointers.  Classes are passed by reference so you can just set your monsters to have w.e monster type you want.   e.g. Monster m = new Monster(); //You could do it the way the article shows as well m.SetType(new FistWarrior());   The only thing is that if you have custom attack patterns or something you would need to do a litle more work.  Maybe something like m.SetBehavior(new WarriorBehavior(WarriorStyle.Fist));   Just an idea, haven't gotten up to that yet in my project
  4. SonicD007

    Input handling design frustration

    I haven't had the time to mess with my project because of finals and it's the busy season at work, but I still need to implement input somehow in my game.  Right now this is holding me back from doing anything else (well mentally it's holding me back because I really want to get input to my game character so I can then implement collision and render my map with the player)
  5. SonicD007

    Gamedev has shown me how I've grown

    Great to see I'm not the only one!   Hodgman's little story made me laugh haha.   Gamedev is definitely the best community I've encountered on the internet.  When the day comes that I finish making my 2d rpg game....everyone here will know xD
  6. I skimmed through the article and it seems they're using extrapolation to smooth out the data.  Someone else can chime in if this is too overkill for what you're doing, but the formula seems to be the formula of a line i.e. y= m(x-x1) + y1   If you've taken calc 1 that formula should be familiar to you (or pre calc) I'm not sure what On-1 stands for in this context, it seems like it's an initial reading.  Maybe it's the first reading that's gotten over the  50 inputs they get?   In is the raw input data which the sensor would give you.  I haven't researched if the SDK gives you the reading filtered or not or if it really is raw data.  You'll have to research that.  Hopefully something on the wikipedia page can help you a bit more.   http://en.wikipedia.org/wiki/Extrapolation   The article is using linear extrapolation   EDIT: From what I gathered, you would use the formula to sample 50 inputs within a given amount of time and average them out using that formula to have a smooth input. alpha (?) would be 0 to 1 which is basically how much smoothing should be done.  It's a constant.
  7. I haven't messed with the motion sensors on the windows phone, but you may need to take average out the inputs as opposed to directly translating the accelerometer input to values.  A person will not move a phone steadily.  The values will constantly move up and down which will cause your motion to be jagged and it will behave weird.    I would take a couple of readings (couple of nano seconds?) and average the readings to see where it's mostly moving towards.  I would then apply that number to the acceleration for my object and update the object within the update(gameTime) method.  As for how you would implement this, I would google how others have done it.  Maybe google "interpolating accelerometer" or something of that sort would help.   EDIT: Actually interpolation ISN'T what you would use here.  See if this helps you out.  Also, I think you may need to call motion.Start() in your initialization code   http://blogs.windows.com/windows_phone/b/wpdev/archive/2010/09/08/using-the-accelerometer-on-windows-phone-7.aspx
  8. SonicD007

    Input handling design frustration

    Okay, so what I've gathered from this is that I'm going about this the wrong way in that my game objects shouldn't handle the input themselves, but rather the game class (whatever class that knows the rules of the game and resources) would handle the input and act upon my game objects accordingly, right? My input class should have a stack of inputs mapped actions/States which are read during a specific point in the game loop each frame.  Maybe something like //inside CGame void CGame::Run() { //Inside while loop of running game //Get inputs input->GetInput(); //Maps raw input to state/action and stores into a structure which is pushed onto a stack.  End of stack gets erased (sidenote: is a stack what I want to use here?)   //This is what I want to do but isn't what should be done from what L. Spiro said //Active context could be inventory, playing field (so input goes to the character), etc. // this->ActiveContext.HandleInput(input->GetInputStack());   //This is the correct way? switch (ActiveContext.ID) { case Context::GAME: //Again, how should I handle the input here?  If I have two buttons pressed I would want a move diagonal, not a move up which then gets changed to a move right when the right arrow is pressed.  I think this is also one of my big issues. break; //Other contexts like inventory }   //Do other logic/rendering (well rendering would go somewhere else in a fixed frame rate loop) }   //Bad way void ActiveContext::HandleInput(inputStruct* inStruct) { //Handle states //I'm not sure how I should do this part. a bunch of if and else can't be good if (inStruct.states.find("UP") //And this is where my design would fail because now ActiveContext needs to know about gameObjects which it shouldn't...hmm... } Let me know if anything I wrote isn't clear or hard to understand.    EDIT: all my tabs got removed for some reason
  9. Hey everyone.  Today I wondered how long I've been programming for.  I started roughly around when I joined this website, so I decided to take a look at when I joined.  Apparently it's been 6 years and I still haven't put out a 2D game similar to Zelda which is my goal.  I have however created a windows phone game, tetris, pong, various tools, and I've learned a ton of information.  What's funny is you can see my first post on gamedev and my posts looked just like the new guys that are posting in the For Beginners forum now.  "Hell I even started a DirectX or OpenGL?" thread back then!  I just found it interesting to see how much I've grown as a programmer (and somewhat in maturity based on my posts that look like a 7 year old wrote it!).   Anyone else notice this about themselves? (specifically with your posts on gamedev)
  10. SonicD007

    How to program a zelda style game

      By all means use mappy if you know it.  I found tiled easier for me to understand which is why I'm using it.
  11. SonicD007

    How to program a zelda style game

    Nice game!   As others have said, you have the skills to create this type of game already.  The basic idea behind it is to use an image file that has 32x32 (or whatever size you want to use) "tiles" in it.  You draw each tile basically the same way you did your animation for sonic (if you had one image that contained all the animations).  The way you would add depth to the game would be using something called Z-order which is just means you draw the ground layer before the collidable layer so things like fences appear above the ground layer. if you want to have a tree cover a player, simply draw the top part of the tree on the sky layer as opposed to the collision layer (where the bark of the tree would be)   I've been trying to make a game like this for years but I keep getting caught up on design issues and whatnot.  I want to make it as perfect as I can which is why I haven't even gotten into the development of the actual game yet.....   Anyway, take a look at Tiled for an easy/opensource way of creating your 2d maps.  Then you can roll your own reader for the xml file that tiled produces, or you can use http://code.google.com/p/tmx-parser/   Let me know if you have any other questions about this style of game.  (Been trapped here forever haha)
  12. SonicD007

    Input handling design frustration

    I understand the virtual functions you're using.  What I'm trying to figure out is if you have something similar to this:   CVortez3DEngineExt::OnChar(UINT c) { Game::playerObject.HandleInput(c); }   or if it's more like CVortez3DEngineExt.TriggerEvent(OnChar('A')); //player object gets a message notifying it of this event to handle input (event delegation? haven't programmed this before so not sure how it would look playerObject.HandleInputEvent(CVortez3DEngineExt::SomeInputStruct); //playerObject.HandleInputEvent would then look at the struct and do stuff based on that   I want to do something similar to the second code box I just wrote out.  I want the player class to do something based on input.  I don't want the input class to tell the player class what to do per say
  13. SonicD007

    Input handling design frustration

    Did you have the objects that needed to handle input register themselves to that class as a listener object and have that class somehow notify the objects that need to react on the input when the event was triggered? 
  14. SonicD007

    Input handling design frustration

      I've never programmed event systems before.  I've used C# events with winforms and understood the concept, but I never sat down and tried to create something similar using c++.     My goal at this point is to have a system where if I press up, my character will move up. If I hold up and right, my character will move diagonally.  Do you think you can post a sample piece of code using your event system just so I can see how you're handling the presses at the object level? I'm interested in how other people have solved this issue.
  15. So I've been reading through this article and messing with it for close to a month (on and off because of work and school) and I understand it for the most part.  I changed the code a bit so I could use SDL_Keycodes for the SetRawButtonState methods and whatnot and got all that working.  My problem comes with the function pointer that InputMapper uses to do any actual work based on the input.  Most likely my brain is just overworked and I can't properly think this through...   So, how would I have my gameObject handle the input that is received?  I want the individual game object to act on the input that was received so how would I do this exactly?   Would I need to do something like this?  If so, how can I also pass the struct that inputMapper uses that holds the information on the actions and states?   inputMapper.AddCallBack(gameObject.HandleInputFunctionPointer, 0);   P.S. I'm rusty with function pointers so that could be my issue.  
  • 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!