Jump to content
  • Advertisement

Grey Temchenko

  • Content Count

  • Joined

  • Last visited

Community Reputation

132 Neutral

About Grey Temchenko

  • Rank
  1. Grey Temchenko

    Voxels Theory

    Sorry, not sure that i understand what you mean? I cull faces only once? Or every frame? And main question, how to store voxels data for best further drawing? If i correct, i need every frame draw only voxels from frustum but cull invisible faces, and in this time hide whole block that underground? Please can you tell how you draw blocks? With ready meshes or with textured triangles with native OpenGL\DIrectX methods?
  2. Grey Temchenko

    Voxels Theory

    Thanks i will check out hashing method.     MalboroKing, thanks for code, but anyway my friend already did something similar. The question is how to store this data and best way to draw it? Event if you have 16x128x16 voxels i believe you don't draw all of them. You don't need draw underground blocks at all. As you noticed i must take visible blocks from frustum and cull invisible faces, right? Ok i think it will gain some FPS. But back to chunks, how i should store this data? I thought octree(or Spatial hashing structure) can help me. But i can't understand what kind of information keeps every leaf? The whole voxel block? Or bottom face triangle of front voxel side?  
  3. Grey Temchenko

    OpenGL Voxels Theory

    Hi there. It is about one week i read different articles, faqs, check sources about voxel scene representation. There are tons of advices how to draw scene with best fps. But now im confused with all of this and maybe someone here can clear it? I use Ogre3d engine and most people says that need draw objects with ManualObject what is wrapper around (opengl sample) glBegin(GL_TRIANGLES); glColor3f(0.1, 0.2, 0.3); glVertex3f(0, 0, 0); glVertex3f(1, 0, 0); glVertex3f(0, 1, 0); glEnd(); Make own meshes with primitives.   The next big improvement is octree. Ogre has plugin OctreeSceneManager with frustum culling. I check many youtube videos, read articles, but i can't see the same picture of octree like in youtube videos. Cause of this, i think, is what i put to scene node whole mesh but octree works with vertices of meshe? right? I can't understand what element i should put to octree? And if i have complete mesh how i can split it and put to octree nodes? I have tried create 32x32x32 block of triangles and each put to Octree Scene node and eventually get stack overflow but other peoples put there much more vertices. Thanks for any advices :)
  4. Grey Temchenko

    Game loop tick count

    Ok, thanks i will try.
  5. Grey Temchenko

    Game loop tick count

    At home i have a link to site with nice pictures that describe what you say If i have code that supports 100fps(for example) and can run update loop 25 times\sec, that ok. But if sometimes in some scenes update will take much time, and it can't run 25 times, instead it make 15\sec updates or 5\sec... Is it real? Or these methods resolve this trouble with accumulate variable?
  6. Grey Temchenko

    Game loop tick count

    Wow that something new... I still can't grasp my example, and here is new one, this blow my mind) What the difference?
  7. Grey Temchenko

    Game loop tick count

    So if my computer able to run with >= 25 frames\sec this mean updateGameState will call 25 times\sec? Should i get user input inside updateGameState? Because if this loop really runs 25 times i can change, for example client position on speed \ 25. And render with prediction to smooth movement. This mean after 25 loops it move on full speed location. But if computer unable to support this 25 frames, i'll get random count of loop runs? How then i can calculate speed for every step?
  8. Grey Temchenko

    Game loop tick count

    Hi there, the most common way to implement game loop around internet is const int FPS = 25; const int FrameDuration = 1000 / FPS; const int MaxFrameSkip = 5; long nextFrameTime = time(); float interpolation; int loops; while( isGameRunning ) { loops = 0; while( time() > nextFrameTime && loops < MaxFrameSkip ) { updateGameState(); nextFrameTime += FrameDuration; loops++; } interpolation = .....; render(interpolation); } The author says that updateGameState() calls 25 times per second, now less, no more. In my mind this mean that while should run 25 times. Am i wrong? According to loops variable there is restriction on 5 runs. So how there can be 25 times per second? And if this mean, that user input catch inside updateGameState also 25 times\sec?
  9. Grey Temchenko

    How do i determine send/recv buffer size

    My server did it in this way, packet: byte - packet id signed short (2 bytes) - packet size body (N bytes) - packet body   First alloc any size you want, put there required information, when you done, set packet id, calculate size of output buffer and set it to 2,3d bytes.   If your packet has constant size, and has id = 1, for example: id(byte) size(sshort) account(char 16) password(char 16) save_password(byte(bool)) total 36 bytes, there are always 36 bytes, and you know that client have to read 36 bytes for packet with id 1.   If you have dynamic size packet with id 2: id(byte) size(sshort) message(string) You have always 3 bytes in begin and some bytes in the end. You make dynamic buffer, put there your string, for example("Hello, there!") - 13 bytes. And set it to packet. id: 2 size: 16 message: "Hello, there!" You read first 3 bytes to get id, and size, and then read whole string.   But i guess dynamic strings you can set only to last value. If you have string in middle of the packet, you should know about that and set constant size for this string.
  10. Grey Temchenko

    Frame\Time based client\server movement

    Yeah of course, packet sequences, encryption and etc this is future improvement, but now it's advanced functionality for me. This time i want to create client <=> server communication even with lags and correct process data. I read all yours advices and go to try make something. Thanx. If i'll stuck with other issue, i wll ask here.
  11. Grey Temchenko

    Frame\Time based client\server movement

    Ok, thanks i will use this article! But i still can't imagine how move character on client( Sorry. According to this article and the words above, i don't send data from client, so in basic way i send only packet like "Move forward request", server get this packet, check client orientation, try to move, check collision and etc, and answer back wit "OK\FAIL" packet. Is it correct? If so, how abount "strafe" - simultaneously moving to forward\back and left\right, it will be separeted packets obviously, first to forward\back, second to left\right? Or make single packet like "Strafe forward|left request"? And question about speed again. When i first time connect to game, make move, client send packet "Move forward request", until i get answer, obviously, i can't move because i don't know speed. I guess server response like "Move OK, speed 2", i save local this speed and then make prediction to move client smoothly on 2 each time, when i change speed, server send new speed, i have to rewrite old speed and use new one to prediction? Right? Without any experience i can't picture this proccess in my head so i don't know which way to go((
  12. Grey Temchenko

    Frame\Time based client\server movement

    I do it for myself) And i don't use any phys engines because for now, my purpose is to get basic experience in gamedev, and now i don't even try to implement some physic. On my test client i did basic movement conditions. Hard pseudocode)) move_matrix(1.23, 0, 2.4); //for example client move forward in this direction if(aabb.horizontal_collision) move_matrix(0, Y, 0); //reset X,Z move if(aabb.vertical_collision) move_matrix(X, 0, Z); //reset Y move doMove(move_matrix); It's very simple and, i guess, one of the worst approaches, but it works) For now... So now, my physic requirements is only simple moving.   About dynamic speed, if sometimes i get it, it would be great)   All speeds will keep on server in dynamic loaded scripts, so client don't know about new object and his speed until something happened) I don't know what. If i just connected the game and make first move, how i know how far i should move client(sample above move_matrix)? Now my client sample do it in this way // If this is the first frame, pick a speed if (evt.timeSinceLastFrame == 0) { this -> _move_scale = 1; this -> _rot_scale = 0.1; // Otherwise scale movement units by time passed since last frame } else { this -> _move_scale = this -> _move_speed * evt.timeSinceLastFrame; this -> _rot_scale = this -> _rotate_speed * evt.timeSinceLastFrame; } I take it from some Ogre example. And now i have Frame based movement, right? One man give me this article http://www.koonsolo.com/news/dewitters-gameloop/ and author says that this is bad decision, and i think the best way is last method "Constant Game Speed independent of Variable FPS". Is it mean that i in update_game ask server for speed, for new location, and then in display_game i show it?
  13. Hi there :) Let me first explain my goal. I have experience in dev, so this topic is not for code suggestion, but if there are some examples about my question, i will be appreciated. So... For now i have self made C# server part, and some test cases and some samples of client on C++. But im totally new in gamedev. I have read many tutorials, ask this question on other forum but still can't figure out how to. I hope someone of you can help me. Client: 3d game world, coords double x, y, z. Question is the next. What is the best way to simulate client movement? But there are few conditions. Im not sure if this can be done at all, but... I want to make dynamic speed for clients(e.g. client on vechicle, client on fast mount, client on slow mount). My server supports dynamic scripts, so in theory i can make new vechicle and set speed what i want, but i don't know how client know about that? This is not required part) If this is immposible, so ok. Next, i cant figure out what is the common way to make player move with prediction and in the same time ask to server. My last thought was: for example i stay on (10,10,0), press forward(on X axis), and get(1, 0, 0). And this is my first trouble, why 1? How client knows how far move camera? For example in walk i move with +1, in vechicle +10, in mount +5. But this values are genuine only for server, right? I can't alvays move on client with this speed. One client may have 50FPS and move slover, than client with 100FPS, but in new location 100FPS can fall to 40 and so on... Is this mean that i should dublicate speeds array to client, and calculate it depending on current FPS and use Frame based movement? And also i have read few nearby posts and ther are people say, that i should send only packet like "Forward pressed". How then i should calculate prediction if i don't know how far i move? Sorry for my awful english :)
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!