• I Left Programming Temporarily ( Because of Physics )
    57 replies, posted
  • Avatar of gparent
  • [QUOTE=burak575;35716809]If goal is learning how to programming advanced stuff it doesn't matter you coding a game, or game engine or a physics stuff. In the end of your projects you will have enough experience to make any of it. And when they are not a challenge anymore, you won't want to make a physics engine or game engine anymore.[/QUOTE] You don't just learn to 'program advanced stuff'. You learn how to write a certain thing. You can't specialize in writing 'hard software', you can't learn techniques to better write 'hard stuff'. Writing a physics engine will not give you the experience to write a game render because both are 'advanced stuff'. If you goal is to learn about programming, learn programming doing something practical that you enjoy. Writing a physics engine just before you write a game won't learn you much more than the other way around, it will just be longer and buggier. Why not write a game and then write a toy physics engine while having in mind what a game expects from a physics engine? Much better idea in my opinion. [quote]I don't believe in argument called "re-inventing wheel" in programming. Since if you don't copy and paste code from other people's works, It wont end up as same wheel. Yeah they will have same purpose ( reducing friction ). But their shapes will be different, their material will be different and they will vary in structures.[/quote] So first you say that re-inventing the wheel doesn't exist in programming. You back this up by saying that reinventing is not copying line-by-line (duh), and then you describe the process of reinventing the wheel, and what kind of fucked up wheel you could end up with. This is exactly what re-inventing the wheel is.
  • [QUOTE=gparent;35719150]Writing a physics engine will not give you the experience to write a game render because both are 'advanced stuff'.[/QUOTE] Actually, you'd be surprised at how much overlap there is between physics and rendering. A big part of rendering is visibility determination; occlusion, frustum culling, etc.. Those are all applications of collision detection, even if it is not usually called as such. You often need to find items within a given range (finding lights for forward rendering, LOD swapping, etc), which means you have to learn to use the same sort of hierarchical space-partitioning structures that are used in both physics and rendering. Further, there is an element of dynamics and actual physics in rendering. Tonemapping algorithms often represent adaptation over time. You've got kinematics in animation and skinning, IK, particle systems and soft-body physics (both of which are best implemented in the rendering pipeline, AFAIK, since general-purpose physics libraries still aren't really suited to these tasks). If you really get into physically-based rendering, then it's a lot of spherical harmonics, monte-carlo (or even regular old analytical) integration, and theory of optics. Long story short, it's all calculus and computational geometry. Learning one [i]does[/i] prepare you for the other, to some extent, even if they are different subjects. It's the same problem-solving processes that go into each. I think the real point is, though, that you have two different sets of priorities, depending on the situation. When you're working on your own time, the path is generally more important than the end result. Your sole focus should be on learning and self-betterment. When you encounter a subject that makes you say 'there's no way that I could ever do that', you should try, because you're almost guaranteed to learn something, even if you don't finish, and you'll probably have a lot of fun along the way. Re-inventing the wheel is as good a means as any to learn these skills. In fact, I think it is even better, in some cases, for the reasons I've argued in an earlier post. Then there's real-world programming. This comes [i]after[/i] and [i]in addition to[/i] the learning stage above. This is when you strongly want to consider using well-tested libraries for anything and everything, since it is likely to be better code than you could produce in a month and maintain for the rest of forever. I generally don't think it is good to try to skip the first stage (i.e. dicking around and re-implementing things you shouldn't; breaking all the rules).
  • Avatar of burak575
  • [QUOTE=gparent;35719150]You don't just learn to 'program advanced stuff'. You learn how to write a certain thing. You can't specialize in writing 'hard software', you can't learn techniques to better write 'hard stuff'. Writing a physics engine will not give you the experience to write a game render because both are 'advanced stuff'. If you goal is to learn about programming, learn programming doing something practical that you enjoy. Writing a physics engine just before you write a game won't learn you much more than the other way around, it will just be longer and buggier. Why not write a game and then write a toy physics engine while having in mind what a game expects from a physics engine? Much better idea in my opinion. So first you say that re-inventing the wheel doesn't exist in programming. You back this up by saying that reinventing is not copying line-by-line (duh), and then you describe the process of reinventing the wheel, and what kind of fucked up wheel you could end up with. This is exactly what re-inventing the wheel is.[/QUOTE] The point is learning how the physics engine internals works. When you learn that you will be easier to deploy another library. Because you would know what you looking for. My points are not applicable for people already experienced in general programming. But people in beginning of their way. Like if you are a company going to make games, which means you have "financial liability" you should make it in shortest time possible and in stable. To quickly gain back your expenses. For accomplish this thing you should use everything ready to use around. Developing your own game engine in this company will be loss of time and money. In the end if its not stable enough it can be catastrophic. Which is "Not Invented Here Syndrome" applicable. But for persons that wants to learn stuff no problem in inventing their own wheels to see how things are work. Also there is a point of time when you got enough experience, when someone describe a problem to you, you can actually see the solution. We could call that "Neo Vision". Like you make a quick list in your brain how solution can be accomplished. Which I gave an example in post above yours. Then you can quickly prototype the options and find a working solution. And yeah when you don't copy line by line, it end up as your version of a wheel. In the process you learn how wheels works, what are the possibilities and capabilities of wheels. So when you need a wheel in future, you will know what you are looking for. Like if you going to rough terrain with that wheel you could add some more carbon and decrease the sulphur from rubber. But for knowing what you need to do, you have to reinvent it. My first wheel was like in a hexagon shape and made of stone. It helped me to see what I were wrong. Also looking other wheels made by different people will not help you find your mistakes earlier. Like you can't learn about how templates works or where to use them or design patterns. And you maybe can't specialize writing "hard software" but you can in "problem solving". You can learn techniques at "solving problems" efficiently. And most of these stuff are pretty much overlaps. Also there is a bonus which is; no one can guarantee you won't going to find a better way to make wheels. Who knows maybe world changing way?
  • Avatar of gparent
  • [QUOTE=ROBO_DONUT;35719549]Actually, you'd ...[/QUOTE] You missed my point. You don't learn to program 'advanced stuff'. 'advanced stuff' is no different to program than 'simple' stuff or 'medium-rare' stuff. If I write a C++ compiler, I won't necessarily be proficient enough to write an operating system kernel just because both are 'advanced stuff'. So like I said, you have to focus on what you want to learn. [QUOTE=ROBO_DONUT;35719549]When you're working on your own time, the path is generally more important than the end result.[/QUOTE] Ridiculous. When you work on your own, what is more important is what you decide is more important. It can be the end result or it can be the path, it depends what you're trying to achieve. Why would I bother writing a physics engine if I literally don't give a shit about it? Learn what you want to learn, not what someone on the internet told you to. [QUOTE=ROBO_DONUT;35719549]Your sole focus should be on learning and self-betterment.[/QUOTE] Again, more orders. No, your sole focus should be doing whatever you want to do. It's your hobby after all, not others'. [QUOTE=burak575;35720452]sjkfnlkajsfasf[/QUOTE] No one said you can't learn by reinventing things, but thanks for your input.
  • Avatar of burak575
  • [QUOTE=gparent;35721268]dsfgdpsfgjsdfg[/QUOTE] I didn't said someone said "you can't learn by reinventing things". But thanks for your output.
  • [QUOTE=gparent;35721268]Ridiculous. When you work on your own, what is more important is what you decide is more important. It can be the end result or it can be the path, it depends what you're trying to achieve. Why would I bother writing a physics engine if I literally don't give a shit about it? Learn what you want to learn, not what someone on the internet told you to. Again, more orders. No, your sole focus should be doing whatever you want to do. It's your hobby after all, not others'..[/QUOTE] Fair enough, but I think this is mostly an issue of miscommunication (perhaps on my part). What I'm trying to say is people shouldn't feel like they have to beat themselves up over getting or not getting things done. Everything is useful experience.
  • Avatar of Natrox
  • I understand OP's concerns but it is perfectly acceptable to use physics libraries. What I do think is that it is important to have a key understanding of how a certain library would work. If you are completely clueless, it is worthwhile to research the library's function, e.g. game physics. This will make you a better programmer in the long run. I personally do not like using libraries when I know little about how they work, but writing your own library just because you do not like to use existing ones is a waste of time unless you have something new to add.
  • Avatar of gparent
  • [QUOTE=burak575;35722356]I didn't said someone said "you can't learn by reinventing things".[/QUOTE] Erm okay? lol. [QUOTE=ROBO_DONUT;35722364]Fair enough, but I think this is mostly an issue of miscommunication (perhaps on my part). What I'm trying to say is people shouldn't feel like they have to beat themselves up over getting or not getting things done. Everything is useful experience.[/QUOTE] Part of the way I'm answering the way I am is that the OP seems to have no experience with C++ and doesn't seem to want to learn physics engine for any other reason except a misguided impression that it is a prerequisite to learning how to make games. I do agree with you that trying to write your own implementation can be a learning experience, no matter how sub par the implementation is.
  • thats the magic about programming. Thats the part that I love about programming, getting desperated about something I cant understand
  • Avatar of LuaGuy
  • [QUOTE=gparent;35731597]Erm okay? lol. Part of the way I'm answering the way I am is that the OP seems to have no experience with C++ and doesn't seem to want to learn physics engine for any other reason except a misguided impression that it is a prerequisite to learning how to make games. I do agree with you that trying to write your own implementation can be a learning experience, no matter how sub par the implementation is.[/QUOTE] I didn't learn just the syntax. I made a lot of practical things to understand C++ better. I dont know how you decided that I have no experience with the language. I'm not that guy who wants just coding games. It's not my only goal. Also I'm very curious about "how things work", "the backbone of the things" as burak575 said.
  • Avatar of gparent
  • [QUOTE=LuaGuy;35732531]I didn't learn just the syntax. I made a lot of practical things to understand C++ better. I dont know how you decided that I have no experience with the language. I'm not that guy who wants just coding games. It's not my only goal. Also I'm very curious about "how things work", "the backbone of the things" as burak575 said.[/QUOTE] It's just the way you worded your first post, "I learned the syntax in 1 week" says a lot about your experience with the language. Don't give up though.
  • Avatar of LuaGuy
  • [QUOTE=gparent;35733279]It's just the way you worded your first post, "I learned the syntax in 1 week" says a lot about your experience with the language. Don't give up though.[/QUOTE] No you are wrong. I said i dived in to game libraries for 1 week. Please read carefully. I'm learning C++ for 1 and a half year. I'm using game libraries for only one week.
  • Avatar of robmaister12
  • The thing about using an external library is that other people have collectively put in a large amount of time structuring, designing, and debugging the library. You'll inevitably fall into a lot of the same pits and experience a lot of the same problems that the other library's developers experienced and spend days, weeks, maybe even months trying to figure out what the problem is or how to better design the system when it's all already been done. My philosophy with these things is that using external libraries is a huge timesaver and pretty much a necessity if you ever want to get things done. I'm working on a game with some friends, they spent 4 months working on a 2d physics engine, eventually I said fuck it, replaced it with Farseer physics, and the result was more stable and accurate physics that operated much quicker, and it was working in a half hour instead of not working even after 4 months. It's fine if you want to learn how a physics engine works, but IMO it's far better to look into an existing physics engine, really look into how it works and maybe even contribute back to the project a bit. If you're just learning and don't have the intentions of making a game anytime soon, then yeah go ahead and make your own physics engine to learn.
  • Avatar of Zero-Point
  • [QUOTE=DrLuke;35716768]Burak: The point of all this is the goal you persuade: Do you want to create a game, or a physics engine? Creating a physics engine just for your game is reinventing the wheel unless it requires special features other engines don't offer.[/QUOTE] I don't code, but I agree with this. I tinker with robotics every now and again (or at least I used to), and I would personally just buy a pre-built motor that's close to what I want rather than try and build my own from scratch, unless of course that was literally my only option assuming there was nothing on the market that could do what I wanted it to.
  • I feel the same way. I try to use a physics library, but their tutorials/documentation only does so much for me. They all say to go read some 1200 page math book if you don't understand a few concepts, which tells you to go read another 1200 page math book, which also tells you to go read another 1200 page math book. There's all these concepts, like "Normals", "Broadphase collision", "Axis Aligned Bounding Box Collision", etc that if you don't understand you just can't do anything interesting with the physics engine like knowing from what direction a body collided from and which point on the other body did it hit? There's just so much physics math and formulae to learn, understand, and memorize before you can do anything half interesting it seems and that's 'caused me to just give up on programming. I had planned to read books on Algebra, Geometry, Trigonometry, Pre-Calc, Calc, Linear Algebra, but that's just so much work to do some of the seemingly simple things I want to do. Forums don't help either 'cause no one really cares to explain anything to you, they just point you to some vague article which tells you if you don't understand this one concept you need to read this book about 1342 difference concepts. It feels like an infinite loop(No pun intended.)
  • [QUOTE=NaturalDre;35792557]I feel the same way. I try to use a physics library, but their tutorials/documentation only does so much for me. They all say to go read some 1200 page math book if you don't understand a few concepts, which tells you to go read another 1200 page math book, which also tells you to go read another 1200 page math book. There's all these concepts, like "Normals", "Broadphase collision", "Axis Aligned Bounding Box Collision", etc that if you don't understand you just can't do anything interesting with the physics engine like knowing from what direction a body collided from and which point on the other body did it hit? There's just so much physics math and formulae to learn, understand, and memorize before you can do anything half interesting it seems and that's 'caused me to just give up on programming. I had planned to read books on Algebra, Geometry, Trigonometry, Pre-Calc, Calc, Linear Algebra, but that's just so much work to do some of the seemingly simple things I want to do. Forums don't help either 'cause no one really cares to explain anything to you, they just point you to some vague article which tells you if you don't understand this one concept you need to read this book about 1342 difference concepts. It feels like an infinite loop(No pun intended.)[/QUOTE] I've made dozens of different little games, most of which contained some form of physics without knowing any of the things you mentioned, and without using a library. Most of it you can figure out yourself.
  • Avatar of robmaister12
  • [QUOTE=NaturalDre;35792557]I feel the same way. I try to use a physics library, but their tutorials/documentation only does so much for me. They all say to go read some 1200 page math book if you don't understand a few concepts, which tells you to go read another 1200 page math book, which also tells you to go read another 1200 page math book. There's all these concepts, like "Normals", "Broadphase collision", "Axis Aligned Bounding Box Collision", etc that if you don't understand you just can't do anything interesting with the physics engine like knowing from what direction a body collided from and which point on the other body did it hit? There's just so much physics math and formulae to learn, understand, and memorize before you can do anything half interesting it seems and that's 'caused me to just give up on programming. I had planned to read books on Algebra, Geometry, Trigonometry, Pre-Calc, Calc, Linear Algebra, but that's just so much work to do some of the seemingly simple things I want to do. Forums don't help either 'cause no one really cares to explain anything to you, they just point you to some vague article which tells you if you don't understand this one concept you need to read this book about 1342 difference concepts. It feels like an infinite loop(No pun intended.)[/QUOTE] Game programming pretty much requires geometry, trigonometry, and some basic linear algebra (you could probably get away with just learning about vectors, matrices are super-useful though). You really don't have to understand or memorize everything about how the physics engine works, you just have to know enough to be able to manipulate it, and that's barely any math at all. The broadphase a physics engine uses should just be an implementation detail you don't care about. Surface normals are useful for most areas of game programming from physics to graphics to AI and you should really know what they are. You'll rarely be dealing with an AABB outside the physics engine but it's still a nice concept to know about. I'll explain all of them anyways: A "normal" is a vector that points outwards from a surface and is very helpful in various calculations. A "broadphase" is a system used to determine whether two objects are near each other. Checking collisions is a pretty expensive operation and it's something you want to avoid as much as possible. If you had 100 objects in a physics simulation, checking every pair of objects for a collision means you have to run 10,000 collision checks. If you remove duplicate pairs (checking A and B, then B and A) and checking against itself, you are left with about 5,000 collision checks. Now let's say that your objects are spread across a larger map. Using some sort of data structure, you can split those objects up in a way that groups objects that are in the same general area together. From there the number of collision checks is going to be a few hundred most of the time. An AABB just describes the maximum and minimum points of an object. It's useful because it can speed up collision checking for objects that are near each other but not quite touching. If the bounding boxes aren't intersecting then the objects aren't colliding. Since all AABBs are aligned to the same axes (X, Y, and Z axes) checking for intersection is very simple: (a.xMax > b.xMin && a.xMin < b.xMax && a.yMax > b.yMin && a.yMin < b.yMax && a.zMax > b.zMin && a.zMin < b.zMax) If you're having trouble grasping these concepts, it's only going to get harder when you try to write a physics engine and you have to start dealing with integration and tons of linear algebra. [editline]2nd May 2012[/editline] If you're working in 2d though, things become a lot simpler because most of the linear algebra drops out. An AABB becomes easier to visualize in 2d, surface normals are much easier to calculate, and broadphase methods become simpler. You can still write really basic physics without any of those things. I actually did that for my Ludum Dare 22 entry a while back (but I did use AABBs as my only form of collision checking): [url]https://github.com/Robmaister/RoversSpirit/blob/master/RoversSpirit/Physics/PhysicsManager.cs[/url]
  • Avatar of mikkeljuhl
  • [QUOTE=ryandaniels;35702397] I want to stress this: [B]BAD[/B] programmers insist on doing everything themselves.[/QUOTE] I disagree, I think this will be bad engineers. I agree somewhat, you have to know how to do it at least. You have to know how to code and to be honest he doesn't sound as if he actually does. One week of diving into game libraries, bitch please.
  • Avatar of newbs
  • I have a minor in math and have taken college physics with integrated calculus... Trust me, you DO NOT want to waste your time programming your own library.
  • Avatar of gparent
  • [QUOTE=mikkeljuhl;35798182]I agree somewhat, you have to know how to do it at least.[/QUOTE] No you don't. It can be of minor help in difficult situations, but you don't.
  • Avatar of W00tbeer1
  • [QUOTE=LuaGuy;35702294]Thank you, but I dont wanna use readymade things. I cant feel like a real coder in that way.[/QUOTE] V = D / T
  • Avatar of Nick Nack
  • [QUOTE=LuaGuy;35702294]Thank you, but I dont wanna use readymade things. I cant feel like a real coder in that way.[/QUOTE] >Implying using a programming language with any existing functions at all isn't using readymade things.
  • Avatar of RP.
  • A good programmer is a programmer who have mastered the art of Copy+Paste.
  • [QUOTE=RP.;35833950]A good programmer is a programmer who have mastered the art of Copy+Paste.[/QUOTE] DRY?
  • Avatar of newbs
  • A real coder/hacker knows the important lesson of not reinventing the wheel.
  • Avatar of Ploo
  • An analogy for this would be something along the lines of a scientist wanting to develop a new product but deciding he's not going to rely on the available scientific knowledge of the world and instead he's going to discover everything by himself again.
  • Avatar of burak575
  • [QUOTE=Ploo;35910996]An analogy for this would be something along the lines of a scientist wanting to develop a new product but deciding he's not going to rely on the available scientific knowledge of the world and instead he's going to discover everything by himself again.[/QUOTE] Scientist is someone already should know about everything what he going to do. But until he become scientist he have to learn and experiment about basic physics, chemistry, biology a lot of stufffff invented, discovered hundreds of years ago. So if you don't have the knowledge required to make a new product everything you make for learning shouldn't count as re inventing wheel.