As I have acquired a PayPal account, I decided to put up a simple site for promotion, and to get some donations from those who would be kind to help making this project go on.
What should i say about this little game? Well, it's little at this time :) A lot of functions are still not implemented, but we can say the basics are done on the graphical side. On this page I would like to present how the program evolved, what features got implemented by time, what bugs were in the way. Enjoy!
As I decided to make it, the first goal was to gain information and choose a path. I chose good, with modern OpenGl, SDL library which allows me to port the program to various systems (Linux, Windows, Android), easy to develop with. The first few hundred lines set up the requirements, reading OBJ file, data structures, functions. The first shaders are not complicated, but gave some headaches, as I consider myself a beginner in this field. As you can see in the video above, the idea in practice works just fine, nothing complicated is on the scene. The sky is a sphere with an image, the water is a rectengular with two textures, which moves on it, making the illusion it's waving.
I used an objet loader function from the first time, but it wasn't perfect, I left out a lot of things, for example the material handling, and it wasn't useful for more objects. After expanding the code with a few hundred lines, creating additional structures, classes, it was ready for something to test. The boat is "interating" nicely with the water, but something is missing. The camera is static, moving is troublesome, need to be improved, along with the water, not looking very realistic. It's a game, my goal was not creating perfectly realistic ocean, but just this is not enough.
Finally, everything seems just fine. The water reflecting the sky, the camera can move freely, from this idill only the seagulls and the sounds are missing, but looking at this video, I'm happy I took the time to enhance this view. During Christmas I didn't have time to continue, but I was thinking about the continuation. Leaving the graphics behind, it's time to do something with the gameplay. What does a torpedo game require? It's a board game, so a board is evident. But how to achieve it? Creating a grid is equivalent, and to program you need two things: a cell, and the grid contains the cells. I didn't want to bother myself with ray-casting technics to determin where did I click on the screen, so the second step is to make it 2D. Because these cells are reprezented as classes, it was easy to create it's 2D alternative, which is just as easy to handle as breathing. I have to say, it caused some problems, because the screen coordinates have to in the same system, otherwise it's just a mess. In the meantime my pc had some health problems, linux reinstall was needed, repair the harddisk, but 2 weeks later I had to take it out of the developing. I was a little worried, how will the laptop handle the game, but as my biggest surprise it had the same speed. Probably because there is nothing much shown :)
Halfway on the road
And we are here, as today (01.31) the grid is finally even nicer, the onMouseOver function working well, I put text on the screen(!!!), set the limits of the camera, oh, and the horizon now is not a line where the water meets the sky, but some nice fog, achived from the shaders. I think I managed to work it out nice. Other main changes could not occure, due to some nasty stupid bugs, like it didn't put the text on the screen, in opposition the code was good, and the camera was rotating up, because it didn't placed it to the center after movements. A bug is growing to a bigger problem, if it's wrong as an idea. Calculating the center of the cells, transforming the points, checking the mouse, they can do some delay to the projects if the developer is not careful. The current changelog would look like this:
- Movements: WASD horizontal, QE vertical
- Camera rotation by clicking
- OBJ format loading
- Different kind of shaders
- Using Vertex Buffer Object to use modern functionality through shaders
- Water with normalmapping and Fresnel reflection
- Fog applied from shaders
- The perspective can be changed
This video was uploaded in the middle of March, and I should have update this page also, because now I cannot write as much of it as I could back then. As in the video description, I made minor modifications, like improving the sorting algorithm, for the buoys, so none will cover eachother. This was necessary, because the transparent faces have to be rendered last, otherwise it will blend wrong colors. I was trying to simplify the shader and make it more efficient, fast. It's visible that the buoy is not rendered correctly. The problem is coming from blending, and to eliminate it, I have to sort the object by faces, which is pumping up the system requirements, and slowing down the game. I didn't know at that time, that I can drop the pixel if it's transparent, and this is solving the problem beautifly.
I remember having troubles with the positions of the buoys. It's unfortunately visible in the clip :D. The ordering algorithm messed it up. In the later version because it's unnecessary, I simply deleted that part.
I think I changed the light settings, so the different skies provide individual lightning (color, position).
- Sorting algorithm for the buoys
- Minor overall improvements
Test 4 - The big changes
What to say, this video contains a lot of inprovements, new ideas, in a week I did a lot of changes. Let's start with the inside:
OpenGL does vertex (2D/3D point with color and stuff) based, interpolating between them and calculating the pixels color.
In modeling softwares, you work with polygons. The polygons have common vertices, which is increasing the quantity of datas. But the modeling software usually has Ray-Traced algorithm to render it, while OpenGL as mentioned, vertex based.
What can a programmer do? Find a way to convert one to the other. The OBJ format is very simple. Each face has 3 vertices, some has common. To reduce the repeating, we can check if it's already in use.
On the other hand, a vertex can have many material attributes, but to manage it, it's a little hard. Instead of drawing every face, with it's material, I built a structure, for every material, to contain the objects, vertices that use it. If I'm right, I made one databuffer, and changed the normal drawing to indexed drawing. I think I don't have to say the advances :)
Let's look on the outside, what's changed:
There were some changes in the shaders also. I have one shader, that is drawing the object, and because of that, I had to do it handling every possibility. For example, one object is simple, just a texture, that is giving it's color. But some has normalmaps, some has reflection. The material has it's flags, variables to indicate which component to use. Therefore the shader can adapt to the settings very easily. If you look at the buoys, you can actually see it's true form. There are plates in the middle, it has a cylinder. That's because I found out, the pixel can be descarded, no drawing, no Z value, it disappears. Also I put a multimaterial cube in, and it's just fine. Before half of it didn't draw out, because the order wasn't good.
Probably I did more modifications, on the water, on the models, but I don't remember.
- VBO improvements -big buffer+indices
- Material based drawing
- Bumpmap, reflection, transparency optional
- Transparent pixels discarded
- Modified shaders
Test 5 - Creating a GUI
It was time to improve the experience a little bit: instead of remembering what buttons do what, there is the user interface. I didn't want anything complicated, just buttons that do something. It's not final, nothing is, but I have to start somewhere and it's a good point. I created a structure to hide the things the buttons has to do. Some buttons have special way of working, while some only changes a number, set something to true. In the second video there is an implementation of string user input, for video settings, name, IP address for multiplayer. Probably the connection will be direct, or if it's not working, I have to do a matching system later.
The GUI has 3 panels, each has it's selfbutton, wich set the panel to be the active one. The panel has a background, the buttons also. I had problems with the color conversion, but it didn't take more than an hour to figure out. The help is in a separate file, reading every time it has to be shown, which will be changed.
Also, the option to save the current settings is available. To change the resolution and color depth, restart is required, while the number of buoys, normalmap, reflection is changing on click.
Almost forgot, the mouse mechanisms are changed as well. It's not activating by clicking, but dragging. It's a bit more convenient, and easier to do.
- Simple GUI
- Modified shaders
- Modified camera rotation
- Modified grid
Well, there's still a lot to do, like sounds, gameplay, multiplayer gaming, implementing an AI, particle systems for explosions.
I had to do a website recently and I couldn't improve it as I wanted, but eventually it will be ready.
If I managed to impress You, and You would feel like supporting this project, please don't be afraid, You can help!
Use this button to donate, as much as You want! As for now, I can say for those who help, I will send a copy of the game for the platform you need! Leave a message, and you will receive it amongst the firsts.