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

dEgle95

Members
  • Content count

    13
  • Joined

  • Last visited

Community Reputation

131 Neutral

About dEgle95

  • Rank
    Member
  1. I meant if it is a right thing to implement:) [quote name='hplus0603' timestamp='1352138595' post='4997650'] The main challenge I can see with that is detecting whether a packet was dropped. If I send a packet to you, and there's no guaranteed stream of packets back, then I don't know whether you got it or not if I don't hear back from you. [/quote] For example if i send datagram with map data of file parts i will definitely number these packets, so if there is a non stable connection client can ask to resend right packet. In case of lost packets with events...players might be teleporting;-)
  2. [quote name='hplus0603' timestamp='1352047605' post='4997213'] In that case, you want to fit all events from the queue in the single UDP datagram each time you send a datagram. [/quote] I guess it's best idea to reduce traffic when sending events from server to each clients and vice versa:) [quote name='hplus0603' timestamp='1352047605' post='4997213'] Set a send rate -- 5 times a second, 20 times a second, whatever suits your game -- and stuff all the events into a single datagram for each packet you send. If there are no events, still send a packet, so you can detect connected vs disconnected users, do time management, detect dropped packets for re-tries, etc. [/quote] Will it work if i send events from client to server each frame (if there are any events) and server will send events to clients each frame, so there will be no exact rate? That way I will have to have ping-pong requests to measure latency, disconnected palyers, etc.
  3. You can also make multiple "light" blocks inside one tile. Light block can have 3 bytes for color and a byte for light level. To make it faster recalculate only if there are moving lights (like torch in hand). If you use GPU to render fancy lights then you don't need much light blocks. Only for spawning mobs for example... Be creative and you can make your own lighting engine, even more fancy than terraria has!
  4. [quote name='hplus0603' timestamp='1351986849' post='4997017'] There are as many networking systems as there are game genres, because each kind of game needs different compromises in data model richness, accuracy, throughput management, and latency compensation. Yes, it's totally fine to keep a queue of events to send on one end, send them all as one packet every so often, and then put them in a queue of events to dispatch/deal with on the receiving side. Many games work like that. If you're using TCP, beware that you have to put a length field before each "packet" that you send, because the TCP connection may/will split your send() calls into multiple recv() calls and/or combine multiple send() calls into a single recv() call. [/quote] Actually I'm using UDP, so event can fit in one packet. Thanks anyway:)
  5. Hello guys. I was wondering is there any tutorial describing how to make network support in games? Like what should server send and receive and in what order? Clients? I guess best way is to make [b]net_events[/b] like in SDL: server should translate incoming packets into events, then handle them, generate events for clients and send them back. Server and clients should have queue of events (like in SDL)...but i'm not sure if it's the best solution.
  6. Hello! Here is my function that i use in my projects. It's just a little more compact and 100% working Hope it will help you. [CODE] int check_collision(SDL_Rect *a , SDL_Rect *b) { if(b->x + b->w < a->x) return 0; //just checking if their if(b->x > a->x + a->w) return 0; //bounding boxes even touch if(b->y + b->h < a->y) return 0; if(b->y > a->y + a->h) return 0; return 1; //bounding boxes intersect } [/CODE]
  7. Oops....apparently generating format is not working, but if you take it from screen surface it'll do:) Corrected function for creating surfaces, in case someone needs it: [source lang="cpp"]SDL_Surface *create_surface(int width, int height, SDL_Surface *screen) { /* Create a 32-bit surface with the bytes of each pixel in R,G,B,A order, as expected by OpenGL for textures */ SDL_Surface *surface; surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); return surface; }[/source]
  8. Hello guys. I'm developing a small game and I've bumped into problem with SDL surfaces. I've written function for creating surfaces: [source lang="cpp"]SDL_Surface *create_surface(int width, int height) { /* Create a 32-bit surface with the bytes of each pixel in R,G,B,A order, as expected by OpenGL for textures */ SDL_Surface *surface; Uint32 rmask, gmask, bmask, amask; /* SDL interprets each pixel as a 32-bit number, so our masks must depend on the endianness (byte order) of the machine */ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { rmask = 0xff000000; gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; } else { rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; } surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, rmask, gmask, bmask, amask); return surface; }[/source] But when i try to do something with it nothing happens: [source lang="cpp"]Uint32 p_color; p_color = SDL_MapRGB(screen->format,255,255,255); SDL_Surface *srf = NULL; srf = create_surface(16,16); SDL_Rect temp; temp.x = 0; temp.y = 0; temp.w = 16; temp.h = 16; SDL_FillRect(srf,&temp,p_color); apply_surface(0,0, srf, screen, NULL); //simple function for blitting one surface to another. [/source] I definitely know that srf and screen are 32bits and function for creating surfaces was copied from SDL docs. apply_surface function works perfectly for any loaded image. Please, help me out with this simple problem [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  9. If your game would be side scrolling then sometimes there would be empty tiles, like air... To save memory and time of calculating you can use resizable array of pointers in current chunk which contains only solid tiles. To delete any tile from this array, for example [CODE] remove(i); [/CODE] Copy last pointer in your array to i and then resize array. Pretty simple and working
  10. Cortex Command build 27 is finally out!!!! http://t.co/PYHtKT43
  11. Sorry guys for my mistake in he title But still thanks for your concern. I will use your algorithms in other project
  12. Well...it's part of ray class, so my ray has angle, maximum length and point of start. Now how it works: To find distance to each side we make 2 functions: y = kx — function of ray. x = c or y = c — function of side, because they are not rotating. Then we need to find k — it's just [b]tan(angle)[/b]. Then calculate point where 2 functions are crossing and check if this point lies on side of current block. pretty simple [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  13. Thank you guys. I did find another way, it's quite light too: On each line, that presents side of block we find collision point and check if it's really on side of our block: [CODE] int lx,ly; //temporary point float t_distance[4]; //FIND POINT ON TOP SIDE ly = block->y; lx = (block->y - y) / tan(angle) + x; if( lx >= block->x && lx <= block->x + block->w && ly >= block->y && ly <= block->y + block->h) //find distance to it t_distance[0] = sqrt((float) (x - lx)*(x - lx) + (y - ly)*(y - ly)); //FIND POINT BOTTOM SIDE ly = block->y + block->h; lx = (block->y + block->h - y) /tan(angle) + x; if( lx >= block->x && lx <= block->x + block->w && ly >= block->y && ly <= block->y + block->h) //find distance to it t_distance[1] = sqrt((float) (x - lx)*(x - lx) + (y - ly)*(y - ly)); //FIND POINT ON LEFT SIDE lx = block->x; ly = tan(angle) * (block->x - x) + y; //check if temp point is onside of block if( lx >= block->x && lx <= block->x + block->w && ly >= block->y && ly <= block->y + block->h) //find distance to it t_distance[2] = sqrt((float) (x - lx)*(x - lx) + (y - ly)*(y - ly)); //FIND POINT ON RIGHT SIDE lx = block->x + block->w; ly = tan(angle) * (block->x + block->w - x) + y; if( lx >= block->x && lx <= block->x + block->w && ly >= block->y && ly <= block->y + block->h) //find distance to it t_distance[3] = sqrt((float) (x - lx)*(x - lx) + (y - ly)*(y - ly)); [/CODE] Then just find minimum in t_distance and there u have it! Ohh...and by the way my blocks aren't rotating and are just represented as x,y,width and height
  14. Hello guys! I'm having such a problem: i can't figure easiest way to find distance between point and block (as shown on picture) [img]https://p.twimg.com/AqhSb2nCQAAMY57.png[/img] Everything that i tried is not properly working [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] Could you help me please and tell way to find that distance.