Update

Hi guys!

So lately I haven’t really been posting, as school started again, and it’s been a bit stressy though I’m starting to find a good pace now.

So what I’ve been doing:

  • Materials System Improved alot! (Example below)
  • Added support for geometry shaders in materials
  • God Rays re-implemented, much better now
  • Terrain Displacement mapping improved
  • A more organised way of handling buffers
  • Physics improved, fixed actually (Some weird bug)
  • And other minour things

But! My actual attention has been going to my ultra secret project, Cuboid RTS (Not so secret anymore…), a real-time-strategy (RTS) game being developed with Cuboid Engine and C++. What’s working so far:

  • NPCs
    -Finds and gathers resources, though the target finding AI is done through the players AI
    -Kills other NPCs
    -Two main types: Offensive (Attack Attack Attack!), Defensive (Workers, their damage is very low)
  • Structures
    -Safehouse / House (Resources are dropped here)
  • Resources
    -Wood
    -Stone
    -Food
    -Gems
  • The World (Visually)
    -Randomly (100%) generated
    -Models by Nobiax on deviantart (Not so random after all 😀 )
    -Etc…
  • Players
    -AI
    -Naturally Fight Eachother

Now the really cool part of this is that, if I suddenly wanted a new resource, e.g. Gold, I just open my resources.cfg, and add this line: \nGold, bam! That’s it, now whenever I have a resource and it contains gold, I simply add Gold: [30]; In the resources section of the file (All resources/npcs/structures and players are loaded from files, which shows the paths of the models and the configuration).

That’s more or less what I’ve been doing, and btw, here’s how a simple material would look now:

// Copyright 2013 Miguel Petersen, all rights served to him bitches!

shader "GrassGenerator"
{
	Properties
	{
		Info = "A shader which generates grass patches";
	}

	// Considered to be global
    input()
    {
		Texture2D t_random;
    }

	// All extra functions, vars, or something goes in here
	global()
	{
		static const int nGrassVertices = 7;
		static const int nGrassPrTri = 3;

		void ViewProject(inout float4 pos)
		{
			pos = mul(pos, viewMatrix );
			pos = mul(pos, projectionMatrix );
		}

		float GetRandSeed( float3 rootPos )
		{
			return clamp( (sin( (1.57*frac(rootPos.z) + 1.57*frac(rootPos.x)) )*2.0 - 1.0),0,1);
		}

		static const float	WindCoeff[7] =
		{
			{0, 0, 0.02, 0.02, 0.04, 0.04, 0.09}
		};

		static const float2 windVec = float2(1,1);

		void GenerateGrassTriangles(float3 rootPos, VOut sample, in TriangleStream<VOut> TriStream)
		{
			// Ultra secret code
		}
	}

	// Modes: drawindexed, draw
	pass(cull=none;draw_mode=draw)
	{
		vertex()
		{
			output.position = position;
		}

		// max_vertices needs to be specified
		geometry(input = point; output = triangle; max_vertices = 7;)
		{
			// Generate straw of grass
			GenerateGrassTriangles(input[0].position.xyz, input, OutStream);
		}

		pixel()
		{
			output.Diffuse = float4(0,1,0,1);
		}
	}
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s