Now presenting: Penguins Overworld Craft, or po-craft for short. This is a ball rolling on a field, and you can control the ball and you can even rotate the camera!! https://sourceforge.net/projects/po-craft/develop To compile, you need Qt, SFML, Glut, and SDL (I know... only SFML woul truly be necessary, others only play minor roles) This is my first 3D attempt. I hope to create a world a lot vaster, then i'll add blocky constructions, a jumping ball, a ball with a texture rotating correctly so it's cooler, plenty of fun 3D stuff like particle fountains etc, a camera that follows the ball, a blue sky, a shadow on the ball, and a zone in which you can connect to a server and find battle and battle in 3D with the 2D BW/animated pokemon sprites. The ball would have to jump on a move to trigger it, or hit a reserve pokemon to send him in! Once that's down, i could do some other things in 3D too, maybe eventually a 3D brick break , a way to use LUA AI for something, a building with several rooms to do different stuff, etc. I want to eventually have a world in which there are various things, that have nothing in relation and could be added by different people, maybe like minecraft, but not too similar either! And maybe add other players in the world, but that's a big maybe. Anyway the code is open source & cross platform, and the screen above is my awesome ball rolling on the field. So, why a thread so early in the development? I'm just starting 3D, and I need encouragements and to document my steps in order to show off a bit and have the desire to continue further and further. I'd also welcome ideas of cool stuff. Remember that programming 3D is very diverse in a few lines, i could make the light of the world move in a circle over the world or throw a bunch of balls bouncing around and so on, or have a red sky, ...! So if you have any idea that will be pretty simple to do, don't hesitate! Next step: Make the camera follow behind the ball! Also, I'm learning 3D for the first time, so I may take my time to try new things and all as I really know nothing for now... Don't hesitate to post dev related things in there too.
I'm using QtCreator as an IDE, so you need either qmake or qtcreator. If you're on windows, it should compile and run automatically. On linux, you need to install freeglut-dev as well as libsdl-dev. If you got problems tell me more about them.
Ok, I am missing those packages, I'm on Linux/Ubuntu 11.04 EDIT: So I opened po-craft.pro and pressed build and this came error: SFML/Window.hpp: Tiedostoa tai hakemistoa ei ole Translated: File or Directory is missing, I set the build dir as defaultl when Qt asked it (po-craft-build-desktop) should I set it to something else?
I uploaded, you should have no problems anymore, I removed all SFML dependencies! Also the controls only work for a qwerty keyboard atm, I hope you have one. Now by pressing 'R' you can view the scene from a first person perspective. Beware, an enemy may be hiding behind one of those hills! Next, I'll make the camera able to look up and down, and make it follow behind the ball instead of being the ball.
I made the ball smaller, and now the camera can follow behind the ball Next step, make the camera able to go in the air or under the ground...
Managed to compile, this feels great, also made some heightmaps of my own, I can post them if you want // What key I need to press to get the camera behind the ball?
I'd love heightmaps!! I press the R key to change between camera modes, there a 3 modes: from above, inside the ball, behind the ball (make sure you got the latest update from git). I'll improve the camera to change the vertical inclination.
Now the camera behind the character works pretty well. Had a little headache but now it's pretty simple to figure out how to move the camera on openGL: list all the operations you would do to, from the origin, to reach the point of view desired, and then write them all in the reverse order with the reverse arguments, and poof it works! Next step will be implementing a menu for different controls depending on the keyboard layout and storing them. Btw, your heightmaps are awesome, they're definitely something I will use when the project is more complete!
Added: Menu when you press F2 in order to change controls (looks pretty basic, I know!) Press Enter to save the controls, escape to cancel. Next: more Camera stuff.
Ok, now camera can zoom in/out. Now i need to make it a proper ball - like it doesn't go inside the terrain when the slope is too sloppy, or have a texture which rotates according to the movement of the ball. Next I could do a gravity engine. If that happens, I need a proper collision manager and we could do jumps / races on heightmaps! I'd do few graphical adjustments and maybe release something :) Next: Proper terrain/ball detection. This is gonna ask some mathematical stuff and maybe take a bit of time, but once it's done it will make the rest easier.
While on my quest to perfect detection collision, I rendered the wireframe of the terrain: Dang, I hope i'll really find the problem and carry on )x
Wheeeeee! Now the ball moves perfectly on the surface. <3 maths. Next steps: implement a blue sky and make the ball roll. I'll put a screen when there's the blue sky just bragging rights even though it's very easy.
The ball rolls! I'll be working on velocity and acceleration and then i can proceed to gravity, and jumps after that!
I REALLY want to try this out. But I can't find the download link *facepalm*. When I go to "Files" Sourceforge says it has no files.
Right... what do I compile? This? git clone git://po-craft.git.sourceforge.net/gitroot/po-craft/po-craft (read-only)
Some math talk so i don't forget. The problem at hand is dealing about the slope changes, for example when the slope gets upwards. 1) Player controls. Player controls determine the acceleration in both x and z axis. For now the program assumes a flat terrain, so it's pretty straight forward. However, if the slope is not horizontal, we don't want an acceleration vector going 'inside' the terrain, rather have the x/z components decreased a little to introduce an y component. What's important to notice is that the normal of the terrain determines the rotation of the acceleration vector: if we had an upside down normal (meaning rolling on the ceiling), we'd want the up arrow to go the opposite direction than when on the floor, this can be expressed in loops for example (ever played sonic?). So we need the new acceleration vector to be orthogonal to the normal. It also needs to be rotated around an axis orthogonal to the direction we'd have on a flat terrain. So in short we have 3 vector: the normal n, the direction on a flat terrain d, the axis of rotation a which must be orthogonal to both, hence easy to deduce . Let a be d.cross(n).normalize(). (We ignore the case in which d and n are in the same direction). Then the new direction d' would be n.cross(a) * d.magnitude(). (Note that in case of the surface being flat and the direction being horizontal, d = d') Problem solved! Thank god cross products are there and I don't have to do rotation manually. I actually feared I would have had to do a rotation manually around the axis. Now there's the problem of changing the velocity vector when the terrain change, it's the same thing actually. There. Of course there would be consideration of bouncing back if the normals changed too much, but it's of no concern here.
Ok, noticed what an error I made when I gave up dev on this project. Started with a commit today to do a major cleanup of the code (mainly dependencies).