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

AbanoubNassem

Members
  • Content count

    12
  • Joined

  • Last visited

Community Reputation

114 Neutral

About AbanoubNassem

  • Rank
    Member
  1. what am trying to do is implementing Camera calss so I can walk and look on the world as follow: #ifndef _CAMERA_H_ #define _CAMERA_H_ #include <glm\glm.hpp> class Camera { public:     Camera();     ~Camera();     void Update(const glm::vec2& newXY);     //if by = 0.0 it means, it will use the const Class speed to scale it     void MoveForward(const float by = 0.0f);     void MoveBackword(const float by = 0.0f);     void MoveLef(const float by = 0.0f);     void MoveRight(const float by = 0.0f);     void MoveUp(const float by = 0.0f);     void MoveDown(const float by = 0.0f);     void Speed(const float speed = 0.0f);     glm::vec3& GetCurrentPosition();     glm::vec3& GetCurrentDirection();     glm::mat4 GetWorldToView() const; private:     glm::vec3 position, viewDirection, strafeDir;     glm::vec2 oldYX;     float speed;     const glm::vec3 up; }; #endif #include "Camera.h" #include <glm\gtx\transform.hpp> Camera::Camera()     :up(0.0f, 1.0f, 0.0), viewDirection(0.0f, 0.0f, -1.0f),     speed(0.1f) { } Camera::~Camera() { } void Camera::Update(const glm::vec2& newXY) {     glm::vec2 delta = newXY - oldYX;     auto length = glm::length(delta);     if (glm::length(delta) < 50.f)     {         strafeDir = glm::cross(viewDirection, up);         glm::mat4 rotation = glm::rotate(-delta.x * speed, up) *             glm::rotate(-delta.y * speed, strafeDir);         viewDirection = glm::mat3(rotation) * viewDirection;     }     oldYX = newXY; } void Camera::Speed(const float speed) {     this->speed = speed; } void Camera::MoveForward(const float by) {     float s = by == 0.0f ? speed : by;     position += s * viewDirection; } void Camera::MoveBackword(const float by) {     float s = by == 0.0f ? speed : by;     position += -s * viewDirection; } void Camera::MoveLef(const float by ) {     float s = by == 0.0f ? speed : by;     position += -s * strafeDir; } void Camera::MoveRight(const float by ) {     float s = by == 0.0f ? speed : by;     position += -s * strafeDir; } void Camera::MoveUp(const float by ) {     float s = by == 0.0f ? speed : by;     position += s * up; } void Camera::MoveDown(const float by ) {     float s = by == 0.0f ? speed : by;     position += -s * up; } glm::vec3& Camera::GetCurrentPosition() {     return position; } glm::vec3& Camera::GetCurrentDirection() {     return viewDirection; } glm::mat4 Camera::GetWorldToView() const {     return glm::lookAt(position, position + viewDirection, up); } and I update and render as follow : void Game::OnUpdate() {     glLoadIdentity();     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);     glUniformMatrix4fv(program->GetUniformLocation("modelToViewWorld"), 1, GL_FALSE, &cam.GetWorldToView()[0][0]);      } void Game::OnRender() {     model->Draw(); } where the Vertix shader: #version 410 layout (location = 0) in vec3 inVertex; layout (location = 1) in vec2 inTexture; layout (location = 2) in vec3 inNormal; uniform mat4 modelToViewWorld; void main() {         gl_Position    = vec4(mat3(modelToViewWorld) * inVertex, 1);      } but what is happening is am moving/rotating the Model it's self not the camrea around it . what am doing wrong here?  
  2. A person starts to live when he can live outside himself!!!
  3. Such an amazing movie WOW
  4. ??? ?? ???? ?????? ??? ? ??? ?????? ??? ?? ???? ???!!! :D :D
  5. Sometimes you must HURT in order to KNOW, FALL in order to GROW, LOSE in order to GAIN, because most of LIFE's greatest LESSONS are learned through PAIN.
  6. what i am trying to do is;- creating custom window and enable `OpenGL` to draw on it using `glew`, I draw the triangle fine , rotate , scale , etc fine , but when it comes to use `Shaders`, the screen start to flicker and I got wrong colors on the triangle ScreenManager Class:     void GraphicManager::CreateScreen(std::string screenName, int width, int hight, int posX, int posY)     {         WNDCLASSEX winex;         ZeroMemory(&winex, sizeof(WNDCLASSEX));              m_hInstance = m_hInstance;         m_screenName = screenName;              winex.cbSize = sizeof(WNDCLASSEX);         winex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;         winex.lpfnWndProc = MsgProc;         winex.cbClsExtra = 0;         winex.cbWndExtra = 0;         winex.hInstance = m_hInstance;         winex.hIcon = LoadIcon(NULL, IDI_APPLICATION);         winex.hCursor = LoadCursor(NULL, IDC_ARROW);         winex.hbrBackground = NULL;         winex.lpszMenuName = NULL;         winex.lpszClassName = m_screenName.c_str();         winex.hIconSm = LoadIcon(NULL, IDI_WINLOGO);              if (!RegisterClassEx(&winex))         {             MessageBox(NULL, std::string("Faild to register " + m_screenName + " class!").c_str(), NULL, NULL);             return ;         }              m_hwnd = CreateWindowEx(NULL, m_screenName.c_str(), m_screenName.c_str(), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, posX, posY, width, hight, NULL, NULL, m_hInstance, NULL);              if (!m_hwnd)         {             MessageBox(NULL, std::string("Faild to create " + m_screenName + " window!").c_str(), NULL, NULL);         }              EnableOGL();     }          void GraphicManager::EnableOGL()     {         m_hdc = GetDC(m_hwnd);              if (m_hdc == NULL)             MessageBox(NULL, "Faild to get Device Context!", "Error", NULL);              PIXELFORMATDESCRIPTOR pfd =         {             sizeof(PIXELFORMATDESCRIPTOR),             1,             PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,    //Flags             PFD_TYPE_RGBA,            //The kind of framebuffer. RGBA or palette.             32,                        //Colordepth of the framebuffer.             0, 0, 0, 0, 0, 0,             0,             0,             0,             0, 0, 0, 0,             24,                        //Number of bits for the depthbuffer             8,                        //Number of bits for the stencilbuffer             0,                        //Number of Aux buffers in the framebuffer.             PFD_MAIN_PLANE,             0,             0, 0, 0         };              int PixelFormat;         PixelFormat = ChoosePixelFormat(m_hdc, &pfd);         SetPixelFormat(m_hdc, PixelFormat, &pfd);         m_hglrc = wglCreateContext(m_hdc);              if (m_hglrc == NULL)             MessageBox(NULL, "Faild to get OpenGL Context!", "Error", NULL);              if (!wglMakeCurrent(m_hdc, m_hglrc))         {             MessageBox(NULL, "Faild to Create OpenGL Context!", "Error", NULL);         }              if (glewInit() != GLEW_OK)             MessageBox(NULL, "Faild to Init GLEW!", "Error", NULL);              ShowWindow(m_hwnd, SW_SHOW);         UpdateWindow(m_hwnd);     }          void GraphicManager::RunScreenMainLoop()     {         m_game->Init();         while (WM_QUIT != msg.message)         {             if (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))             {                 TranslateMessage(&msg);                 DispatchMessage(&msg);             }             else             {                 m_game->Update();                 m_game->Render();                 SwapBuffers(m_hdc);             }         }          } ShaderManager Class:     void ShaderManager::Load(const std::string& file, GLenum shaderType)     {         if (!isProgramCreated)         {             program = glCreateProgram();             isProgramCreated = true;         }              std::ifstream fil(std::string(path + file).c_str());              if (fil.is_open())         {             std::string output;             char buf[256];             while (!fil.eof())             {                 fil.getline((buf), 256, '\n');                 output.append(std::string(buf) + '\n');             }                  GLuint shader = glCreateShader(shaderType);                  if (shader == 0)             {                 //std::exception("craete shader faild");                 return;             }                  const GLchar* shaderSourceStrings[1];             GLint shaderSourceStringLengths[1];                  shaderSourceStrings[0] = output.c_str();             shaderSourceStringLengths[0] = output.length();                  glShaderSource(shader, 1, shaderSourceStrings, shaderSourceStringLengths);             glCompileShader(shader);             GLint shader_ok;             glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok);             if (!shader_ok)             {                 fprintf(stderr, "Failed to compile %s:\n", file.data());                 show_info_log(shader, glGetShaderiv, glGetShaderInfoLog);                 glDeleteShader(shader);                 return;             }                  glAttachShader(program, shader);                  //glBindAttribLocation(program, 0, "position");                  glLinkProgram(program);                  GLint program_ok;             glGetProgramiv(program, GL_LINK_STATUS, &program_ok);             if (!program_ok)             {                 fprintf(stderr, "Failed to link shader program:\n");                 show_info_log(program, glGetProgramiv, glGetProgramInfoLog);                 glDeleteProgram(program);                 return;             }                  glValidateProgram(program);//check valdiet                  shaders[Utilities::SplitString(file, '.')[0]] = shader;             fil.close();         }         else         {             //std::exception(std::string("Faild to load" + file).c_str());         }     }          void ShaderManager::BindShaders()     {         glUseProgram(program);     } and the Game Class:     void Game::Init()     {                       glClearColor(0, 0, 0, 1);         glMatrixMode(GL_PROJECTION);         glLoadIdentity();         gluPerspective(50, 640.0 / 480.0, 1, 1000);         glMatrixMode(GL_MODELVIEW);         glEnable(GL_DEPTH_TEST);              engine->getShaderManager()->setPath("..\\Debug\\Engine\\Shaders\\");         engine->getShaderManager()->Load("VertexShader.vs", GL_VERTEX_SHADER);         engine->getShaderManager()->Load("FragmentShader.vs", GL_FRAGMENT_SHADER);         engine->getShaderManager()->BindShaders();     }               void Game::Update()     {               }          void Game::Render()     {         glLoadIdentity();         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);                       glBegin(GL_TRIANGLES);         glVertex3f(0, 1, -4);         glVertex3f(-1, -1, -4);         glVertex3f(1, -1, -4);         glEnd();     } VertixShader :     void main()     {         gl_Position=gl_ModelViewProjectionMatrix*gl_Vertex;     } FragmentShader :     void main()     {         gl_FragColor=vec4(1.0,0.0,0.0,1.0);     } the final result should be a red triangle , but what am getting is mixed color triangle with flickering on the screen! am not sure what am missing here!
  7. I'm trying to draw a triangle using `OpenGL` , but it's keep flickering with wrong color , here is my code : // my generic vector class template <class T> struct Vector3D { T X; T Y; T Z; Vector3D(){ X = 0; Y = 0; Z = 0; } Vector3D(T x, T y, T z){ X = x; Y = y; Z = z; } Vector3D(T x, T y){ X = x; Y = y; Z = 0; } ....... } //here where I init the model data and send it to the opengl void Model::Init(std::vector<Vector3D<float>> vertices, std::vector<Vector3D<float>> uvs, std::vector<Vector3D<float>> normals, std::vector<Face> faces) { std::vector<Vector3D<float>> drawVertices; if (!faces.empty()){ for (size_t i = 0; i < faces.size(); i++) { drawVertices.push_back(vertices[faces[i].VerticesIndex[0]]); drawVertices.push_back(vertices[faces[i].VerticesIndex[1]]); drawVertices.push_back(vertices[faces[i].VerticesIndex[2]]); if (faces[i].IsQuad) drawVertices.push_back(vertices[faces[i].VerticesIndex[3]]); } } else { drawVertices = vertices; } verticesSize = drawVertices.size(); glGenVertexArrays(1, &vertexArray); glBindVertexArray(vertexArray); glGenBuffers(1, &generatedBuffer); glBindBuffer(GL_ARRAY_BUFFER, generatedBuffer); glBufferData(GL_ARRAY_BUFFER, drawVertices.size() * sizeof(drawVertices[0]), &drawVertices[0], GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0); glBindVertexArray(0); } //here is how am drawing it void Model::Draw() { if (!isInited) { Init(tempVertices, tempUVs, tempNormals, tempFaces); isInited = true; tempVertices.clear(); tempUVs.clear(); tempNormals.clear(); tempFaces.clear(); } glBindVertexArray(vertexArray); glDrawArrays(GL_TRIANGLES, 0, verticesSize); glBindVertexArray(0); } //the fragmentshader #version 120 void main() { gl_FragColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); } //the obj file data v -0.5 -0.5 0.0 v 0.0 0.5 0.0 v 0.5 -0.5 0.0 result is a wrong colored flickering triangle where it should be red triangle without flickering! http://i.stack.imgur.com/KXKwW.jpgjpg
  8. Justice without power is empty ,but power without justice is only violence.
  9. [quote name='Lauris Kaplinski' timestamp='1352144591' post='4997697'][list=1] [*]What does camera() do? Are you sure you are setting up ModelView and Projection matrices properly. [*]Can you check in debugger or using debug printout how many quads it adds to your list? [*]You are setting vertex coordinates twice instead of vertex+normal, but this should not be your problem. [/list] [/quote] 1- [source lang="cpp"]void camera (void) { glRotatef(xrot,1.0,0.0,0.0); //rotate our camera on teh x-axis (left and right) glRotatef(yrot,0.0,1.0,0.0); //rotate our camera on the y-axis (up and down) glTranslated(-xpos,-ypos,-zpos); //translate the screen to the position of our camera }[/source] so I can walk through the whole scene! and yes am setting up ModelView and Projection matrices properly. 2- I can but idk how to do it [img]http://public.gamedev.net//public/style_emoticons/default/huh.png[/img] 3-fixed it
  10. am trying to load an obj model : [source lang="plain"]# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware # File Created: 05.11.2012 20:07:48 mtllib test.mtl # # object Box001 # v -12.6264 0.0000 -58.6877 v -12.6264 0.0000 6.8357 v 43.9557 0.0000 6.8357 v 43.9557 0.0000 -58.6877 v 43.9557 -51.9219 6.8357 v -12.6264 -51.9219 6.8357 v -12.6264 -51.9219 -58.6877 v 43.9557 -51.9219 -58.6877 # 8 vertices vn 0.0000 1.0000 -0.0000 vn 0.0000 -1.0000 -0.0000 vn 0.0000 0.0000 1.0000 vn 1.0000 0.0000 -0.0000 vn 0.0000 0.0000 -1.0000 vn -1.0000 0.0000 -0.0000 # 6 vertex normals vt 0.0000 65.5234 0.0000 vt 0.0000 0.0000 0.0000 vt 56.5821 0.0000 0.0000 vt 56.5821 65.5234 0.0000 vt 0.0000 -51.9219 0.0000 vt 56.5821 -51.9219 0.0000 vt 65.5234 0.0000 0.0000 vt 65.5234 -51.9219 0.0000 # 8 texture coords g Box001 usemtl wire_229154215 s 2 f 1/1/1 2/2/1 3/3/1 4/4/1 s 4 f 5/2/2 6/3/2 7/4/2 8/1/2 s 8 f 3/3/3 2/2/3 6/5/3 5/6/3 s 16 f 4/7/4 3/2/4 5/5/4 8/8/4 s 32 f 1/3/5 4/2/5 8/5/5 7/6/5 s 64 f 2/7/6 1/2/6 7/5/6 6/8/6 # 6 polygons[/source] I have a class called Model : [source lang="cpp"]#ifndef _Model_H_ #define _Model_H_ #include <vector> struct Coordinate{ float X,Y,Z; Coordinate(float x,float y,float z); }; struct TextureCoordinate{ float U,V; TextureCoordinate(float u,float v); }; struct Face { int VertexIndex,TextureIndex,NormalIndex; Face(int vi, int ti, int ni); }; class Model { public: Model(void); ~Model(void); bool IsTriangle; std::string Name; std::vector<Coordinate> Vertices; std::vector<Coordinate> VerticesNormals; std::vector<Coordinate> VerticesTexture; std::vector<Face > Faces; int ModelNumber; }; #endif[/source] and am trying to load it like this :- [source lang="cpp"]Model ModelsLoader::LoadModel(const char * ModelName){ std::ifstream fs(ModelName); char temp[256]; std::string * line; Model m; float tempX,tempY,tempZ; int tempA1,tempA2,tempA3,tempA4; if(fs.is_open()){ while (!fs.eof()) { fs.getline(temp,256); Lines.push_back(new std::string(temp)); } int c,slashes; for (int i = 0; i < Lines.size(); i++) { line = Lines[i]; if(line->size() == 0 ||(*line)[0] == '#' ) continue; else if((*line)[0] == 'v' && (*line)[1] == ' ') { sscanf(line->c_str(),"v %f %f %f",&tempX,&tempY,&tempZ); m.Vertices.push_back( Coordinate(tempX,tempY,tempZ)); } else if((*line)[0] == 'v' && (*line)[1] == 't'){ sscanf(line->c_str(),"vn %f %f %f",&tempX,&tempY,&tempZ); m.VerticesTexture.push_back( Coordinate(tempX,tempY,tempZ)); } else if((*line)[0] == 'v' && (*line)[1] == 'n'){ sscanf(line->c_str(),"vn %f %f %f",&tempX,&tempY,&tempZ); m.VerticesNormals.push_back( Coordinate(tempX,tempY,tempZ)); } else if((*line)[0] == 'f' && (*line)[1] == ' ') { c = std::count(line->begin(),line->end(),' ') - 1; slashes = std::count(line->begin(),line->end(),'/'); if( slashes / c == 2){ int i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12; sscanf(line->c_str(),"f %d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d",&i1,&i2,&i3,&i4,&i5,&i6,&i7,&i8,&i9,&i10,&i11,&i12); m.Faces.push_back(Face(i1-1,i2-1,i3-1)); m.Faces.push_back(Face(i4-1,i5-1,i6-1)); m.Faces.push_back(Face(i7-1,i8-1,i9-1)); m.Faces.push_back(Face(i10-1,i11-1,i12-1)); m.IsTriangle = false; } else if (slashes / c == 3) { int i1,i2,i3,i4,i5,i6,i7,i8,i9; sscanf(line->c_str(),"f %d/%d/%d %d/%d/%d %d/%d/%d",&i1,&i2,&i3,&i4,&i5,&i6,&i7,&i8,&i9); m.Faces.push_back(Face(i1-1,i2-1,i3-1)); m.Faces.push_back(Face(i4-1,i5-1,i6-1)); m.Faces.push_back(Face(i7-1,i8-1,i9-1)); m.IsTriangle = true; } } } fs.close(); m.ModelNumber = glGenLists(1); glNewList(m.ModelNumber, GL_COMPILE); for (int i = 0; i < m.Faces.size(); i++) { if(m.IsTriangle){ } else { glBegin(GL_QUADS); for (int i = 0; i < m.Faces.size(); i++) { glVertex3f(m.VerticesNormals[m.Faces[i].NormalIndex].X,m.VerticesNormals[m.Faces[i].NormalIndex].Y,m.VerticesNormals[m.Faces[i].NormalIndex].Z); glVertex3f(m.Vertices[m.Faces[i].VertexIndex].X,m.Vertices[m.Faces[i].VertexIndex].Y,m.Vertices[m.Faces[i].VertexIndex].Z); } glEnd(); } } glEndList(); } Clear(); return m; }[/source] now when I call the list it's not showing anything:- [source lang="cpp"]void drawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective glLoadIdentity(); //Reset the drawing perspective camera(); glCallList(model.ModelNumber); glutSwapBuffers(); //Send the 3D scene to the screen }[/source] what am doing worng here!?
  11. here is my BlowFishCrypto Class [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Math; namespace Common.Encryption { public class BlowfishCryptographer { private bool forEncryption; private IBufferedCipher cipher; public BlowfishCryptographer(bool forEncryption) { this.forEncryption = forEncryption; cipher = new BufferedBlockCipher(new CfbBlockCipher(new BlowfishEngine(), 64)); cipher.Init(forEncryption, new ParametersWithIV(new KeyParameter(Encoding.ASCII.GetBytes("DR654dt34trg4UI6")), new byte[8])); } public void ReInit(byte[] IV,BigInteger pubkey) { cipher.Init(forEncryption, new ParametersWithIV(new KeyParameter(pubkey.ToByteArrayUnsigned()),IV)); } public byte[] DoFinal() { return cipher.DoFinal(); } public byte[] DoFinal(byte[] buffer) { return cipher.DoFinal(buffer); } public byte[] DoFinal(byte[] buffer, int startIndex, int len) { return cipher.DoFinal(buffer, startIndex, len); } public byte[] ProcessBytes(byte[] buffer) { return cipher.ProcessBytes(buffer); } public byte[] ProcessBytes(byte[] buffer, int startIndex, int len) { return cipher.ProcessBytes(buffer, startIndex, len); } public void Reset() { cipher.Reset(); } } }[/code] in my other class i tried to test it so i made it like this [code] BlowfishCryptographer incomingCipher=new BlowfishCryptographer(true); BlowfishCryptographer outgoingCipher=new BlowfishCryptographer(false); byte[] buffer = new byte[] { 0x83, 0x00, 0xEE, 0x03, 0x26, 0x6D, 0x14, 0x00, 0xF1, 0x65, 0x27, 0x00, 0x19, 0x02, 0xD8, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0xD7, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x41, 0x00, 0x64, 0x00, 0xE4, 0x00, 0x00, 0x00, 0xDD, 0x0A, 0x18, 0x19, 0x00, 0x00, 0x79, 0x91, 0x87, 0x00, 0x00, 0x01, 0x00, 0xA8, 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x34, 0x00, 0x6A, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0A, 0x7E, 0x42, 0x6C, 0x75, 0x65, 0x57, 0x61, 0x76, 0x65, 0x7E, 0x00, 0x09, 0x42, 0x6C, 0x61, 0x63, 0x6B, 0x44, 0x75, 0x73, 0x74 }; Console.WriteLine("\n\nBuffer\n" + outPutHex.ToHex(buffer)); Console.WriteLine("\n\nBuffer enc\n" + outPutHex.ToHex(outgoingCipher.DoFinal(buffer))); Console.WriteLine("\n\nBuffer dec\n" + outPutHex.ToHex(incomingCipher.DoFinal(buffer)));[/code] outputhex func will out put the result as hex [code] public static String ToHex(byte[] buf) { var builder = new StringBuilder(); foreach (var b in buf) builder.Append(b.ToString("X2")+ " "); return builder.ToString(); } [/code] so the result is: [code] Buffer 83 00 EE 03 26 6D 14 00 F1 65 27 00 19 02 D8 0F 00 00 00 00 00 00 DB D7 0F 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2B 04 00 00 00 00 00 00 07 00 41 0 0 64 00 E4 00 00 00 DD 0A 18 19 00 00 79 91 87 00 00 01 00 A8 02 00 00 64 00 00 00 34 00 6A 18 00 00 00 00 00 00 C2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 0A 7E 42 6C 75 65 57 61 76 65 7E 00 09 42 6C 61 63 6B 44 75 73 74 Buffer enc EB 28 65 06 EF B5 B9 3E 01 2F D0 B4 C2 25 4C 9C E2 05 D8 B5 93 AC F9 0F 92 87 8B 5D 1E 45 F6 59 F8 FE 57 A8 0D CF 6C 6B E8 8D F9 88 A6 1D 6D 05 CC B8 6A 9F B0 8 D 13 70 AB F6 3F F8 DD EA ED 16 C3 DB A6 77 B2 46 29 0B DA F4 E2 FF A4 BA 6F C0 06 28 71 57 08 C8 EC 0F 65 54 13 46 C1 23 08 A5 28 C9 9F 9F 1D AD F9 66 09 A7 3B E3 22 64 A3 A0 8C 90 BC 1A 99 F1 4F F6 73 49 32 10 78 7D CF FF 68 01 75 Buffer dec EB 28 65 06 EF B5 B9 3E B7 BE A2 2A 3D 92 5F D5 CF E3 D5 09 C0 5B 9D AD 01 D6 E4 6D 73 3A 66 59 A9 83 10 11 80 FE 31 48 68 28 A0 01 C9 D8 AD 3E 38 B7 42 4B E5 E 5 56 44 99 91 E8 72 F0 C9 2B AF 83 8C 35 33 6E 08 CA 1E F0 3F 59 E8 64 8D A6 1C CE 6E FF DC D6 3A FC D0 80 5B 36 81 06 FA 4E 0F 0B FA 54 CA C0 AD 32 52 68 28 8B 05 CA D2 D3 7C 90 48 93 71 99 CE 28 0B 38 F2 8E 93 74 2F B1 67 9E 68 3F[/code] it's not working but why?
  12. [code]var dhparams = new DHParameters( new BigInteger("E7A69EBDF105F2A6BBDEAD7E798F76A209AD73FB466431E2E7352ED262F8C558F10BEFEA977DE9E21DCEE9B04D245F300ECCBBA03E72630556D011023F9E857F"), new BigInteger("05")); var genparams = new DHKeyGenerationParameters(new SecureRandom(), dhparams); var generator = new DHKeyPairGenerator(); generator.Init(genparams); var pair = generator.GenerateKeyPair(); var pubkey = (DHPublicKeyParameters)pair.Public; //so public key pubkey.Y[/code] am geting error [indent] [code]An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll[/code] stack in [code]var dhparams = new DHParameters(....` [/code] [/indent] I don't know what's wrong it's my 1st time though , also pubkey.Y is the public key right? thanks
  13. [quote name='hplus0603' timestamp='1307060403' post='4818918'] If you run "netstat -napl -t tcp" when the server is running, does the server show up as listening? Why are you specifying a specific IP address to the endpoint for listening? Generally, you want to listen on 0.0.0.0 which means "all interfaces." Also, I seem to recall that your socket needs to be open()-ed before you can pass it into accept(), but I'm not 100% sure. [/quote] the client is blocking anyconnection through "127.0.0.1" or so therefor am using an IP, and i dont think there is something wrong with the socket since it's working and the Receive() method is receiving but it's not calling handl_Receive() so i can use this data got me?
  14. well, i made a static-lib. and i created this three classes in Connection [url="http://pastebin.com/Ea9nLFUw"]http://pastebin.com/Ea9nLFUw[/url] ConnectionFactory [url="http://pastebin.com/jeAg0cr7"]http://pastebin.com/jeAg0cr7[/url] Server [url="http://pastebin.com/x2ywkKCy"]http://pastebin.com/x2ywkKCy[/url] and i drevid from the static-lib and used this classes and it's working perfect in my main.cpp [code] #include <iostream> #include "auth_proto.h" #include <Server.h> #include <ConnectionFactory.h> #include "AuthConnectionFactory.h" using namespace std; int main() { Auth_Setup(); try { boost::asio::io_service io_service; boost::shared_ptr<ConnectionFactory> fact (new AuthConnectionFactory(io_service)); Server s(io_service,"5.113.195.156",9959,fact); io_service.run(); } catch (std::exception& e) { std::cerr << e.what() << std::endl; } return 0; }[/code] but the Receive() method is not invoking the handle_Receive() method!, can some one tell me what am doing wrong here!!!!???
  15. [quote name='Antheus' timestamp='1305929475' post='4813663'] Just [url="http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/tutorial/tutdaytime6.html"]the calls[/url]. [url="http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/tutorial.html"]Basic overview[/url]. [url="http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio.html"]The rest.[/url] [/quote] thnx i appreciate it. the calls link u send me is for UPD is it the same for the TCP? and it's an asynchronous while i needs it asynchronous coz it's a server for a gameserver