|
Edited out, problem solved.
LightReaper fucked around with this message at 16:03 on Apr 19, 2010 |
# ? Apr 13, 2010 23:14 |
|
|
# ? May 13, 2024 01:00 |
|
LightReaper posted:That fixed it up a treat, you are a legend! Can't believe I overlooked something so simple but that seems to be the case almost always when coding. Glad you got it working. I'll let someone else help with your next problem. It's a bit more involved unless you can find some prewritten code that works.
|
# ? Apr 14, 2010 04:44 |
|
LightReaper posted:Collision stuff What I'm going to explain is all 2D stuff, but I think it works the same way in 3D. What you're going to want to do is project the circle's center onto each side of the rectangle you're colliding with. This is done by...hmm I wonder if I can explain this without visual aids. You need to imagine there's a triangle between your circle's center, a corner of your rectangle (that's part of the side you're projecting onto), and the point on the rectangle's side that's closest to your sphere, which we don't know yet. Ah crap here's some code. code:
Handling collision is a whole new bucket of...beans? I don't know, it's late. Anyway. That involves stopping the sphere at exactly the point of collision, then imparting force on it to simulate 'skidding' across the box. I can't explain that too well. Morpheus fucked around with this message at 09:05 on Apr 14, 2010 |
# ? Apr 14, 2010 09:01 |
|
I recommend you do a little research on how dot products work, and why they are used here. I know when I had to solve a similar problem (in 2D) the first time I was confused as gently caress. I had no idea why it worked, or what changes I would need to make to fix or modify anything. Once I got what a dot product did to vectors, it become a trivial piece of code.
|
# ? Apr 14, 2010 16:13 |
|
Pfhreak posted:I recommend you do a little research on how dot products work, and why they are used here. I recommend taking MIT Linear Algebra (18.06) OpenCourseWare. Linear algebra is the most important thing to understand if you are making a game. It'll help you more than just learning about the dot product.
|
# ? Apr 14, 2010 19:26 |
|
Edited out, problem solved.
LightReaper fucked around with this message at 16:03 on Apr 19, 2010 |
# ? Apr 14, 2010 20:51 |
|
So I finally got my image to load using FreeImage without crashing, but it's not drawing correctly when I try to apply it as a texture. It makes the spheres I'm trying to draw around it completely black. My code:code:
|
# ? Apr 14, 2010 22:35 |
|
Stavros posted:So I finally got my image to load using FreeImage without crashing, but it's not drawing correctly when I try to apply it as a texture. It makes the spheres I'm trying to draw around it completely black. My code: Are you specifying the texture coordinates at each vertex?
|
# ? Apr 14, 2010 23:53 |
|
There are a lot of things that could be going wrong there. Did you bind a texture before uploading it?
|
# ? Apr 15, 2010 01:01 |
|
Yeah I'm pretty sure it's the lack of texture coordinates. From what I read, it looks like you call glTexCoord functions during creation of vertices. I used glutSolidSphere to make spheres that I'm trying to texture, so I think I need to implement my own spheres with vertices before I go about texturing.
|
# ? Apr 15, 2010 04:31 |
|
Edited out, problem solved.
LightReaper fucked around with this message at 16:04 on Apr 19, 2010 |
# ? Apr 15, 2010 05:13 |
|
I'm new to games programming / XNA and I'm a bit stuck with using animated sprites, or at least resting an animation once it hits its final frame. Am I wrong for assuming the following code shouldn't loop the animation if the last frame in the set (as defined by LastFrame) has already been drawn? When I compile, the animation is continuously looping, when it should stop after the third frame. code:
gwar3k1 fucked around with this message at 12:33 on Apr 16, 2010 |
# ? Apr 16, 2010 12:12 |
|
oh MasterSlowPoke fucked around with this message at 12:35 on Apr 16, 2010 |
# ? Apr 16, 2010 12:29 |
|
I'm trying to make a user input manager that would scan the keyboard/mouse, match keypresses or mouse movements to a set of allowed player commands, and then raise events corresponding to those commmands. For example if the W key is pressed then raise the PlayerMovedForward event and have the Player object consume the event by changing the player position. Simple cases like the one described above are easy enough to implement. Things get much more complex when I try to add in features like custom control mapping, allowing multiple different inputs to trigger the same action, or having a UI element that triggers actions when clicked on. My attempts so far to just brute-force a solution end up tightly coupling the different objects in the program which makes it difficult to add new stuff. Are there any standard 'best practice' type ways to handle user input in a general way? It seems like this should be a problem with a well-known solution since every game has to have a user input system, but so far most everything I've found on the web is just hard coding whatever WASD type controls they are using into the Update loop.
|
# ? Apr 19, 2010 20:31 |
|
Why not write a mapping that takes raw keys and returns actions? I mean, all you have to do is have a dictionary that takes "KEY_W" and turns it into "MovedForward". It gets a little more complicated if you want to support joysticks though (the joystick would handle all movement, not just forward movement). That's easy too, though. Just register sets of keys as your "movement" keys, e.g. WASD => Move.
|
# ? Apr 19, 2010 20:34 |
PDP-1 posted:I'm trying to make a user input manager that would scan the keyboard/mouse, match keypresses or mouse movements to a set of allowed player commands, and then raise events corresponding to those commmands. For example if the W key is pressed then raise the PlayerMovedForward event and have the Player object consume the event by changing the player position. Why don't you use a map or something similar. That way you have configurable keys and they can call the same event. Let the UI element call the event by it self when it's clicked. I don't know why you would to want to code that into the input manager.
|
|
# ? Apr 19, 2010 20:38 |
|
Avenging Dentist posted:Why not write a mapping that takes raw keys and returns actions? I mean, all you have to do is have a dictionary that takes "KEY_W" and turns it into "MovedForward". It gets a little more complicated if you want to support joysticks though (the joystick would handle all movement, not just forward movement). That's easy too, though. Just register sets of keys as your "movement" keys, e.g. WASD => Move. For simple cases you can just map Keys->Actions and Actions->Events and then chain the two maps to get Keys->Events. That part isn't a problem. The problem is trying to mix different input types, like the keyboard/joystick in your example. The difference between joystick and keyboard inputs is that the joystick returns an analog value while the keyboard key is just pressed/not-pressed, so you have two different sets of event arguments - JoystickEventArgs and KeyboardEventArgs. Both the event source and handler have to agree on how these EventArgs classes are defined, so the Player class and the UserInputManager class are no longer independent. It's not the end of the world to have to couple the classes together a little bit, it just struck me as inelegant and I figured I'd check around to see if there was some better solution. Lurking Haro posted:Let the UI element call the event by it self when it's clicked. I don't know why you would to want to code that into the input manager. My thought was that the input manager would be the only thing checking the mouse state to detect a click and then it would pass some kind of "the user clicked you at location X,Y" to the UI element to let it figure out what to do from there.
|
# ? Apr 19, 2010 21:34 |
|
PDP-1 posted:The difference between joystick and keyboard inputs is that the joystick returns an analog value while the keyboard key is just pressed/not-pressed, so you have two different sets of event arguments - JoystickEventArgs and KeyboardEventArgs. Why would you need that? Like I said, register grouped keys together. Then when you hit WASD, it creates a coordinate pair in [-1,1] x [-1,1] just like a joystick would. The only difference is that you'll always have 1, 0, -1 as values. The movement case is actually one of the easier ones, since in reality you don't want to do it as an event, since the state generally persists across frames (i.e. if you hold W, you keep moving forward, and when you stop holding W, you stop moving). This is markedly different from event-based keys like the (semi-auto) "fire" button, where you tap it each time you want an event to occur. That is, with movement you're concerned about the state of the button, not the change in state. Avenging Dentist fucked around with this message at 21:43 on Apr 19, 2010 |
# ? Apr 19, 2010 21:38 |
PDP-1 posted:For simple cases you can just map Keys->Actions and Actions->Events and then chain the two maps to get Keys->Events. That part isn't a problem. The problem is trying to mix different input types, like the keyboard/joystick in your example. Why not use analog movement events for the keyboard as well? The corresponding keyboard key simply has a set value. ^^^^^ What he said Lurking Haro fucked around with this message at 21:46 on Apr 19, 2010 |
|
# ? Apr 19, 2010 21:42 |
|
Avenging Dentist posted:Why would you need that? Like I said, register grouped keys together. Then when you hit WASD, it creates a coordinate pair in [-1,1] x [-1,1] just like a joystick would. The only difference is that you'll always have 1, 0, -1 as values. Lurking Haro posted:Why not use analog movement events for the keyboard as well? The corresponding keyboard key simply has a set value. Ah, I get it now. This is definitely an interesting idea and I'll give it a try. Thanks for the suggestions, both of you.
|
# ? Apr 19, 2010 21:51 |
|
Can you guys recommend some game engine specific books that are any good?
|
# ? Apr 21, 2010 15:51 |
|
The_Frag_Man posted:Can you guys recommend some game engine specific books that are any good? http://www.gameenginebook.com/ This one is the best I've read in terms of general 3D game engine construction. If you're looking for a specific topic I really like the Morgan Kaufman series in 3D technology. For some reason the following link doesn't include the AI book and a few others. http://www.elsevier.com/wps/find/bookdescription.cws_home/BS_M038/description#description
|
# ? Apr 21, 2010 23:25 |
|
ChadyG posted:http://www.gameenginebook.com/ Thanks for the recommendation. I've actually bought this a week ago but haven't begun reading it yet.
|
# ? Apr 22, 2010 10:29 |
|
I know this was from a couple pages ago, but the Blender 2.5 alpha's interface is really nice. Every command can be found through a type-to-search interface. So if you know you need to extrude, use the search to type "extrude" to find the shortcut key or just use the function from there. I don't know how stable it is, though. I like it much better than Maya, which I find to be as cryptic as anything else.
|
# ? Apr 22, 2010 18:03 |
|
Does anyone know what is going on with the XNA 4.0 release? A developer blog from March 9 said that it would be coming out 'within a month' but as of today the download page only shows a preliminary version targeted at the Windows Mobile 7 platform.
|
# ? Apr 23, 2010 03:48 |
|
PDP-1 posted:Does anyone know what is going on with the XNA 4.0 release? A developer blog from March 9 said that it would be coming out 'within a month' but as of today the download page only shows a preliminary version targeted at the Windows Mobile 7 platform. I recall reading that when they said "within a month" they were referring to exactly that, a preliminary version targeting the Windows Mobile 7 platform. Apparently the full version, with support for the 360, is meant to be released about six months from now.
|
# ? Apr 23, 2010 11:05 |
|
I'm starting to mull over what language / development environment to use for a graphically intense 2D game. I'd love to use Python, but I'm not too clear on what kind of capabilities it has in terms of utilizing modern graphics cards. Is it possible to, for example, make a game like Braid in it? i.e. a game that makes use of multiple parallaxing layers consisting of sprites, high resolution static graphics, polygonal objects, and advanced shader features? There's tons of game engines for Python but it's hard for me to figure out if any of them are useful for making a game like that.
|
# ? Apr 26, 2010 18:03 |
|
You can do all of that except possibly the shaders in Python, so if you're just getting into game dev should be fine. I wouldn't be surprised if it can do shaders anyway and I just don't know about it.
|
# ? Apr 26, 2010 18:08 |
|
Has anyone used Game Maker software? I'd like to make some simple games, and my knowledge of programming goes no further than a year of college C++ that were taken almost a decade ago. I'm not trying to recreate anything as pretty as Crysis or whatnot. Maybe something like a really basic version of Civ or whatever.
|
# ? Apr 26, 2010 23:39 |
|
XNA and C# is always a great place to start. You can do some pretty fancy things in it, and it's very well documented.
|
# ? Apr 26, 2010 23:41 |
|
DeathBySpoon posted:XNA and C# is always a great place to start. You can do some pretty fancy things in it, and it's very well documented. What are the pros and cons of this versus Game Maker? Also, the C# development software isn't free, is it?
|
# ? Apr 26, 2010 23:56 |
|
Iron Squid posted:What are the pros and cons of this versus Game Maker? Also, the C# development software isn't free, is it? Knowledge of C# and XNA is actually applicable to getting a real job. And no, C#/XNA is completely free unless you plan to develop for the Xbox 360.
|
# ? Apr 27, 2010 00:01 |
|
Also Game Maker is bad.
|
# ? Apr 27, 2010 00:05 |
|
Bakkon posted:Knowledge of C# and XNA is actually applicable to getting a real job. And no, C#/XNA is completely free unless you plan to develop for the Xbox 360. I have no desire to get a job designing games. I thought MS charged for Visual Studio.
|
# ? Apr 27, 2010 00:20 |
|
Iron Squid posted:What are the pros and cons of this versus Game Maker? Also, the C# development software isn't free, is it? Game maker is far too simple to do anything vaguely civ-like. Game maker is appropriate for games on the complexity level of simple platformers.
|
# ? Apr 27, 2010 00:21 |
|
Visual Studio is free unless you want features like a button to restart a debug run.
|
# ? Apr 27, 2010 00:23 |
|
Nippashish posted:Game maker is far too simple to do anything vaguely civ-like. Game maker is appropriate for games on the complexity level of simple platformers. XNA looks better the more I look at it. If I code a game for Windows with it, is it pretty easy to port over to the Xbox? I'm assuming it is. Now to find a high-end graphic designer who will work for free with only an iffy promise of a percentage of profits at some vague point down the road!
|
# ? Apr 27, 2010 00:29 |
|
Iron Squid posted:I have no desire to get a job designing games. I thought MS charged for Visual Studio. If you want to try it out the things to download are: 1) Visual Studio Express 2008 C# Edition 2) XNA Game Studio 3.1 Install those and then check out some of the tutorials, like this one for 2D games.
|
# ? Apr 27, 2010 00:35 |
|
Iron Squid posted:I have no desire to get a job designing games. I thought MS charged for Visual Studio. Good because most people won't hire you for game programming if all you know is C# either.
|
# ? Apr 27, 2010 00:48 |
|
|
# ? May 13, 2024 01:00 |
|
Avenging Dentist posted:Also Game Maker is bad. Um, anything that can produce Barkley Shut Up and Jam: Gaiden is good in my book
|
# ? Apr 27, 2010 00:49 |