• 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.

CAPE

Members
  • Content count

    31
  • Joined

  • Last visited

Community Reputation

150 Neutral

About CAPE

  • Rank
    Member
  1. Oh shit, there my education went out the window. You think you are learnig something, then just: "MINDBLOWN. You dont know anyting. Study harder, douchbag.", or something like that.   Well, seems like it will be back to the drawing board. But, as it is an editor, i guess I can have it not som optimized, i guess... (shiver through my body).   But dudes, thanks for the quick reply. Very helpful.
  2. I'm experience a bit of a small problem. I have implemented a render system with a dll in C++, where the user injects data (model/view/projection matricse, colors, meshes and so on) through void pointers. It is quite handy, as the graphic API's usually don't care about the data type, just the structure and size of the data.   I have been using it as a part of a game that we are developing, and it works out quite good. But now I am in the mood of developing a editor to the render system in C#, and am quite stumped.   When i link an XNA matrix as a pointer to the render dll, the pointer stays intact in teh transfer to the dll, where it is kept for future references when updated in the editor. But, the data that the pointer points at, is not. Here is some code:   Editor (C#): unsafe { [...] Matrix unsafeWorldMatrix = worldMatrix; void* worldMatrixPointer = (void*)(&unsafeWorldMatrix.M11); mRenderInterface.AddData("world", worldMatrixPointer); [...] } While the pointer is in the editor code, the world matrix pointer is able to convert back to the matrix in question, with the data intact. // The data is intact Matrix worldMatrix = *(Matrix*)worldMatrixPointer;   But as soon as I send it to the render system, using the dll, it looses the data. The pointer is the same, but teh first value just points to 0, and the rest is invalid. // Sending the data to the render system // The data is still intact here, and lets say that the pointer value is 0x0c52af32 [DllImport(DllName, SetLastError = true, CallingConvention = CallingConvention.Cdecl)] static extern unsafe void SetSharedData(System.String dataID, void* data); public unsafe void AddData(String id, void* dataPtr) { SetSharedData(id, dataPtr); } In the dll (c++) // Here the data is incorrect // the pointer is the same as before, but with CAPS letter (should not matter though)(0x0C52AF32) void hs::renderer::SetSharedData(const char* id, void* data) { AssertFunctionAndThrow(DirectXManager::GetInstance()->GetContent()->AddSharedData(id, data)); } Both systems are compiled using x86 / Win32 settings, and both are in debug.     What is the deal here? I am aware that it is lack of knowledge, as I´m very unfamiliar with the correct procedures here, but as far as i know, the data should not change, as long as the pointer is intact... BTW, when returning back from saving the pointer in the system, returning to the C# editor, the data in the pointer is intact.... WTF?   So, anyone who can point out my error? And as the rendersystem works as intended in the actual game, I know it is nothing wrong in the dll. And, teh only thing I do is storing the pointer in a map with a string identifier, so no interaction with hte actual pointer,   Any ideas are welcome. // CAPE
  3. I'm currently implementing a render system that are scriptable by XML. While the system is kinda awesome, so far, there is a bit of a steep learning curve for others to use the scripts. So I'm in the process to also implement a editor to the render system. The render system is implemented in C++, the editor will be implemented in Windows Forms (C#).   But im already stumped. I try to call the functions from the dll, but i get a PInvokeStackImbalance was detected. error. While reading on about the error, I realize that there is a problem with calling conventions and parameters, or, like the error tells me: This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature. But, there should match, or am I at fault here?   The call is the following: [DllImport(DllName, SetLastError = true)] static unsafe extern void Initalize(IntPtr hWnd); public unsafe void Start(IntPtr hWnd) { Initalize(hWnd); } The dll entry is as follow: namespace hs { namespace renderer { [...] __declspec(dllexport) void Initalize(HWND hWnd); [...] } } I'm, as I said, stumped. First i thought it was the namespaces, but as it finds the entry point, i don't think thats the problem.   Anyone out there who knows the correct way to do this? Much appreciated.
  4. I don't know how you store your texture pointers, but with an string identifier, i guessing map<string, TexturPtr>. This will need to be extended to support additional data to use as the identifier. Here u can implement a functor to create your own comparison function. Its easy to create, you can variate between different types, and is manageble. The problem that occurs is that that you will need to implement a key-struct for each type and combination. But as you currently need to create a load function for each resource type, this I guess will be a minor problem. [CODE] struct TextureKey { string name; //texture name int sizeX, sizeY; //texture size bool operator<(const TextureKey &a, const TextureKey &b) { return std::strcmp(a.name, b.name) < 0 &amp;&amp; a.sizeX == b.sizeX &amp;&amp; a.sizeY == b.sizeY; } }; ... map<TextureKey, TexturePtr> mTexturePtrs; [/CODE] (Have not tried the above code, but it looks right )
  5. Hi all game developing people out there. (Yeah, graphic artists included). Christmas is soon knocking on the door, and as always I got friends and family asking the annoying question "And what do you want for Christmas?". Anyone who doesn't know what I'm talking about? Good, then you get my dilemma :). Well, usually I wish for money, underwear, sex toys... ... ... you get the point. This year, i thought to myself, I need to get something useful that they actually could be able to get me (I don't understand whats the problem with the underwear's). So, this year I'm going to wish for game developing books. Yeah, you heard me. The internet is not big enough to fill my needs, and I have only been jumping between different books that the school have recommended us to get to be able to pass the exams and do the petrifying task to get a triangle to rotate on the screen. I know that there is a section for books of this kind, but some are even dated back to 2000. It's hard to get a good grip of what is good for me or not, and here i will hopefully get a more fresh update, and with reports from real people with real experience ;). So now I ask the more experienced audience for some good (preferably great) books that I could be wishing to fill my stockings hanging over the oven (I don't have a fireplace). I have left the beginners crowd some years ago, and I don' really have a specific topic in mind. Languages: C++ / C# (maybe a new script language book) Graphical API: DirectX Just not OpenGl, and that is not that I don't like it, or have wet dreams of Bill Gates, its just that I have been directing my learning curve towards DirectX. And as I have not mastered it to the bones (yet), I would like to dig deeper into the DirectX core rather than start from scratch. It doesn't have to be language or API specific either, just as long as you think it would be a great additional contribution to my dust collecting areas as I travel through the upcoming years of game development. Precompiled thanks, and a upcoming Merry Christmas and a happy new year. PS. Feel free to follow this thread even if you don't contribute, as it's probably more people out there with the same problem. This is a big area and there is hard to keep track of good and bad literature out there. PS. [Edited by - CAPE on November 17, 2010 6:03:44 PM]
  6. I have a mayor problem. I have programmed a car game with physics and 3D rendering. The rendering part is done with Ogre, but I don't think this is of importance. The game have been coded with VS 2008 in c++ , in the OS Vista, and it looks pretty good :). The code compiles and runs without problems on my computer, and on the computers of most of the other guys on my team. But on some computers, all of them without the development base of VS 2008, and all of them with XP, there is a strange crash. First, it complains that the redist files for VS 2008 is missing. After the installation of these, then the real problem starts to show. It says this: "The procedure entry point _except_handler4_common could not me located in the dynamic link library msvcrt.dll" I think it has something to do with the redist files not beeing located on the right place or that the files are incorrect, like if there already is dll files that is out of date and overides the correct files from the redist installation. But I have no clue how to fix this. If you have encounterd this or a similar problem, please tell me if you know the solution, or know what the problem might be.
  7. Hi all fellow programmers. I have a little problem here, and I don't know what it can be. A little backstory: I began writing a AI game including robots with different AI's declared in different LUA scripts. This game and the AI aspect worked without problem. So, I turned in the game to the teacher to grade it, and because of different dependicies and varius VS versions, he could not build the program. So, two weeks later or so, he asked me for a own build. Me, who deleted the compiled executables since before, began to build again, and now it dosn't work. It crahses here: void RobotManager::BindStateMachine() { luabind::module(LUAManager::GetInstance()->GetState()) [ luabind::class_<StateMachine<Robot>>("StateMachine") .def("ChangeState", &StateMachine<Robot>::ChangeState) .def("CurrentState", &StateMachine<Robot>::CurrentState) .def("SetCurrentState", &StateMachine<Robot>::SetCurrentState) ]; } Okay, now I began to wonder, "WF...". The class is correct, the function names are correct, and I have not edited the code, so it should work. Well, the next idé i had was that the linker had been damaged, so the thing I did to check this, i followed a tutorial, and just copied the code for the "Exporting Classes to Lua" example. I linked the files correct on my computer, and it compiled without problem. Guess what... it chrashes on the same operation: luabind::module(_lState) [ luabind::class_<NumberPrinter>("NumberPrinter") .def(luabind::constructor<int>()) .def("Print", &NumberPrinter::print) ]; The declaration of the class works fine, but when it is about to declare the functions inside of it, it break's. And I have not changed the code what so ever after the time it actually did work, and of my knowledge, the dependicies have not changed either (though this seems to be hte problem in this case. If you can see what the problem is in the code (see tutorial under "Exporting Classes to Lua"), that is, if there is a problem, please tell me. Else I don't know what to do. YT CAPE
  8. Hi all. I have a little problem with luabind. When i compile and ru my program in debug, it works fine, no problem there. But when I try to do the same thing in release, it compiles but crashes when I try to bind my first class with luabind. Here is the initalize: _lState = lua_open(); luaL_openlibs( _lState ); luabind::open( _lState ); Ogre::String folder = cf.getSetting("LUADir"); int size = Ogre::StringConverter::parseInt(cf.getSetting("NumberOfScripts")); int error; for(int i = 0; i < size; i++) { error = luaL_dofile(_lState, (folder+cf.getSetting("ScriptFile", Ogre::StringConverter::toString(i))).c_str()); if( error != 0 ) { std::cout << "Cant read the file at: " << folder << cf.getSetting("ScriptFile", Ogre::StringConverter::toString(i)).c_str() << std::endl; return false; } _loopSpawn.push_back(cf.getSetting("LoopStart", Ogre::StringConverter::toString(i)).c_str()); } And here is the class binding where my program crashes: luabind::module(LUAManager::GetInstance()->GetState()) [ luabind::class_<StateMachine<Robot>>("StateMachine") .def("ChangeState", &StateMachine<Robot>::ChangeState) .def("CurrentState", &StateMachine<Robot>::CurrentState) .def("SetCurrentState", &StateMachine<Robot>::SetCurrentState) ]; I do nothing lua related between these chunks of code, so I dont think you need any more code than that. And when it crashes, it says: "Expresion: vector iterator not dereferecable". I know what it means, but I do not know the cause. As you can see, the class I try to bind is a template, if that could be the problem, but as it works with the debug, I think it would be strange. Any help would be appreciated.
  9. Thnx alot jelly, it did the trick :). Greate work with the moderating job btw, keep up the good work.
  10. Well, Im making my own editor, and right now I'm going to save te height on the heightmap into a texture. First, i used a A8R8G8B8 texture for that, and to load I use D3DLOCKED_RECT to gain access to te texture, like this: LPDIRECT3DTEXTURE9 Heightmap; D3DXCreateTextureFromFile(DIRECTX->GetDevice(), a_FileName, &Heightmap); D3DLOCKED_RECT lockedRect; ::ZeroMemory(&lockedRect, sizeof(lockedRect)); if(FAILED(Heightmap->LockRect(0, &lockedRect, NULL, 0))) { return false; } DWORD* Bits = (DWORD*)lockedRect.pBits; int index = 0; for(int y = m_Depth; y >= 0; y --) { for(int x = 0; x < (m_Depth + 1); x ++) { index = (m_Depth - y) * (m_Depth + 1) + x; m_EditorBuffer[index].Pos.y = ((Bits[(y*a_Mapsize)+x])&255); } } Heightmap->UnlockRect(0); Heightmap->Release(); Heightmap = NULL; Well, it works well and so, but the program, when reading the height values from the texture, it rounds off the value. Like this: 0.7f -> 0.0f, -13.9f -> -13.0f. Well then, I need to use a float32 texture to get better precision, but now I dont know how to get the values from the texture. The old way isn't working, and by the way, cause I use float32 texture, I can't see on the texture if it got the right height values. Here is the shader I use to create the heightmap: float WorldSize; struct VS_OUT { float4 Pos : POSITION; float Color : TEXCOORD0; }; VS_OUT ScreenQuadVS( float3 Position : POSITION) { VS_OUT OUT; //cause writing to a texture, only X and Y is important OUT.Pos.x = Position.x / WorldSize; OUT.Pos.y = (Position.z / 2.0f) / (WorldSize / 2.0f); OUT.Pos.z = 0.0f; OUT.Pos.w = 1.0f; //take the height and make it into a color value //adds 128 cause i don't want any negativ values on the texture OUT.Color = (Position.y + 128.0f); return OUT; } float4 PSHeightTexture(float Color : TEXCOORD0 ) : COLOR0 { return Color; } technique CreateHeightmap { pass P0 { VertexShader = compile vs_2_0 ScreenQuadVS(); PixelShader = compile ps_2_0 PSHeightTexture(); } } Atleast this shader worked on the other texture, complaine if you think it is necessary :þ Help me anyone :)
  11. Well, I got a question for all you x-file-loving people out there (if ou exist) :D I'm right now implementing animation with directx and x-files, and finaly, I got it working :). But now, my friends, comes the question in mind. My artist have gone berserk and made a model with two objects in it, not two subsets, but to objects. (Maybe it could be my fault because I throw out the greate ide to be able to switch between models in the same skeleton, so that we would be able to switch between armors and different objects on the model.) Well, the result now is that I only get one part of the model, and that part is the last one to be loaded in the program. I have no clue what or how to do to be able to convert my system so that it would be able to handle several objects from one x-file. Is there someone out there that has a tutorial stuffed away, or know directly how this is done, please let me know. :D
  12. First, I have to thank you for the replies, it surly will be helpful. Just to answer your question MJP, the 500 in the shader is meant to be my current ZFar. (Forgot to change that bit before posting, was just a experiment :D). And Lifepower, your way to create the shadow map is used in many different papers and tutorials, but it does, as you say, result in a totally white shadowmap. I can't really connect this in my head to understand how this work, and it dosn't match the general ide of a shadowmap where you can see the depth difference in a greyscale texture. So when I saw the difference by deviding the depth with the ligths ZFar, i thought I was on the right track. If you could explain this totally white shadw map and how this work, I would be very greatful. Another thing though. Asked a friend about this, and he said I should check the size of my Z-depth buffer to match the texture. Because I use the whole window for rendering, does he mean that I should match the size of the texture to my scren size?? And if so, my texture will not be in the 2^x size, wich I think it need to be, or is it just me thinking in the wrong direction?? Thanks again for the replies, and sorry for the expanding with extra questions :D.
  13. Well, I got a huge one for you here ;). I have worked on a enginelike thingy for about 2 - 2.5 months now, and I thought it were time to test to implement shadows to my engine, and because I'm going to have nice animations in the engine, I choose to use shadowmaps so that I didn't have to go through the problems with closed animated meshes :D. Well, after studying some of my books and some artikles on the internet i thought myself ready to begin implementing it myself. BUT, it didnt work out as it was intended to, resulting me beeing here today :D. Well, I begin to create my shadow map with the following shader, and atleast I think it looks like it is correct :) float4x4 World; float4x4 View; float4x4 Projection; float ZNear; float ZFar; void BuildShadowMapVS(float3 posL : POSITION0, out float4 posH : POSITION0, out float2 depth : TEXCOORD0) { float4x4 WVP = mul(mul(World, LightView), LightProjetion); // Render from light's perspective. posH = mul(float4(posL, 1.0f), WVP); // Propagate z- and w-coordinates. depth = posH.z - ZNear; } float4 BuildShadowMapPS(float2 depth : TEXCOORD0) : COLOR { // Each pixel in the shadow map stores the pixel depth from the // light source in normalized device coordinates. return depth.x / (ZFar - ZNear); // z / w } technique BuildShadowMapTech { pass P0 { vertexShader = compile vs_2_0 BuildShadowMapVS(); pixelShader = compile ps_2_0 BuildShadowMapPS(); } } And the resulting image on a D3DFMT_R32F texture: Well, as the background reveals all isn't right here. So, cause i think im doing someting right in the creation of the shadowmap, the problem must be in the implementation of the shadowmap, so here it comes: static const float SHADOWMAP_SIZE = 512.0f; float SHADOW_EPSILON = 0.002f; //------------------------------------ //Camera Transformation float4x4 World : World; float4x4 View : View; float4x4 Projection : Projection; //LightTransformation float4x4 LightView; float4x4 LightProjetion; //Light- and texture calculation float4 LightColor; float3 LightDirection; float WorldSize; //All the textures texture Tex01; sampler Samp01 = sampler_state //sampler for doing the texture-lookup { Texture = (Tex01); //apply a texture to the sampler MipFilter = LINEAR; //sampler states MinFilter = LINEAR; MagFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; }; texture Tex02; sampler Samp02 = sampler_state //sampler for doing the texture-lookup { Texture = (Tex02); //apply a texture to the sampler MipFilter = LINEAR; //sampler states MinFilter = LINEAR; MagFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; }; texture Tex03; sampler Samp03 = sampler_state //sampler for doing the texture-lookup { Texture = (Tex03); //apply a texture to the sampler MipFilter = LINEAR; //sampler states MinFilter = LINEAR; MagFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; }; texture Tex04; sampler Samp04 = sampler_state //sampler for doing the texture-lookup { Texture = (Tex04); //apply a texture to the sampler MipFilter = LINEAR; //sampler states MinFilter = LINEAR; MagFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; }; texture AlphaTex; sampler AlphaSamp = sampler_state //sampler for doing the texture-lookup { Texture = (AlphaTex); //apply a texture to the sampler MipFilter = LINEAR; //sampler states MinFilter = LINEAR; MagFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; }; //My shadowmap texture ShadowMap; sampler ShadowSample = sampler_state { Texture = (ShadowMap); //apply a texture to the sampler MipFilter = POINT; //sampler states MinFilter = POINT; MagFilter = POINT; AddressU = CLAMP; AddressV = CLAMP; }; struct vertexOutput { float4 Position : POSITION; float2 UV : TEXCOORD0; float2 AlphaTex : TEXCOORD1; float4 ProjCoord : TEXCOORD2; float Diffuse : COLOR0; }; //------------------------------------ vertexOutput VS( float3 Position : POSITION, float3 Normal : NORMAL, float2 UV : TEXCOORD0 ) { vertexOutput OUT; //Calculate position in worldspace float3 WP = mul(float4(Position, 1.0f), World).xyz; //Calculate light projection matrix float4x4 LightWVP = mul(mul(World, LightView), LightProjetion); //Calculate screen projection matrix float4x4 WVP = mul(mul(World, View), Projection); float3 N = normalize(mul(Normal, World)); //diffuse component float Diff = max(saturate(dot(N, normalize(-LightDirection))), 0.0f); OUT.Position = mul( float4(Position.xyz , 1.0) , WVP); OUT.UV = UV; //bring forth the texture corrdinates OUT.AlphaTex.x = (WP.x + WorldSize) / (WorldSize * 2); OUT.AlphaTex.y = (WP.z + WorldSize) / (WorldSize * 2); // Output the projective texture coordinates OUT.ProjCoord = mul( float4(Position, 1.0f), LightWVP ); OUT.Diffuse = Diff; return OUT; } float4 PS( float2 UV : TEXCOORD0, float2 AlphaTex : TEXCOORD1, float4 ProjCoord : TEXCOORD2, float3 WorldDepth : TEXCOORD3, float Diffuse : COLOR0) : COLOR { //The diferent texture samples float4 Color01 = tex2D(Samp01, UV); float4 Color02 = tex2D(Samp02, UV); float4 Color03 = tex2D(Samp03, UV); float4 Color04 = tex2D(Samp04, UV); float4 Alpha = tex2D(AlphaSamp, AlphaTex); Alpha = normalize(Alpha); //Calculate the final color with help from the alpha map float4 ResultColor = Alpha.x * Color01 + Alpha.y * Color02 + Alpha.z * Color03 + Alpha.w * Color04; ResultColor.w = 1.0f; // Project the texture coords and scale/offset to [0, 1]. ProjCoord.xy /= 500.0f; ProjCoord.x = 0.5f*ProjCoord.x + 0.5f; ProjCoord.y = -0.5f*ProjCoord.y + 0.5f; // Compute pixel depth for shadowing. float depth = ProjCoord.z / 500.0f; // Transform to texel space float2 texelpos = SHADOWMAP_SIZE * ProjCoord.xy; // Determine the lerp amounts. float2 lerps = frac( texelpos ); // 2x2 percentage closest filter. float dx = 1.0f / SHADOWMAP_SIZE; float s0 = (tex2D(ShadowSample, ProjCoord.xy).r + SHADOW_EPSILON < depth) ? 0.2f : 1.0f; float s1 = (tex2D(ShadowSample, ProjCoord.xy + float2(dx, 0.0f)).r + SHADOW_EPSILON < depth) ? 0.2f : 1.0f; float s2 = (tex2D(ShadowSample, ProjCoord.xy + float2(0.0f, dx)).r + SHADOW_EPSILON < depth) ? 0.2f : 1.0f; float s3 = (tex2D(ShadowSample, ProjCoord.xy + float2(dx, dx)).r + SHADOW_EPSILON < depth) ? 0.2f : 1.0f; float shadowCoeff = lerp( lerp( s0, s1, lerps.x ), lerp( s2, s3, lerps.x ), lerps.y ); return float4((LightColor * ResultColor * Diffuse + float4((LightColor*0.4f).xyz, 1.0f) * ResultColor * (1.0f - Diffuse)).xyz * s0, 1.0f); } //----------------------------------- technique textured { pass p0 { StencilEnable = false; ZFunc = LessEqual; VertexShader = compile vs_2_0 VS(); PixelShader = compile ps_2_0 PS(); } } Here is a picture taken from the lights position, and as you can se, all is not right in this screen (yes I have only one light :D) The grid is shown only to ease up the depth perception. So, if you can get anything from this please give me an answer, but if yu need to know more info, please do not hesitate to write that to and I will try to fill you in. Thanks for all the replies.
  14. Darn, you're right guys. Ofcourse that is my problem. Fuck, been working on ths thing for over 3 months, and got deadline in 4 weeks, and at the moment my keyboard are recovering from water damage. Well, will be looking into this as soon as my keyboard has recovered, and i thank you for stating the obvious. Thanks a lot again.
  15. Hi, I got a problem with my height painting in my editor. I can raise and lower the height at the terrain, and I am also supposed to be able to smooth and flatten the terrain where I want. The flatten works out nicely, the easy part ofcourse ;). Well, I have trouble to smooth my vertecies the way I want. With this algorythm, the vertecies keeps smoothing as long as I tell them to smooth, until they have hit the height of 0, even when there is nothing to smooth (Hope you get it ;D). Here is my code: if(m_PickedVertex.size()) { float TempY = 0.0f; int NrOfSiblings = 0; //go through each of the picked vertex for(int i = 0; i < static_cast<int>(m_PickedVertex.size()); i++ ) { //step through each of teh vertex sibling, including itself for(int j = 0; j < 9; j++) { //make sure that the sibling in question isnt outside range if(m_PickedVertex[i]->m_VertexSiblings[j] > 0 && m_PickedVertex[i]->m_VertexSiblings[j] < m_NumVertecies) { //add one to numbers of siblings height added NrOfSiblings++; //add the height of the vertex sibbling TempY += m_EditorBuffer[m_PickedVertex[i]->m_VertexSiblings[j]].Pos.y; } } //bring forth the averege height difference of all the vertecies TempY /= NrOfSiblings; TempY -= m_PickedVertex[i]->Pos.y; //scale down to make the change in height minor in realtime and then add the differense to the specific vertex m_PickedVertex[i]->Pos.y += (TempY / 100.0f); } } Well, that was the code :D Here I have some screenshots: Here is where I start, the ground flattend and nice :D Here I tried to smooth the terrain, but with a flatten terrain nothing should happen, but as you see, there is a crate now. If I just keep smoothing, after a little time, the lowering wears of, and the new height is just at the height 0. Can someone check on my algorythm and say what im doing wrong. Thanks for the help PS: sry for the small images, new to imageshack :D [Edited by - CAPE on April 13, 2007 4:54:27 AM]