# Chirieac

Members

21

147 Neutral

• Rank
Member
1. ## Custom ball physics - velocities after bounce

Hi, I'm trying to write my own physics for a soccer ball in Unreal Engine 4. I can't use PhysX because I need to predict the ball future location taking drag and other factors into account, and UE doesn't use a fixed timestep which would make the physics more deterministic. Having my own simulation for it I can advance it easily in the future. Without angular velocity, I have the ball bouncing correctly using a restitution coefficient and coming to a rest properly. What gives me issues is the angular velocity. The ball should rotate after impact collision and the spin of the ball should modify the bounce direction if it was rotating really fast. For example, if you put a back spin to the ball and through it in front of you, the ball should come back to you. I've searched around and tried different solutions but nothing worked properly. My latest try was to implement Coulomb friction based on Glenn Fiedler's article: http://gafferongames.com/virtual-go/collision-response-and-coulomb-friction/ Using those formulas I actually made the ball change direction after impact based on its angular velocity. The problem is that the angular velocity is not changed properly after impact, so with each bounce the ball jumps further and further way, adding more energy to the linear velocity. If I set angular velocity to 0 after first bounce, the ball seems to bounce as expected. This is my code: FTransform T = FTransform(InertiaTensor); FVector InertiaTensorWorld = (T * Root->GetComponentTransform()).GetLocation(); FVector vCollisionPoint = HitResult.ImpactPoint - Data.CurrentLocation; FVector r = vCollisionPoint; FVector velocityAtPoint = Data.LinearVelocity + (-Data.AngularVelocity ^ vCollisionPoint); const float vn = FMath::Min(0.0f, velocityAtPoint | HitResult.ImpactNormal); const float k = Data.InverseMass + ((r ^ HitResult.ImpactNormal) | ((r ^ HitResult.ImpactNormal) / InertiaTensorWorld)); const float j = -(1 + Restitution) * vn / k; Data.LinearVelocity += (j * HitResult.ImpactNormal) * Data.InverseMass; Data.AngularVelocity += (j * (r ^ HitResult.ImpactNormal)) / InertiaTensorWorld; // friction velocityAtPoint = Data.LinearVelocity + (-Data.AngularVelocity ^ vCollisionPoint); FVector tangentVelocity = velocityAtPoint - HitResult.ImpactNormal * (velocityAtPoint | HitResult.ImpactNormal); FVector tangent = tangentVelocity.GetSafeNormal(); float u = 0.2f; const float vt = (velocityAtPoint | tangent); const float kt = Data.InverseMass + ((r ^ tangent) | ((r ^ tangent) / InertiaTensorWorld)); const float jt = FMath::Clamp(-vt / kt, -u * j, u * j); Data.LinearVelocity += (jt * tangent) * Data.InverseMass; Data.AngularVelocity += (jt * (r ^ tangent)) / InertiaTensorWorld; //Data.AngularVelocity = FVector::ZeroVector; Sorry it's kinda messy, but I've just copied as is from the examples I could find to make it easier to convert to unreal. Is there a better way to handle the bouncing of a ball knowing that it just need to collide with the ground and walls?
2. ## Cross platform 3D board game (checkers/chess), what options are there?

Thanks, but I needed to integrate it into an existing Objective-C and Java application, so Unity wasn't an option.   In the end I've decided to use different libraries for each platform. For Android I'm not sure what I'm gonna use, but for iOS8+ I've decided to use Apple's SceneKit.
3. ## Cross platform 3D board game (checkers/chess), what options are there?

Hi,   How can I create a 3D board game like checkers or chess that can run on Android and iOS (just for newer versions)? Actually, I only need to create a 3D board since it needs to be integrated in an existing 2D game application. The app should allow for 2D board (existing) and 3D board (to be created).   The best way I guess would be to use an existing cross-platform library/framework, but what I was able to find was mostly game engines that are too much for what I need I think. Basically I think I mostly need a 3D renderer.   Another option I think would be to just use OpenGL ES by myself to do it, but I never done graphics programming, so it might be too much for me. But if you think that for just a board game it will not be too complex, than I don't mind spending some time learning OpenGL ES first.   What do you think?
4. ## Open world 3D game without a specific game engine

To be honest that's the answer I really wanted to get when I've started the topic, thanks.
5. ## Open world 3D game without a specific game engine

I didn't said I want to build the game completely from scratch, but just without an existing/commercial engine. Many libraries can be used, like physics engine, rendering engine (Ogre3D) and so on. Why would I want to build a game without an existing engine or using an open-source one instead of the commercial ones? Because of the control I'll get and because some of them are too expensive. For example, the best one for me is Unigine Engine because it supports very big worlds because of its double-precision coordinate system. But I can't afford it. Next one could be CryEngine SDK because of its beautiful outdoor scenes, but because of its authentication requirement I do not like it. From what I know there is no clear license for it also, so why can I trust that? I've saw too many valid complaints for it. The third one could be UDK, but the one based on Unreal Engine 4 which is not here yet. My last choice could be Unity, but I do not like it because is too generalized and they seems to focus more on what the community want, like mobile development for now. The Unity price is cheap, but you'll have to buy a lot of tools to be able to make what you want and that could become expensive. Tools like roads maker, interactive water and so on. In no time you'll get too dependent on other people. Yes, you could write the tools yourself, but how could you do that if you never got the advanced knowledge and experience?   If I would want to make many types of games and that I would want to make money from them I will use an existing commercial engine for sure. But, as I've said, my only goal is to create only one game and improve it as much as I can. So, if I'm planning to invest many years into this project, I want to be able to have as much control on it as I can.
6. ## Open world 3D game without a specific game engine

Yes, that makes sense.
7. ## Open world 3D game without a specific game engine

If someone will want to create a 3D game engine for learning purposes, how much time should he spend on it? I think a good answer could be until he touched all areas and have a basic working prototype. But, maybe he is not able to create a basic prototype in a decent amount of time and he should quit. When exactly should he quit because would be the best decision to take and not because of the overwhelming of the hard work?
8. ## Open world 3D game without a specific game engine

You will still need a programming language. C++ is as good as any.   What I suggest you do is evaluate some of your options. Dont worry if these are not the exact technologies you want to try. This is research at this stage.   Try building a simple cube platform jumper using the following tech.   1) Irrlicht - To try out a basic open-source 3D engine (use Ogre 3D if you prefer) 2) OpenGL - Have a look at implementing what you have just created in Irrlicht without using a graphics API directly (use DirectX if you prefer) 3) UDK - Try out a commercial engine (use Unity 3D if you prefer)   Once you have implemented all of them. Run them all and decide which one you have the most enthusiasm to extend and use to implement your next project.     Yes, I know I still need a programming language, but I was referring to Unity that uses C# which is considered a more high-level language than C++. Of course, Unity offers the possibility to write plugins using C++, but it's not necessarily needed.   Your idea with "simple cube platform jumper" is very good to test all options, thanks. I have been playing around in Unity for a while and with it I think that will definitely be pretty quick to do.   First, I will start to learn the necessary math and intermediate/advanced C++ programming. No matter what option I will choose, these 2 will definitely be needed I think. After I have some good C++ and 3D math knowledge, I think I will try and play around with an open-source 3D engine and with DirectX. After a year (maximum) I'll try to really decide what I want to do/use. Meanwhile maybe UDK will get an update to Unreal Engine 4. If that happens, UDK will have a very high chance to be my choice for an engine, instead of using open-source or writing it myself.
9. ## Open world 3D game without a specific game engine

I will not be alone for the entire process, but for now I will be the only programmer. In terms of the actual content I will receive help. I'm planning to start small of course, I will not jump directly into this project. But, this game of mine is my final goal and I needed to find out what path should I follow to get there.   If I want to build a game engine myself, even if I could use many existing libraries, I will still need to learn many many things in order to do that. If I decide to use an open source engine, maybe I do not need to learn as many things like DirectX, but I will need the 3D math and strong programming/C++ skills. If I decide to use an existing engine, I do not need to learn the low-level stuff, maybe not even C++.   So, I've talked about such a big game/project because that's my destination and I wanted to find the path to it. From what I understand there are those 3 options and depending on what I choose my learning path would be different. I'm here to see in what direction should I make the first step.
10. ## Open world 3D game without a specific game engine

I didn't said I want to make a big game. Maybe you should pay more attention to what I've said. Also, just because I'm considering to make a game that seems big, doesn't mean I want to do it now from the start and I didn't asked how to do it.   Do I really said crazy things in my posts? What's wrong with dreaming? Everything starts with a dream.   I've said: "Is it possible for an average guy to learn what it needs to learn in order to create a beautiful game without an existing game engine? A game that could look almost as beautiful as CryEngine/Unigine capabilities? Speaking just in terms of technology, not the art content that contribute to the beauty. Is it possible with so many resources/knowledge available these days on the internet?"   I came here asking for good advice to help me to make a good decision before I even begin. I came here to find what's possible and what not. To find why, how hard and how much time could it take. Some users were kind to push me in the right direction suggesting to use open-source engines if I do not like the commercial ones. They explained to me why is a good idea and I understood. I've asked what involves in being able to use them and to modify them and I've got my answers.   So, I have all I need now, thanks!
11. ## Open world 3D game without a specific game engine

Please let me borrow your crystal ball sometime...   Anyway, thank you for your help everyone. I will definitely think more about using an open-source game engine instead of a commercial one. Good luck with your projects!
12. ## Learning Math really from scratch

Understood, thank you!
13. ## Open world 3D game without a specific game engine

That is what I was trying to say. I didn't thought on building a game engine, at least not a multipurpose, reusable tool that everyone of them tries to be. I just want to build a game without a game engine. Of course, that involves in building the components that every engine has, but if the base system has only what I need and is build especially for that, that makes it a game engine? If the so called game engine can't live outside of my game, because is the actual game, does it make it a game engine? I imagine is a lot of work and needs a lot of knowledge and time/years, but it should definitely not be compared with what the big companies do, with an actual game engine, right?   I've searched around before posting this topic and from my understanding just because you've made a game from scratch, doesn't mean you have an engine. A game engine is the reusable, configurable and generalized part that can be used to make other games, right?