I did a lot of work in the game these days. Now, I can export meshes from Blender, read description files for fonts, materials, objects, levels and render the level. Everything still needs a lot of work but the results are encouraging and I can check visually what I was working on all this time.
Some screenshots of what I have (the jpg is killing the menu, I'll have to tweak the compression settings next time)...
[sharedmedia=gallery:images:6265]
[sharedmedia=gallery:images:6264]
[sharedmedia=gallery:images:6263]
The main menu can have a full 3D level behind it but I am not sure if I will use this feature. For now, the level is only one object as a unique geometry using a unique material (the code is made to handle more complex setup but it needs to be finalized). I am rendering it with a very simple shader. Loading of it is hard coded and it is used for any object present in the level for now. It may be my third shader ever so it is really basic (and not very well written) but to test what I currently have, it is more than enough.
in vec4 pass_Color;in vec3 pass_Normal;in vec2 pass_UV;out vec4 out_Color;uniform sampler2D diffImage;void main(void){ // fixed light direction vec3 lightDir = normalize(vec3(-1.0, -1.0, -1.0)); // calculated diffuse float diffuse = max(0.0, dot(pass_Normal, lightDir)); // ambient float ambCoef = 0.25; out_Color = min(diffuse + ambCoef, 1.0) * vec4(pass_Color.rgb, 1) * vec4(texture(diffImage, pass_UV).rgb, 1);}
The spaceship is the player's one. The Blender export script produces a file with the vertices, colors, normals, UVs and bounding dimensions. The association with one or more materials is done in a separate file allowing the declaration of objects with the same geometry but different rendering properties.
The next things to do:
- finish the code to use more than one geometry and one material per object
- code more level content: cameras, lights, terrain description, enemy waves, ...
- more complex materials with specific shaders
- and a lot more items in my ever-growing todo list
Until next time...
This is an idea that I have always liked. I remember all the way back to my days of playing Age of Mythology, and watching the menu scene. A nice, peaceful little island. Oh wait, here comes a ship full of invaders to attack. Whoops, a kraken just rose up from the deeps and took the ship down. Stuff like that, I think, really makes a good menu state for me.