• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

143 Neutral

About NinjaMonkeyPirate

  • Rank
  1. Some pointers required for new programmer

    The best way to learn is to just try it the way you think it should work. To plan things out a little, but don't overdo it. You'll probably do it wrong, but that's OK, there's no better way to learn. Remember, making a game is an iterative process, you're (wall, almost) always going to have to go back and redo/modify things, no matter how well you put them together the first time, so don't be afraid to do something wrong, just learn from it. Now some original advice, here's the two things I wish I had done when I first started: 1) Pick a naming convention and stick with it. Don't name one variable int globalVar1, and another int gGlobal_var2. It doesn't really matter what convention you use, just pick one and stick to it(this will save you some headaches). 2) Leave plenty of good comments. Take an extra 30 seconds to write two sentences describing what a function does if it is even the slightly bit confusing. You'll appreciate it later.
  2. Debug Mode vs Release Mode C++

    Not in Visual Studio, at least not with the default options. It usually just breaks into assembly code somewhere. As others have said, Debug apps will generally be more forgiving, since they're intended to be used while you're still working on your program, whereas release is the final, faster, smaller build. Usually Release builds aren't built with debug info(or alot less) to make them more efficient. For your problem, it sounds like you're going to have to do some good ol' fashion testing and debugging. Find out where you are crashing or what steps to take to make it crash on release, then reproduce in the debug build and find the problem. If it's not crashing in a debug build, you might trying changing your compile settings and see if you can't get a more Release-type build with some debug info to help you narrow it down.
  3. So how do the pros really do it?

    The way I've seen it done is to have all of your platform-specific stuff (fileIO, user input, GL, etc) abstracted out to a namespace "Platform" or something similar. Then, write your game code based upon that and for each platform write an implementation of lib Platform to link in. You might also have a #define PLATFORM_XXXXX for you engine too. It's difficult to keep clean, but properly abstracted, it can be done neatly, so that most of the engine code is separate from the platform-specific stuff.
  4. Which one Dynamic Link or Static library?

    Here's how to set up a project to build as a library in Visual Studio: First, Open the solution file. Right-Click on the project you want to make into a lib and select properties Under "General", set the Configuration Type: To see/change the output file, go to the linker settings: To link the library in to your source files, you can the do the #pragma thing, but I think it's much cleaner to set up the project to include the libraries since you're using VS already. this way, you can have one solution that has the library project to build and the "game" project that includes that library. Also, all of your libraries are in one place and easy to find/change. And finally, make sure you set up the directory to find the libraries in:
  5. Most amazing game idee

    If you really want to make a game but you yourself have no actually game-making expertise (though it sounds like you may be a business-person) there's really only one way. You'll have a to hire a development studio to make it for you. This isn't anything new, a lot of games are made this way. Call up studio, have them sign and NDA and discuss the project at length to figure out what it'll take to get it done. This place is more for indie/homebrew/hobbyist games than large-scale productions like you are probably thinking of.
  6. Unity iphone game development

    Sounds like a Whacka-a-Mole type game, right? That sort of thing could be done in a UIView with UIView animations pretty easily. You shouldn't need a whole engine unless you are planning to do more than one game, or have physics or online stuff. For something this simple(if it is indeed a small project like it sounds) you might just be adding a whole extra layer of complexity/stuff to learn. Actually, now that I think about it, I'm pretty sure the UIView animation has a callback onAnimationFinished that passes a BOOL for whether or not the animation was finished. Meaning, you could start an animation [UIView beginAnimations], and if the player taps, start a new animation, then the first animmation's done callback would call with the finished param as false. A bit about the engines. I've used Torque(2D and 3D) for the iPhone, and the source is definitely included. For the 2d though, it comes out to $750 total if you don't already have the PC license, and the the initial setup can be a bit daunting if you haven't used the iPhone or Torque products before, so I wouldn't recommend you use it for your first project. [Edited by - NinjaMonkeyPirate on December 24, 2009 4:01:49 PM]
  7. How to Subtly Guide Players

    Great idea: Have a little fairy pipe in every two minutes to tell you where you should go. But seriously, check out this topic it might ideas you can use.
  8. Scoring system using SDL

    I still prefer using sprintf() (or snprintf() as the article recommends, sorta) to using streams. Why? Clarity. I can look at a printf()'s input and almost immediately know what it's output should be, streams not so much. Of course, you have to be intelligent about your buffer sizes but that's a bit like saying cars are tricky to use because you have to always remember to put gas in them. :p
  9. Pointers. Why?

    Here's a simple example, albeit one that is more for educational purposes than actual real use; Say you're making a platformer game, where the player can run and jump. Let's assume you have a game controller with a DPad and A and B buttons, and you game code has a classes for Joystick, Button and Player to control them, something like this: class Joystick { public: Button B; Button A; }; class player { public: Joystick joystick; }; Joystick Joystick1; Player Player1; Imagine that these class do everything you'd expect them to do, there's obviously a bunch of code required, but this just imagine it all works for the sake of this example. You might have some code like this: void CheckForPlayerJump() { if( Player1.joystick.B.isPressed() ) { Player1.Jump(); } } This says, if player 1's joystick tells me they pressed the b button, make the player jump. Simple right? Well what if the player changes the settings so that you the A button is the jump button? How would you do that? Here's how you could without pointers: //Player uses the options screen to map the jump button to A which //sets JumpButtonIsB to true void CheckForPlayerJump() { if( JumpButtonIsB ) { if( Player1.joystick.B.isPressed() ) { Player1.Jump(); } } else { if( Player1.joystick.A.isPressed() ) { Player1.Jump(); } } } Notice that we have the exact same code for A or B, with the exception of which button does the action. Now, here's how you might do that same thing with pointers: Button *Player1Jump = &Joystick1.B; void CheckForPlayerJump() { if( Player1Jump->isPressed() ) { Player1.Jump(); } } See how the jump-checking function doesn't have to know what button is used for jumping? All it knows is that some button is used, it doesn't care which one. Ever played a game where you could assign any key to any action? What if instead of a controller, you had a Keyboard class? Without pointers you might have something like this: void CheckForPlayerJump() { if( JumpButtonIsQ ) { if( Keyboard.Q.isPressed() ) { Player1.Jump(); } } if( JumpButtonIsW ) { if( Keyboard.W.isPressed() ) { Player1.Jump(); } } if( JumpButtonIsE ) { if( Keyboard.E.isPressed() ) { Player1.Jump(); } } ...//'til we get all the letters } So you'd have to check every single key this way. Now you might say "Couldn't I just put all the keys in an array and have an int to tell me which to use?" You sure could, but what if the objects were not in an array? What if a variable is given to you from a function? What if you don't know exactly what button is pressed? here's how you might do that with pointers: KeyboardKey *Player1Jump = &Keyboard.Q;//or whatever the user picks void CheckForPlayerJump() { if( Player1Jump->isPressed() ) { Player1.Jump(); } } Simpler, no? Now imagine we have two Players who can set their button preferences however they like, which of these is better: No pointer: void CheckForPlayerJump() { if( Player1_JumpButtonIsQ ) { if( Keyboard.Q.isPressed() ) { Player1.Jump(); } } if( Player1_JumpButtonIsW ) { if( Keyboard.W.isPressed() ) { Player1.Jump(); } } if( Player1_JumpButtonIsE ) { if( Keyboard.E.isPressed() ) { Player1.Jump(); } } ...//'til we get all the letters for Player 1 if( Player2_JumpButtonIsQ ) { if( Keyboard.Q.isPressed() ) { Player2.Jump(); } } if( Player2_JumpButtonIsW ) { if( Keyboard.W.isPressed() ) { Player2.Jump(); } } if( Player2_JumpButtonIsE ) { if( Keyboard.E.isPressed() ) { Player2.Jump(); } } ...//'til we get all the letters for Player 2 } Or with pointers: void CheckForPlayerJump( Player *p ) { if( p.joystick.JumpButton->isPressed() ) { p.Jump(); } } CheckForPlayerJump( Player1 ); CheckForPlayerJump( Player2 ); Much simpler. Also note, how the CheckForPlayerJump doesn't even know wick player it is using, it can work for any player. One of the benefits of pointer is flexibility. You don't need to know exactly which object you are dealing with, you just need to know what type it is. When you are first starting out, that might not seem like a big deal, because all the programs in your book only have 2 or 3 objects. But when you are dealing with a game that has dozens, hundreds or thousands of objects, most of which are probably created on the fly, it's all but impossible not to use pointers. Basically, one use of pointers in games is to deal with similar things in the same way, without having to hard code each one. Look up "Abstraction" on Google or Wikipedia to see why this is a good thing. Another reason is that, when passing an object into a function, the entire object is copied to a local variable within that function. Passing a pointer to an object into a function just references the original object, without copying it. This means two things; 1) No needless copying, which can take a while depending on how bit the object is and, 2) You can modify the original object in the function Your book had you use vectors and pointer instead of arrays, which isn't that big of a difference so you're right about that case being a bit unnecessary. But image if there was no array, that all those objects were created at run-time and just put into the vector. [Edited by - NinjaMonkeyPirate on December 7, 2009 5:42:41 PM]
  10. Scoring system using SDL

    Converting a integer to a string? sprintf, is your new best friend when it somes to formatting text. In your case, you'd do something like this: char buffer[50];//note that 50 is just an arbitrary value in this case sprintf (buffer, "%i", myScore); //or sprintf (buffer, "Player: %i, Opponent: %i", playerScore, opponentScore); SDL_Surface* message = TTF_RenderText_Solid( font, buffer, textColor );
  11. Should You Ever Explain Your Game's Design?

    Reminds me of that Futurama episode where they do an episode of TV show so that aliens won't destroy Earth: "But that's not why people watch TV. Clever things make people feel stupid, and unexpected things make them feel scared." -Fry People want new and clever things in games, but they really just want the same thing made to look new, with maybe a small amount of actually different things. I just played through the whole Metal Gear Solid series, and when I got to part 4, I didn't like it until sometime after the first Act because the controls were so different. The core mechanics of the game were same, but the interface was very different and it threw me off. If the series wasn't so popular(and to be fair, it was very well done and polished so maybe not), I think it might have gotten a number of bad reviews for such a dramatic change, even though the underlying game was still largely the same. Another example, I though Assassin's Creed was an awesome game, but it got some bad reviews because the controls were so different from similar types of games. At first I didn't get the control scheme, but after playing it for a while it didn't bother me. The reason I think, is that people get comfortable with one way of doing a certain thing, and changing that makes them uncomfortable, and since people don't like change, they sometimes just write it off and don't bother to play it for what it is. Then, they might end up missing out on something they would otherwise like because they are stuck in one mode of thought. So in the case of game design, Having something different than expected will probably cause player frustration, even if it's a good design. You could "warn" players in advance, but if it's too different they might lose interest. You might solve this by saying "It's a classic RTS with a twist" or "An action-adventure with some strategy thrown it" so as to warn the player what to expect using the limited language of genre types
  12. How to handle line-of-sight (2D)

    I think Drigovas's idea with the rays will work, I'll just have to be careful to not put any overly complicated obstructions (that would probably be weird anyway). Thanks!
  13. Making the sprite jump in a curved path

    Probably the change in time since the last update (Delta Time).
  14. So I have this idea of a 2D side-scrolling shooter with a bit of a stealth aspect. You run around and shoot the bad guys, but if any of them see you, or see another bad guy get shot, they raise an alert. However, certain things will obstruct their view. Think Metal Slug meets Metal Gear. So I have the following scenario: The player is on the left and a bad guy on the right, the black bar is some thing the bad guy cannot see through, the green/red cone is the line of sight of the bad guy. The red is where he can currently see, the green is where he would see if the obstruction was not there. Given this, what's the best way to tell if the player is visible to the bad guy? Here's what I've got so far; The bad guys have an extra collision polygon shaped like the cone that keeps track of what object are inside it. When a player enters, check all the other objects in the polygon and see if they are between the player and the bad guy,m if so, check if the object is as tall as the player, if so, he can be seen, otherwise not. The main problem with this method is that it cannot handle if the bad guy's view is only partially obscured, and I want to have some parts where the player must duck behind something to avoid being seen.
  15. Freeware compilers & code editors

    Visual Studio (even the Express versions) are tops, and pretty much standard for Windows-based development. You can also try GCC for just a compiler and hook it into a text editor like Programmer's Notepad(my favorite), Crimson Editor or Notepad++(open source)
  • Advertisement