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

AhmedSaleh

Members
  • Content count

    125
  • Joined

  • Last visited

Community Reputation

190 Neutral

About AhmedSaleh

  • Rank
    Member
  1. I'm doing the following : Ogre::TexturePtr * ogreTexture = mOgreContentRenderer->getTextures(); pDeviceResources->GetD3DDeviceContext()->CopySubresourceRegion( cameraBackBuffer.Get(), LeftEye, 0, 0, 0, ((Ogre::D3D11Texture*)ogreTexture[LeftEye].get())->GetTex2D(), 0, 0 ); pDeviceResources->GetD3DDeviceContext()->CopySubresourceRegion( cameraBackBuffer.Get(), RightEye, 0, 0, 0, ((Ogre::D3D11Texture*)ogreTexture[RightEye].get())->GetTex2D(), 0, 0 );   But that's pretty slow, I would like to wrap the render texture from ogre and feed it to the backbuffer of HoloLens ? is there a faster way ?    
  2. here is a video that shows the problem   https://youtu.be/vB9ydZ5J_Ps
  3. I'm cloning centipede, I'm having a problem with state machine I would like to move left then down the move right, then move down, then move left private function moveIt(e:TimerEvent):void { for (var i:int = 1; i < 5; ++i) { if (m_nodes[i].y < 40 && m_nodes[i].x < 40) { m_nodes[i].current_dir = Element.DOWN; } else if (m_nodes[i].y > 560 && m_nodes[i].x > 40) { m_nodes[i].current_dir = Element.DOWN; } else if (m_nodes[i].x > 700 - 10) { m_nodes[i].current_dir = Element.DOWN; } if (m_nodes[i].current_dir == Element.RIGHT) { m_nodes[i].vx = 5; m_nodes[i].vy = 0; } else if (m_nodes[i].current_dir == Element.LEFT) { m_nodes[i].vx = -5; m_nodes[i].vy = 0; } else if (m_nodes[i].current_dir == Element.DOWN) { m_nodes[i].current_dir = Element.RIGHT; m_nodes[i].vx = 0; m_nodes[i].vy = 5; } m_nodes[i].x += m_nodes[i].vx; m_nodes[i].y += m_nodes[i].vy; } }    
  4. I have a web service, WFS. I use a library called GDAL for retrieving the data from the server. Here is how I do it. OGRDataSource *m_wfs_t; m_wfs_t = OGRSFDriverRegistrar::Open("WFS:http://192.168.139.129/cgi-bin/tinyows.exe",true); // Declare an object to refer to Layers returned from the WFS OGRLayer *Layer; int cnt = m_wfs->GetLayerCount(); cnt--; while(cnt >= 0 ) { Layer = m_dataset->GetLayer(cnt--); // Declare variable for reading the features from a WFS layer OGRFeature *Feature; // Reset Reading (Although not necessary now because it hasnt been read yet, this is good practice before reading WFS data) Layer->ResetReading(); while( (Feature = Layer->GetNextFeature()) != NULL ) { // Variable initialised to contain the definitions of all of the fileds in the WFS Layer OGRFeatureDefn *FeatureDefinition = Layer->GetLayerDefn(); for( int i = 0; i < FeatureDefinition->GetFieldCount(); i++ ) { // Variable initialised to contain field data at the current index of i OGRFieldDefn *FieldDefinition = FeatureDefinition->GetFieldDefn(i); if(FieldDefinition->GetType() == OFTInteger) { std::cout << Feature->GetFieldAsInteger(i) << ","; } else if(FieldDefinition->GetType() == OFTReal) { std::cout << Feature->GetFieldAsDouble(i) << ","; } else if( FieldDefinition->GetType() == OFTString ) { std::cout << Feature->GetFieldAsString(i) << ","; } else { std::cout << Feature->GetFieldAsString(i) << ","; } } // Variable initialised to contain Geometry point data for the field at the current index of i OGRGeometry *Geometry = Feature->GetGeometryRef(); if(Geometry != NULL && wkbFlatten(Geometry->getGeometryType()) == wkbPoint) { OGRPoint *Point = (OGRPoint *) Geometry; // Maybe need to limit the number of decimal places for X and Y coordinates to 2-3 std::cout << Point->getX() << "," << Point->getY() << std::endl; } else { std::cout << "No Point Geometry" << std::endl; } OGRFeature::DestroyFeature( Feature ); } } I had written those interfaces: struct IData { string type(); IData* QueryInterfcae(string name); }; struct IConnection { bool Query( string data) = 0; int Write(IData *data) = 0; IData Read() = 0; void Release() = 0; }; struct IMapServer { IConnection* OpenConnection(string url ) = 0; void Release() = 0; }; I would like to know how do I get an IConnection from OpenConnection(url); Also how would I populate the data that I get from the GDAL Library and populate it to my interfaces. I'm looking for a proper design and how would I implement those interfaces. Note also how about the Client that uses a thread that always refresh the data from the server. In which place should I run that thread, and populate the interface.
  5. I have two velocity vectors in 3D and their positions, how would I check if they are colliding in 3D without using bounding sphere or any other primitive. const double tx = poi.Position().GetLongitude() - m_sPosAV.GetLongitude() / m_sVelAV.x - velocity.at(0).toDouble(); const double ty = poi.Position().GetAltitude() - m_sPosAV.GetAltitude() / m_sVelAV.y - velocity.at(1).toDouble(); const double tz = poi.Position().GetLatitude() - m_sPosAV.GetLatitude() / m_sVelAV.z - velocity.at(2).toDouble(); if (tx == 0 || ty == 0 || tz == 0) { qDebug() << "collision "; return true; } if (tx && ty && tz) { if (tx == ty) { qDebug() << "collision at that time "; return true; } else if (tx == tz) { qDebug() << "collision at that time"; return true; } } }    
  6. I have a 16bit RGB565 and I have the result from dot product and its 0->1. I would like to map the dot product value from light source to the normal vector in a mesh to 16bit color value. uint16_t floatToRGB565(float input) { uint8_t x = input*255; uint8_t r = (x&248u);//0xff-0x07, 5msb mask uint8_t g = (x&252u);//0xff-0x03, 6msb mask uint8_t b = (x&248u);//0xff-0x07, 6msb mask return (r<<8)|(g<<3)|(b>>3);// assuming r is at msb } dp = Dot_Product_3D((vector_3d_ptr)&normal, (vector_3d_ptr)&light_source); // test if light ray is reflecting off surface if (dp > 0) { float intens ; uint16_t colorMod; int r,g,b; float Red, Green, Blue, result; intensity = ambient_light + dp; if (intensity > 1) intensity = 1; if (intensity < 0) intensity = 0; r = the_object->polys[curr_poly].color >> 11; g = (the_object->polys[curr_poly].color >>5)&0x00FF; b = the_object->polys[curr_poly].color & 0x0000FF; Red = r*intensity; Green = g*intensity; Blue = b*intensity; result = (int)(Red * 31) << 11 | (int)(Green * 63) << 5 | (int)(Blue * 31); colorMod = floatToRGB565(result); the_object->polys[curr_poly].shade = colorMod; // printf("\nintensity of polygon %d is %f",curr_poly,intensity); } // end if light is reflecting off surface else{ int r,g,b; float Red, Green, Blue, result; float colorModulate; uint16_t colorMod; r = the_object->polys[curr_poly].color >> 11; g = (the_object->polys[curr_poly].color >>5)&0x00FF; b = the_object->polys[curr_poly].color & 0x0000FF; Red = r*ambient_light; Green = g*ambient_light; Blue = b*ambient_light; colorModulate = (int)(Red * 31) << 11 | (int)(Green * 63) << 5 | (int)(Blue * 31); colorMod = floatToRGB565(colorModulate); the_object->polys[curr_poly].shade = colorMod; } } // end if use flat shading
  7. so I shouldn't multiply it with radius ? that would scale the amplitude a lot 
  8. the light is normalized vector, so should I clamp the sin and cos to 0 -> 1 ?
  9. I would like to move the position of the light in a circle in 3D in the XZ plane. I have the time delta which is in milleseconds. the behaviour is the light is oscillating and flickers on the surface. here is how I do it while(!Finished) { static int cnt = 0; cnt += time*100; raster.light_source.x = (float)cos((float)2*3.14598*(float)cnt /5); raster.light_source.z = (float)sin((float)2*3.14598*(float)cnt /5); }    
  10. here is the updated code, there is flickering in the flat shading if (the_object->polys[curr_poly].shading == 1) {    float mag; float normx = normal.x; float normy = normal.y; float normz = normal.z; mag = Vector_Mag_3D((vector_3d_ptr)&normal); // compute the dot product between the light source vector // and normal vector to surface normal.x = normx / mag; normal.y = normy / mag; normal.z = normz / mag; dp = Dot_Product_3D((vector_3d_ptr)&normal, (vector_3d_ptr)&light_source); // test if light ray is reflecting off surface if (dp < 0) dp = 0; if (dp > 0) { // now cos 0 = (u.v)/|u||v| or intensity = ambient_light + ( dp / (the_object->polys[curr_poly].normal_length)); float r = (float)the_object->polys[curr_poly].color.R*intensity; float g = (float)the_object->polys[curr_poly].color.G*intensity; float b = (float)the_object->polys[curr_poly].color.B*intensity; Color color = Color(r, g, b, 1); // intensity now varies from 0-1, 0 being black or grazing and 1 being // totally illuminated. use the value to index into color table the_object->polys[curr_poly].shade =  color.ToUInt32(); // printf("\nintensity of polygon %d is %f",curr_poly,intensity); } // end if light is reflecting off surface else{ uint32_t color = the_object->polys[curr_poly].color.ToUInt32(); the_object->polys[curr_poly].shade = color;// *(int)ambient_light; } } // end if use flat shading here is a video youtu.be/siksvA1jgeY
  11. I'm getting the dot product of the surface normal and light position. The weird thing is the dot product is larger than 1. That's problem number 1. The second problem is I want to map that intensity from 0->1 to Float RGB from 0->1 here is my code if (the_object->polys[curr_poly].shading == 1) { // compute the dot product between the light source vector // and normal vector to surface dp = Dot_Product_3D((vector_3d_ptr)&normal, (vector_3d_ptr)&light_source); // test if light ray is reflecting off surface if (dp > 0) { // now cos 0 = (u.v)/|u||v| or intensity = ambient_light + ( dp / (the_object->polys[curr_poly].normal_length)); float r = the_object->polys[curr_poly].color.R*intensity; float g = the_object->polys[curr_poly].color.G*intensity; float b = the_object->polys[curr_poly].color.B*intensity; Color color = Color(r, g, b, 1); }  
  12. here is the full code it can't draw the cube correctly    http://pastebin.com/Udd1u1Bx
  13. I tried to draw a flat bottom triangle but I'm not sure if the math is correct or not    here is call and the code   void Rasterizer::DrawBottomTriangle(int x0, int y0, int x1, int y1, int x2, int y2, Color color) { float dxy_left = (x2 - x0) / (y2 - y0); float dxy_right = (x2 - x0) / (y2 - y0); // set starting and ending points for edge trace float xs = x0; float xe = x0; // draw each scanline for (int y = y0; y <= y2; y++) { // draw a line from xs to xe at y in color c DrawLine(color, (int)xs, y, color, (int)xe, y); // move down one scanline xs += dxy_left; xe += dxy_right; } // end for y } The call  raster.DrawBottomTriangle(76, 50, 90, 10, 60, 10, Color(1, 0, 0));  
  14. so the problem is I'm not covering the third case ? a general triangle ?
  15. @MarkS how would I fix it ? please ?