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


  • Content count

  • Joined

  • Last visited

Community Reputation

127 Neutral

About arnsa

  • Rank

Personal Information

  • Location
  1.   Okay, I've found out where the  bug is and now my character's jump depends on gravity and velocity (at last). But here's another problem: it doesn't jump "realistically", it just teleports. If I keep clicking jump, every time it teleports farther. Is this is how it works?      while(!gameover) {         now = SDL_GetTicks();         if (now > last) {             delay = now - last;             last = now;         }         if(space) {             velocity += (-3) * delay;             rcSprite.y += velocity * delay;             space = 0;         }         if (SDL_PollEvent(&event))             handle_event(event, &rcSrc, &rcSprite, &velocity);         // etc.
  2. Putting it in the main loop didn't change anything.
  3.   This function is being called in a game loop.     while(!gameover) {         if (SDL_PollEvent(&event))             handle_event(event, &rcSrc, &rcSprite, &velocity);         check_sprite_edges(&rcSprite, SPRITE_LION_SIZE);         draw_background(&screen, &sprite_grass, &rcGrass);         SDL_BlitSurface(sprite_lion, &rcSrc, screen, &rcSprite);         SDL_UpdateRect(screen, 0, 0, 0, 0);     }  
  4.   Now my sprite teleports to the top, if I click jump again, it dissapears and I need to click jump like 4 times so it appears again.     We can't debug your code for you. Step through it with a debugger and see if variables have the values you expect them to have, or dump debugging data on a log file and examine it, to understand what's going on.   To make things simple, use a constant value for delta_time for the time being.     From what I see here, deltaTime really depends on how long I wait before I click jump. I must be doing something wrong...     void handle_event(SDL_Event event, SDL_Rect *rcSrc, SDL_Rect *rcSprite, int *velocity) {     int now = SDL_GetTicks(), delay;     switch(event.type) {         case SDL_QUIT:             gameover = 1;             break;         case SDL_KEYDOWN:             switch(event.key.keysym.sym) {                 case SDLK_ESCAPE: case SDLK_q:                     gameover = 1;                     break;         // some stuff         case SDLK_SPACE:             printf("now: %d, last: %d, delay: %d\n", now, last, now-last);             if (now > last) {                 delay = now - last;                 last = now;             }             *velocity += (-10) * delay;             rcSprite->y += *velocity * delay;             break;             // some stuff
  5.   Now my sprite teleports to the top, if I click jump again, it dissapears and I need to click jump like 4 times so it appears again.
  6.   What do you mean by "time elapsed in one frame"? How do I count it?
  7. Maybe that would work, but I don't really know what should be the ratio between the force and the mass aka what numbers should I take for those?
  8. I actually made something like that, but in my opinion, that's not the right way to do... Any suggestions/advices? Btw, there's some kind of a bug that when a sprite jumps, it leave all of his colors behind him and when he goes down, same happens... Maybe I should somehow redraw the background (grass) when jumping? if ( space ) { for(int co = 0; co < 50; co++) { rcSprite.y -= 1; usleep(500 * co); SDL_BlitSurface(sprite, &rcSrc, screen, &rcSprite); SDL_UpdateRect(screen, 0, 0, 0, 0); } for(int co = 50; co > 0; co--) { rcSprite.y += 1; usleep(300 * co); SDL_BlitSurface(sprite, &rcSrc, screen, &rcSprite); SDL_UpdateRect(screen, 0, 0, 0, 0); } space = 0;
  9. I can't seem to find any formula for my 2D game. I have a simple sprite and I wan't it to jump up and then go back. It has only to jump up and down, no need for "parabola jump" or anything. I hope you know what I mean.   P.S. I tried something like that, but that didn't work well. It seems that the sprite just teleports up and then teleports back down. for(int co = 0; co < 50; co++) {                 rcSprite.y += 1;                 usleep(4000); }
  10. Hey, I've been reading "OpenGL Programming Guide Seventh Edition" book. What I really didn't like here is that the author is using a bunch of deprecated functions. I don't want to learn them, because it wouldn't be effective to use them. I heard about "SuperBible" book, but lots of people complain that the author is using something called GLTools, which hides a lot of low level stuff. So when you try to write something without GLTools, it's really hard. If not that GLTools thing, I'd surely read that book. Besides these 2 books, I couldn't find any good material to learn OGL 3.0 (my GPU supports OGL version only up to 3.1). Do you, guys, know any good materials, tutorials, books or anything, which doesn't use deprecated functions and are good to learn OGL?
  11.   Actually, I'm not planning to create mobile games at all, because I don't like them. Will I go commercial? I don't know. Currently I'm only at 11th grade, so I will still be studying at school for 1+ years, plus minimum 4 years at the university. After that, I might go commercial, because atm I want game development-related job, and yes, game development is my hobby now.   What about Direct3D... I heard it's API is really crappy, so is the documentation. So, it could be hard to learn it, true?
  12. Hello, folks!   I've got a dillema here. I've started to learn game development, more specificaly -- OpenGL. My GPU supports OpenGL only up to 3.1 version, so drivers on Linux isn't the problem here. The problem is, that most of the companies create games or game engines only for Windows or OS X, so I thought an experience in working with Windows would be good. But... I'm a total Linux lover and after installing Windows... I just hate them and I very much miss Linux. I've been thinking a lot,  but if I stay with Windows, I'll have more pros. I look forward for any opinion on what should I do, what are the advantages on staying with Windows, or working on Linux etc.    --Arnas
  13. Hello, I was trying to draw a shaded triangle, but I get wrong colors. Here's the example of what I get, if I call a function with red, green and blue colors: [url="http://s10.postimage.org/7yh8ztn3r/Capture.jpg"][img]http://s10.postimage.org/7yh8ztn3r/Capture.jpg[/img][/url] Code's here: [CODE] unsigned RGB(unsigned char R, unsigned char G, unsigned B){ return (R << 16) | (G << 8) | B; } void put_pixel(SDL_Surface * s, unsigned x, unsigned y, unsigned color){ unsigned long * pixels = (unsigned long *)s->pixels; if(x >= s->w || y >= s->h) return; pixels[x+y*s->w] = color; } void draw_line(SDL_Surface * s, int x0, int y0, int x1, int y1, unsigned color){ int x, y; int xproj = x1-x0, yproj = y1-y0, pm; if(!xproj && !yproj) return; if(abs(xproj) > abs(yproj)){ pm = xproj >= 0 ? 1 : -1; for(x = 0; x != xproj; x += pm){ y = rint(x* yproj/(double)xproj); put_pixel(s, x0 + x, y0 + y, color); } }else{ pm = yproj >= 0 ? 1 : -1; for(y = 0; y != yproj; y += pm){ x = rint(y* xproj/(double)yproj); put_pixel(s, x0+x, y0+y, color); } } } float sign(int x0, int y0, int x1, int y1, int x2, int y2){ return (x0 - x2) * (y1 - y2) - (x1 - x2) * (y0 - y2); } int ptintr(int sx, int sy, int x0, int y0, int x1, int y1, int x2, int y2){ int b1, b2, b3; b1 = sign(sx, sy, x0, y0, x1, y1) < 0.0f ? 1 : 0; b2 = sign(sx, sy, x1, y1, x2, y2) < 0.0f ? 1 : 0; b3 = sign(sx, sy, x2, y2, x0, y0) < 0.0f ? 1 : 0; if((b1 == b2) && (b2 == b3)) return 1; return 0; } float get_dist(int x1, int y1, int x2, int y2){ int xproj = x2-x1; int yproj = y2-y1; float dist = sqrt(pow(xproj, 2) + pow(yproj, 2)); return dist; } unsigned char getR(unsigned c){ return (c >> 16) & 0xFF; } unsigned char getG(unsigned c){ return (c >> 8) & 0xFF; } unsigned char getB(unsigned c){ return c & 0xFF; } void draw_ftriangle(SDL_Surface * s, int x0, int y0, unsigned c0, int x1, int y1, unsigned c1, int x2, int y2, unsigned c2){ int x; signed d0, d1, d2; unsigned R, G, B, color; int ymin = min(y0, min(y1, y2)); int xmin = min(x0, min(x1, x2)); int ymax = max(y0, max(y1, y2)); int xmax = max(x0, max(x1, x2)); draw_line(s, x0, y0, x1, y1, color); draw_line(s, x1, y1, x2, y2, color); draw_line(s, x0, y0, x2, y2, color); for(; ymin < ymax; ymin++) for(x=xmin; x < xmax; x++) if(ptintr(x, ymin, x0, y0, x1, y1, x2, y2)){ d0 = get_dist(x, ymin, x0, y0); d1 = get_dist(x, ymin, x1, y1); d2 = get_dist(x, ymin, x2, y2); R = d0+d1+d2 == 1 ? getR(c0)*d0 + getR(c1)*d1 + getR(c2)*d2 : (getR(c0)*d0 + getR(c1)*d1 + getR(c2)*d2)/(d0+d1+d2); G = d0+d1+d2 == 1 ? getG(c0)*d0 + getG(c1)*d1 + getG(c2)*d2 : (getG(c0)*d0 + getG(c1)*d1 + getG(c2)*d2)/(d0+d1+d2); B = d0+d1+d2 == 1 ? getB(c0)*d0 + getB(c1)*d1 + getB(c2)*d2 : (getB(c0)*d0 + getB(c1)*d1 + getB(c2)*d2)/(d0+d1+d2); color = RGB(R, G, B); put_pixel(s, x, ymin, color); } } [/CODE] And I call function draw_ftriangle like this: [CODE] draw_ftriangle(surface, 100, 100, RGB(255, 0, 0), 235, 150, RGB(0, 255, 0), 64, 254, RGB(0, 0, 255)); [/CODE] I'm not sure, but I think the problem is here: [CODE] R = d0+d1+d2 == 1 ? getR(c0)*d0 + getR(c1)*d1 + getR(c2)*d2 : (getR(c0)*d0 + getR(c1)*d1 + getR(c2)*d2)/(d0+d1+d2); G = d0+d1+d2 == 1 ? getG(c0)*d0 + getG(c1)*d1 + getG(c2)*d2 : (getG(c0)*d0 + getG(c1)*d1 + getG(c2)*d2)/(d0+d1+d2); B = d0+d1+d2 == 1 ? getB(c0)*d0 + getB(c1)*d1 + getB(c2)*d2 : (getB(c0)*d0 + getB(c1)*d1 + getB(c2)*d2)/(d0+d1+d2); [/CODE] Please help me to find a problem! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]