I want to create an MMO 3D game and im looking for a 3D-Engine and my question is about javaFX 8, can i use it for render a lot of 3D cube, models and animation without lose performance or is best to use the lwjgl?
the final question is: javaFX 8 can be used as a 3D engine?
To answer your questions:
Can i use it for render a lot of 3D cube, models and animation without lose performance?
This has for many people (I think) been a question ... and while there is no clear cut answer, there are ways to make it work.
For example I had recently built a simple Cloth-Simulator,
(first Spheres for vertices, then an actual TriangleMesh)
at first I took the approach of using an AnimationTimer for my update loop, it worked, but only up to a certain range of calculations.
My second approach was to create a Timer, using ScheduledService at a fixed timeStep interval and setting it to update the UI on completion.
I was able to almost double the number of vertices before performance started to sway. Which was quite an improvement, as I was able to have 20k vertices (not that I recommend it).
You can see the results here on youtube:
ProtoType 1
ProtoType 2
Finished MeshView
So really it is all a matter of how much time you wish to spend creating solutions.
Can javaFX 8 can be used as a 3D engine?
Once again, it really all depends on how much time you want to spend developing the framework. I have personally been trying to build a tool-set for this very purpose,
not every thing pans out, but the journey is half the solution.
If you're interested in seeing my approach with the Cloth Simulation, you can find all the sources here: F(x)yzLib , as well as many other useful features/shapes etc...
Yes i think JavaFX 8 is fast enough for 3D games but it's not at the cutting edge of current 3D when it comes to shaders. I have been trying to get to grips with it but it lack's a Camera lookAt method like you get in Three.js.
Lwjgl and JMonkeyEngine are the better options for now for Java 3D game development.
I'm making this 3D space shooter with JavaFX:
http://lightspeedpatrol.weebly.com/features-and-info.html
So I can tell you that it mostly works, but the lighting options are really limited as Allan mentioned. It was a good learning tool since it was the first time i've done anything related to 3D, but in the long run I think I'd be better off using LWJGL.
javaFx is great for simple 2D games but in 3D games lwjgl or jmonkeyEngine is better than javafx ,i think it's too slow for 3D games(but in very simple things it maybe good)
Related
How would I go about modeling a turgid bag of fluid in Box 2D, i.e. what physics equations would be useful in modeling this? The bag of water could move when touched, but that is the only interaction. Any places equations or models would be much appreciated!
You could use a library for this. Google's LiquidFun is quite good http://google.github.io/liquidfun/
User99345's answer is the way I'd go to model a bag of liquid, but if you're wanting to use an unmodified Box2D library you can model it using instances of b2EdgeShape, b2RevoluteJoint, and b2CircleShape. Whether that's a good enough way to model it, you'll have to decide.
Additional basis/insight for this...
After seeing your question I put together a model for a bag of liquid as a Testbed demo in my dev branch of my fork of Box2D. The demo is called "Bag of Disks" because that's basically what the demo models and it's in the file BagOfDisks.hpp. The code uses a series of edge shapes connected by revolute joints to model a deformable container and fills it with circle shapes (called DiskShape in my fork) to model a liquid. If you build the library and Testbed of my fork you can see for yourself how the model looks.
As a model of a bag of liquid, I'm of the opinion that the code I whipped together has shortcomings like the following:
It must be computationally less efficient than using particle simulation like Google's LiquidFun does.
I don't believe joints as currently implemented in Box2D (or my fork of it), can always ensure containment. That's because I don't believe joints are able to 100% prevent alternative movement of the connected shapes.
The "bag" in the demo doesn't level evenly at it's top like I'd expect a normal bag of liquid to do.
The "bag" doesn't model a buoyancy force that I'd expect the top of a bag to do.
I imagine things can be done from a user level to improve the model's behavior but I suspect less can be done from a user level to improve the model's speed. By user level, I mean as a user of the Box2D library.
While my fork has made many changes to the Box2D library (especially in naming), I don't believe what I've done in the demo itself can't be reproduced pretty closely using the original Box2D library and syntax as I'd said in my first paragraph using instances of b2EdgeShape, b2RevoluteJoint, and b2CircleShape.
As to what physics equations would be useful in modeling this beyond the equations that Box2D already uses, I'm sorry to say that I have no idea at the moment. I am interested in that however and am looking into it as well. Physics equations for this are available of course but the closest related work that I'm aware of from a Box2D user level is what iforce2d put together in his Buoyancy web page.
Hope this answer contributes helpfully to what's already been said.
I have been working on a graphical user interface which will display many 3D objects. These objects must be updated every 50 milliseconds, or at least, the colors of the objects need to be updated every 50 milliseconds. I have been using the graphics.fillPolygon() command to draw a few of these objects. So far, this has been working well for me, but is this an efficient way to draw graphics? Is there also a way to update only their color without telling the computer to redraw all of the polygons?
Java GUI is all that I know for drawing graphics, I will appreciate any recommendations for programming efficient graphics.
In your case Java is the perfect solution, java has very strong Graphics API for both 2D and 3D. Most of your task can be done easily.
If you are too much concerned with speed and you feel that Java is not performing very well than you will have to use C with OpenGL or GLUT. You might be thinking why I recomended OpenGL or Glut because they are written in C language and they can provide you thrilling fast speed.
But for now use Java, Java can make your work easier and it can give you good results.
Java and Android are almost similar so, if you get strong Java skills you can utilize them in android as well. That is a double benefit of Java.
I know that openGL works wonders if you send textures to it that are static and rarely change for example like tiles. But not when you have constantly changing sprites?
Is it possible to create games like abduction purely from canvas and what would be its performance?
It is possible to create games like abduction using canvas, however eventually you are going to hit a stumbling block in terms of performance.
OpenGL whether moving or static will handle images exponentially faster, by accessing buffers and pixel processors on the gc capable of manipulating large arrays of pixels at once.
However OpenGL isn't easy it will take time to learn, and you will need to learn it's language. This said you will find tons of information on using openGL, I highly recommend the Lightweight Java Game Library (LWJGL) http://lwjgl.org/ and NeHe tutorials http://nehe.gamedev.net/.
Anyway take a look see what you think, it'll be hard but as with all hard work it'll pay off eventually.
Hope this helps.
I am trying to create a Java package that can be used to write simulation programs.
My goal is to create 'objects' like springs or solid objects like cubes and spheres. They will have mass, velocity, gravity etc. and they can interact with each other.
I have seen some simulation programs on www.myphysicslab.com but my problem is that I don't want to write different equations for different senarios. Is there any way to do this? I am new to programming.
Creating a physics engine is hard. (Very hard). But it can also be a lot of fun. Well, fun in a "why am I doing this to myself?" kind of way.
Assuming your have a fair grasp of the maths involved*, and assuming you're interested in Rigid Body Dynamics there are a couple of classic references to start with:
First of all Chris Hecker's Rigid Body Dynamics tutorials
And of course Witkin and Baraff's SIGGRAPH course
Those are good places to start and will provide more than enough of a challenge for you.
You could also look at Box2D by Erin Catto and his associated GDC tutorials which you can download.
For more specific help, the forums for Bullet also contain a sub-section where you can discuss and ask questions once you have understood some of the basics.
*If you don't have this fair grasp, learn. If you're not willing to, don't try and just use an existing engine. If this is your very first programming experience, just focus on the programming first. Don't get yourself overwhelmed.
Good luck.
To understand physics, you must first understand maths. Attempting to write a physics engine without using mathematical equations is like making a cake without ingredients.
Entire careers are built on creating physics engines, so my advice is to either use an existing engine, or get your books out.
Building a physics simulator can be a lot of work. Two dimensions is considerably simpler than three, so maybe you want to start with 2D. You might want to begin with an existing package like JBox2D. It has a constraint solver, friction, etc. You can build on top of JBox2D or study how it works.
An HTML5 version is available with online demos: GWTBox2D
There is a program called Easy Java Simulations
that does exactly what you want!
You can create java applets and has many of the visual objects ready.
You can also write java code and subprograms.
visit http://fem.um.es/Ejs/ to download.
I'm coming to the end of my first year of CS and I thought a great way to consolidate all the things I've learnt this year would be a personal game project.
I would like to implement a 2D based rts, I'm thinking along the lines of starcraft I, warcraft II or even command and conquer. I will have about 3 months without interruptions to implement the game.
So to anyone experienced with java game programming, I have a few questions:
Is it realistic to design a 2D rts engine from scratch in 3 months?
If so what are some good books/resources to get started?
Would it be better to modify some existing project? I would think the experience of having to work with a lot of someone else's code would be good since our exposure to such topics in an undergrad cs degree seems very rare, if non-existent.
Are there any decent open source 2d rts projects that anyone could recommend? I've looked through a few but most seem to be written in c/c++
My humble thanks
Edit: Thanks for the quick responses, I think that perhaps it was a bad idea to post this in a rush since I think I misrepresented what I want to do.
When I say "along the lines of warcraft II etc" I mean more like that style of rts using sprites. I don't intend to implement a game nearly that complex, more like just a basic prototype.
My goal would be some thing more like a flat textured map with some basic obstacles like trees, a single unit producing structure like a barracks. I'd like to have the units to have health bars, be able to move and attack and die (and possible morph into another unit).
Far off goals would be to implement some basic pathing using a modified version of the dijkstra shortest path algorithm, ranged units with missle attack, etc.
I don't plan to implement any opponents or ai or networking or anything like that.
I'm thinking along the lines of starcraft I, warcraft II or even command and conquer
Make sure you purge your mind of matching the full scope of any of those. They took large teams of developers multiple years to make, with multi-million dollar budgets, so you can't even hope to approach those. They're called AAA for a reason. That being said, there's no reason you can't very minimally ape their design, or make a tiny game in their genre, assuming you have previous experience making small games.
A sub-genre of RTS that might be doable in that amount of time is a Tower Defense game. Plants vs Zombies is a good example. The reason I suggest this sub-genre is that you can avoid implementing any sort of AI or path-finding, which are notoriously difficult to get working, and I think technically impossible to implement "perfectly", especially with a limited CPU budget.
Make sure to reign in your scope. Favor a "complete" game over new features, because you can then call it "done" at any time. Get your game playable ASAP, and don't sweat the polish or details until you have to. Add one enemy type and one type of player unit (with only one ability, if you were thinking of implementing multiple abilities per unit). Make a title screen, menus (even if the menu is just "click screen to play"), game over screen, level complete or stat screens, cross-level player statistics, etc. Once you have all that ironed out, spend equal time adding new features and polishing the gameplay/graphics/bugs.
Once you have a playable, "complete" game ready (no matter how small in scope), find a real artist to do graphics for you. A shiny game always draws an audience, no matter how simple the gameplay.
It is very unrealistic to think you could implement a 2D RTS engine anywhere even close to the complexity in those kind of games. You could maybe get something very rough if you were experienced, but with only one year I think it's doubtful.
I can't help but feel like it would be much better for you if you used an existing engine or framework and built off of it. Like you said, working with other code would probably be a good learning experience as well. It would allow you to experiment without getting bogged down in having to do everything.
Keep it simple or you will simply drown in complexity before getting around to have anything playable. Since you have not tried it before, you will have a lot of nuts to crack and you don't know how long they will take.
Also remember that report writing and documentation takes time too.
The idea is good, and I think you can pull off a whole game if you find good building blocks. I would suggest discussing this with your teacher to hear what is acceptable for you to use. Would it e.g. be ok to do a game on an open source engine if you add some non-trivial functionality?
Update: Seems to be several engines available from Java at http://www.devmaster.net/engines/list.php?fid=6&sid=1
People often forget, that creating games is MUCH MORE than just coding the technique thing. Its about content creation, game design, sound and music, the "fun factor". If you make heavy use of existent APIs or engines, it will be possible, but writing it from scratch with no experience in 3 month is like asking yourself if you can code 100,000 LOC in this time which means 1111 LOC per day. This might be possible, but not if you have to desing and think, and just having the code makes no game.
Perhaps it would make sense to look at some existing efforts to get a feel for the scope of what you are looking at. These should give you some ideas or even code to build on:
http://www.duncanjauncey.com/btinternet/old/javagame/game.html
http://en.wikipedia.org/wiki/Lightweight_Java_Game_Library
http://www.ardor3d.com/
http://en.wikipedia.org/wiki/JMonkeyEngine
It would be a lot for me to bite off (from scratch) in the time given that is for sure. That is about all I can say.
EDIT: I thought maybe JOGRE was not what you are looking for. Then I thought about it and it seems like it would have all the right kinds of plumbing for what you are trying to do.
EDIT AGAIN: After my answer, one of the related questions links on the side seemed relevant: Java Game Programming: JOGL vs LWJGL?
Well if it gives you any hope at all, my team and I are currently working on an RTS game called "The Genesis Project". We call ourselves MotherBoard Games, or MBG for short. If you would like, I am always looking for more coders. You can email me at mpmn5891#gmail.com, I can give you some advice and tips form my 6 year experience, 2 of which have been spent making this game (to give you a scope)