• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


  • Content count

  • Joined

  • Last visited

Community Reputation

110 Neutral

About tylerglaiel

  • Rank
  1. The fog is one noise texture (noise.png), which is scaled up, translated, and blended with itself 5 times (doubling the scale each time, I pass the values for that in from the game's code), most of the code in the fog shader is just doing a cubic blend between the pixels (instead of bilinear by default), which is completely unnecessary if you just want the basic effect. Cubic just looks a lot nicer for fog.
  2. All the game's shader source files are included in the resources folder for the game (if you get the steam version), for reference here's the relevant ones default vertex shader [CODE] void main (half4 position : POSITION, half2 texCoord : TEXCOORD0, uniform half4 color, uniform float4x4 Proj, uniform float4x4 modelView, out half4 oPosition : POSITION, out half2 oTexCoord : TEXCOORD0, out half4 frontcolor : COLOR0 ) { oPosition = mul(Proj, mul (modelView, position)); oTexCoord = texCoord; frontcolor = color; } [/CODE] Title Screen Logo fragment shader [CODE] void main (half2 texCoord : TEXCOORD0, half4 color : COLOR0, uniform half4 tint = half4(0, 0, 0, 0), sampler2D tex : TEXTUNIT0, uniform sampler2D noise : TEXUNIT1, uniform float timer, uniform float flicker, uniform float2 blurflicker, uniform float threshold_max, uniform float threshold_min, out half4 oColor : COLOR) { float wave = sin(timer+texCoord.x*20)*.005; oColor = tex2D (tex, texCoord + float2(0.0, wave)) * color + tint; float fogcol = tex2D(noise, texCoord*float2(.5, .5)+ float2(0.0, wave*.5)).r; float threshold = cos(timer*.2)*.4+.25; //threshold bounds between .3 and .5 if(threshold > min(threshold_max, .5)) threshold = min(threshold_max, .5); //black if(threshold < max(threshold_min, .3)) threshold = max(threshold_min, .3); //white if(fogcol < threshold) fogcol = 0; else fogcol = 1; if(oColor.r > .6){ oColor = fogcol; } else { if(oColor.r>.1){ oColor = float4(.2, .2, .2, oColor.a)+fogcol*.3; } } if(blurflicker.r>.5){ float blurrer = 0; for(float i = -5.0; i<5.0; i+=1.0){ blurrer += tex2D (tex, texCoord + float2(i/256.0, wave)); } oColor = oColor*.5+float4((blurrer / 10.0).rrr, oColor.a); } if(blurflicker.g>.5){ float blurrer = 0; for(float i = -5.0; i<5.0; i+=1.0){ blurrer += tex2D (tex, texCoord + float2(0, wave+i/128.0)); } oColor = oColor*.5+float4((blurrer / 10.0).rrr, oColor.a); } oColor *= flicker*2; // oColor = float4(fogcol.rrr, 1); } [/CODE] these 2 go together ============================ Fog vertex shader [CODE] void main (float4 position : POSITION, float2 texCoord : TEXCOORD0, uniform float4 color, //uniform float4x4 modelViewProj, uniform float4x4 Proj, uniform float4x4 modelView, uniform float4x4 camera, uniform float4x4 lighttransform, uniform float4 level0, uniform float4 level1, uniform float4 level2, uniform float4 level3, uniform float4 level4, out float3 coords0 : TEXCOORD0, out float3 coords1 : TEXCOORD1, out float3 coords2 : TEXCOORD2, out float3 coords3 : TEXCOORD3, out float3 coords4 : TEXCOORD4, out float2 lighttexcoord : TEXCOORD5, out float4 oPosition : POSITION ) { coords0 = float3((level0.xy+texCoord.xy)*level0.z, level0.w); coords1 = float3((level1.xy+texCoord.xy)*level1.z, level1.w); coords2 = float3((level2.xy+texCoord.xy)*level2.z, level2.w); coords3 = float3((level3.xy+texCoord.xy)*level3.z, level3.w); coords4 = float3((level4.xy+texCoord.xy)*level4.z, level4.w); float4 screenposition = mul(Proj, mul (modelView, position)); lighttexcoord = (mul(lighttransform, screenposition)).xy; oPosition = mul(mul(mul(Proj, camera), modelView), position);//Proj*camera*modelView*position; } [/CODE] fog fragment shader [CODE] //fast cubic texture fetch functions inline float w0(const float x){ return (-x*x*x + 3.0*x*x - 3.0*x + 1.0)/6.0; } inline float w1(const float x){ return (3.0*x*x*x - 6.0*x*x + 4.0)/6.0; } inline float w2(const float x){ return (-3.0*x*x*x + 3.0*x*x + 3.0*x + 1.0)/6.0; } inline float w3(const float x){ return (x*x*x)/6.0; } inline float g0(const float x){ return w0(x)+w1(x); } inline float g1(const float x){ return w2(x)+w3(x); } inline float h0(const float x){ return 1.0-(w1(x)/(w0(x)+w1(x)))+x; } inline float h1(const float x){ return 1.0+(w3(x)/(w2(x)+w3(x)))-x; } inline float texture2DCubicX(sampler2D tex_source, const float2 coord_source){ const float size_source = 512.0; const float e_x = (1.0/512.0); const float coord_hg = coord_source.x*size_source-.5; const float3 hg_x = float3(h0(frac(coord_hg)), h1(frac(coord_hg)), g0(frac(coord_hg))); const float coord_source1 = coord_source.x - hg_x.x * e_x; const float coord_source0 = coord_source.x + hg_x.y * e_x; float tex_source0 = h1tex2D( tex_source, float2(coord_source0, coord_source.y) ); float tex_source1 = h1tex2D( tex_source, float2(coord_source1, coord_source.y) ); tex_source0 = lerp( tex_source0, tex_source1, hg_x.z ); return tex_source0; } inline float texture2DCubicFast(sampler2D tex_source, const float2 coord_source){ const float size_source = 512.0; const float e_x = (1.0/512.0); const float coord_hg = coord_source.y*size_source-.5; const float3 hg_x = float3(h0(frac(coord_hg)), h1(frac(coord_hg)), g0(frac(coord_hg))); const float coord_source1 = coord_source.y - hg_x.x * e_x; const float coord_source0 = coord_source.y + hg_x.y * e_x; float tex_source0 = texture2DCubicX( tex_source, float2(coord_source.x, coord_source0) ); float tex_source1 = texture2DCubicX( tex_source, float2(coord_source.x, coord_source1) ); tex_source0 = lerp( tex_source0, tex_source1, hg_x.z ); return tex_source0; } inline float level(float3 data, sampler2D fogg){ //float Angle = texture2D(fog, data.xy)*2*3.141592+timer*5; // mat2 RotationMatrix = mat2( cos( Angle ), -sin( Angle ), // sin( Angle ), cos( Angle )); return texture2DCubicFast(fogg, data.xy/*RotationMatrix*(Angle-timer*5)*.05*/)*data.z; } /* float4 pallatemap(float index, sampler2D pallate){ return float4(1,1,1,1);//tex2D(pallate, float2(index, 0.0)); } /* uniform sampler2D fog; uniform sampler2D light; uniform sampler2D pallate; //format: vx,vy, scale, brightness varying vec3 coords[5]; varying vec2 lighttexcoord; uniform float timer; */ void main (float4 color : COLOR0, uniform sampler2D fog : TEXUNIT0, uniform sampler2D light : TEXUNIT1, uniform sampler2D pallate : TEXUNIT2, uniform float timer, float2 lighttexcoord : TEXCOORD5, float3 coords0 : TEXCOORD0, float3 coords1 : TEXCOORD1, float3 coords2 : TEXCOORD2, float3 coords3 : TEXCOORD3, float3 coords4 : TEXCOORD4, out float4 oColor : COLOR) { float4 lightfrag = tex2D(light, lighttexcoord); float4 fogcol = float4((level(coords0, fog)+level(coords1, fog)+level(coords2, fog)+level(coords3, fog)+level(coords4, fog)).xxx, 1.0)*float4(.9, .9, 1, 1); oColor = fogcol*lightfrag; if(lightfrag.r<0.01){ oColor = float4(0,0,0,0); } //float4 lightfrag = tex2D(light, lighttexcoord); //if(lightfrag.r<0.01) discard; //oColor = texture2DCubicFast(fog, coords[4]+timer); } [/CODE] these 2 go together The fog is rendered to a texture, and the texture is fed into the title screen logo shader. The fog shader is the same one that makes the background fog effect in-game, these 2 could probably be the same shader, but there's not much else going on on the title screen so I didn't need to do that. You can use these for learning but don't just copy paste the code, its terrible code anyway, and you won't really be able to just use them cause they require a lot of setup in the game code to look right. - Tyler fun fact the title logo effect was my attempt to replicate the after-effects filter Jon used for the trailer http://www.youtube.com/watch?v=uuOB6AHNGPs
  3. unity learning day 4&5 http://t.co/eJyMtYJx day+night cycle (most of the work was me trying to pick colors when I am terrible at colors)