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

Chr1sen

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

135 Neutral

About Chr1sen

  • Rank
    Newbie
  1. Thanks. I got everything working now. It's a shame that I really didn't see people use the "Pitch" property. I guess they are mostly dealing textures that have the Pitch same as Source width.   /// <summary> /// Copies content into destinationBuffer. /// </summary> /// <param name="texture">actual texture </param> /// <param name="contentToCopy">source bfufer</param> /// <param name="sourcePitch">source stride</param> private static void CopyToTexture(Texture texture, byte[] contentToCopy, int sourcePitch) { var data = texture.LockRectangle(0, LockFlags.Discard); var y = 0; for (var scanLineStart = 0; scanLineStart < contentToCopy.Length; scanLineStart += sourcePitch, y++) { data.Data.WriteRange(contentToCopy, scanLineStart, sourcePitch); data.Data.Seek((y + 1)*data.Pitch, SeekOrigin.Begin); } texture.UnlockRectangle(0); }   And if anyone is interested, then I ended up using this for my YUV->RGB shader: http://subversion.assembla.com/svn/AvP/branches/workbranch/trunk/shaders/fmvPixel.psh though I am thinking about writing my own shader that could use only one sampler2D, so I could pass packed YUV formats directly into the GPU. Though I am not sure where to begin. Is that even a good idea? The texture is defintely gonna be huge as hell though.
  2. Hello! I am making custom video player that can play videos using UYVY textures. Now I've made sure two things(fairly new GPU card): 1) my computer supports nonpower textures 2) my computer supports UYVY textures 3) the data and width/height is correct(frame). I've verified it with many different ways. For example, doing the conversion manually into RGB32 and using that as texture, it works. Bottom line is; my GPU can't handle UYVY textures sometimes. For example, some video resolutions work fine, such as: 1024x720 720x528 or something.. On other video resolutions, the texture output is completely gibberish. It's just a bunch of messy stuff and reminds me zigzag lines. Are there some limitations I am not aware of? Or has anyone dealt with this? On another note, I am using Direct3D9, can anyone suggest me some keywords to google around so I could upload YUV data into shader and then take over the "sampling" process & converting it into RGB process? As far I've searched; you can have only one texture active at shader stage, with DX9, so it means I have to upload all the YUV data into texture at once. So, for example UYVY frame will take width*height + width*height/2 + width*height/2 pixels, and I am not sure if GPUS even support so big textures ?! when talking about fullHD movies. I am also not sure how should I do the sampling myself.
  3. So I was working on my game.. it seems that my game seems to just stop at some random times and skips rendering new frame where player moves, so it kind of seems like player has teleported.. Im not exactly sure what the problem is, is it the rendering part of maybe it is skipping the logic part.. either way it seems that something weird is going on. Game loop public void run() { sync.start(); int last_time = 0; int frames_done = 0; Field f = game.getField(); boolean bomb_planted = false; // we can only plant bombs when we press button not hold it down. while(running) { /* while(sync.tick == 0){ try{Thread.sleep(100 / 50); } catch(Exception e){} }*/ while(sync.tick &gt; 0) { int old_ticks = sync.tick; // Check out various keys lol if(keystate[SPACE_BAR]){ if(!bomb_planted){ // Send packet to server indicating that we want to plant bomb. player.write(Gp.genPack(Gp.PLANT_BOMB, new String[]{Integer.toString(player.getId()), player.getHash(), Integer.toString(player.getX()), Integer.toString(player.getY())})); bomb_planted = true; } } else{ bomb_planted = false; } // Update player positions // dead reckoning Player a[] = game.getPlayerlist(); for(int i = 0; i &lt; a.length; i++) { if(a[i] != null && a[i].getMoving()) { int x = a[i].getX(), y = a[i].getY(); int key = a[i].model.getDir(); if(key == 0){ x += foffset; } else if(key == 1){ x -= foffset; } else if(key == 2){ y -= foffset;} else if(key == 3){ y+= foffset;} a[i].moveTo(x, y); } } boolean mv = false; for(int i = 0; i &lt; keys; i++) { if(keystate[i]) { mv = true; int key = i; if(player.model.getDir() != key || !player.getMoving()) { player.write(Gp.genPack(Gp.CLIENT_GONNAMOVE, new String[]{Integer.toString(player.getId()), player.getHash(), Integer.toString(key), Integer.toString(player.getX() + 50), Integer.toString(player.getY())})); System.out.println("DROLL"); } break; } } // Update bombs // Each logic frame is fixd at specific rate, our example is 40! // So it means that the bomb animation should change.. boolean fbomb = true; /* synchronized(bombs) { ListIterator&lt;Bomb&gt; itr = bombs.listIterator(); while(itr.hasNext() && fbomb){ Bomb b = itr.next(); b.counter += 1; b.nextAnimation(); if(!b.alive) { itr.remove(); } } }*/ sync.tick -= 1; if(old_ticks &lt;= sync.tick) break; // abort logic, we need to draw! // End of Game logic loop } if(sync.fgbk &gt;= 10){ // Seconds has passed f.setFps(frames_done); sync.fgbk = 0; frames_done = 0; } // We have time to draw now. game.triggerUpdate(); frames_done += 1; } } Here is the triggerUpdate() public void draw() { Graphics graphics = null; try { graphics = buffer.getDrawGraphics(); Graphics2D gx = (Graphics2D)image.createGraphics(); gx.setColor(Color.black); gx.fillRect(0, 0, width, height); // Draw bombs /* synchronized(bombs) { ListIterator&lt;Bomb&gt; itr = bombs.listIterator(); while(itr.hasNext()){ Bomb b = itr.next(); drawBomb(gx, b); } }*/ if(player_list != null) { for(int i = 0; i &lt; player_list.length; i++) { if(player_list[i] != null) { drawPlayer(gx, player_list[i]); /* gx.drawString("["+i+"]PlayerX" + player_list[i].getX() + " PlayerY" + player_list[i].getY(), 200, 75 + i * 10);*/ } } } graphics = buffer.getDrawGraphics(); graphics.drawImage(image, 0, 0, null ); if( !buffer.contentsLost() ) buffer.show(); } finally { // if( graphics != null ) // graphics.dispose(); } } and here is the timing class I use(sync) package Client; import java.util.Calendar; import java.util.Timer; import java.util.TimerTask; // A class to lock our game logic FPS :-) // too bad I couldnt find one in Java. public class Synchronization { public static int FPS = 50; // We do 40 logic updates per second. // What that means is that we increment our 'tick' variable each 1000/FPS ms. public int tick = 0; public int fgbk = 0; private int cwreal = 0; private Timer timer; // timer for synchronization logic private Timer fpstimer; // we use it to get fps class RemindTask extends TimerTask { private Synchronization g; public RemindTask(Synchronization g) { this.g = g; } public void run() { tick += 1; cwreal += 1; if(cwreal == FPS){ tick = 1; cwreal = 0; } } } class FPSTask extends TimerTask { private Synchronization g; public FPSTask(Synchronization g) { this.g = g; } public void run() { fgbk += 1; } } public void start() { timer = new Timer(); timer.scheduleAtFixedRate(new RemindTask(this), Calendar.getInstance().getTime(), 1000 / FPS); fpstimer = new Timer(); fpstimer.scheduleAtFixedRate(new FPSTask(this), Calendar.getInstance().getTime(), 100); // Every 100 ms } public void stop() { timer.cancel(); } } I hope anybody can take look and has any ideas. Ive also attached project's source because Im desparetly in need of help :P, this seems to be happening on other computers too and switching timer technology doesnt seem to do any good. http://www.upload.ee/files/703179/Bombermania.rar.html Field.java takes care of screen Logic.java takes care of player movement and updating it's position
  4. hey everybody. im building my first 2d network game. im already facing a problem.. public void run() { // We are now dealing here // with reading from socket and writing there // we understand protocol etc.. while(running) { try { String m = player.read(); if(Gameprotocol.isPacket(m, Gameprotocol.CHAT_MESSAGE)) { String mess = Gameprotocol.getAfterPeriod(m); window.logMessage(mess); } else if(Gameprotocol.isPacket(m, Gameprotocol.MOVE_ME)) { window.logMessage("YO we can move"); String mess = Gameprotocol.getAfterPeriod(m); String args[] = Gameprotocol.splitArguments(mess, 3); if(args.length == 3) { int x = Integer.parseInt(args[1]); int y = Integer.parseInt(args[2]); player.moveTo(x, y); window.getFieldObj().drawPlayer(player); window.logMessage("YEP"); } } Thread.sleep(1); } catch(InterruptedException e) { } } } the problem is that my player moves, but sometimes he get's a little lag spike or something.. you know? like stops for millisecond, if i remove the thread.sleep(1), it seems to work okay.. is this plausible? my idea is that if my character wants to move, i send the 'can i walk' packet to the server and server replies and then my character moves/or not.. all i have is chat message system&moving.. should i be worried that my game will be slow or something? i have to add many oter things yet.. q2) i have yet to solve the cheating problem, what i thought is that when client connects to server, server assigns him an id and 24bit hash, id and hash will be combined into one string, like 6bit string so there's like (26 + 10)^6 = 2 176 782 336 IDs.. doesnt seem so secure.. i dont want to make too big control codes too.. because packet sending will take a little more then or so.. + in order to make packets more harder to read and modify by some WPE editors, i should encrypt before sending and decrypt on recieving. is there any other way to go around this? more logical one or better :)? or ehm what about this: on server side i map ID and IP address.. so when somebody sends me packet, where is 3bit ID, i can check if those are equal.. this sounds like i can fake that too although [Edited by - Chr1sen on June 10, 2010 4:56:45 AM]
  5. hello. this is the rules i have on game scrolling: i dont allow no back(x) scrolling and i only scroll when player's mapx is bigger than before, also i dont let player to go end on screen, i restrict it with this: if(screenx >= SCREEN_W_ / 2 + 50) { screenx = SCREEN_W_ / 2 + 50; } heres the rendering void map_render(int map_drawx, int map_drawy) { static short x, y; static short mapx, mapy; static Tile *tile; // mapx and mapy show where we start rendering map mapx = map_drawx / DEF_TILE_X; map_xoff = map_drawx % DEF_TILE_X; textprintf(buffer, font, 20, 60, makecol(255, 255, 255), "scroll %d", map_xoff); tile = 0; for(x = 0; x <= tiles_per_x; x++) { for(y = 0; y < tiles_per_y; y++) { if(tile = tiles.get_tile(mapx + x, y)) { blit(tile->picture, buffer, 0, 0, x * DEF_TILE_X - map_xoff, y * DEF_TILE_Y, DEF_TILE_X, DEF_TILE_Y); } } } } My problem is that when the scrolling happens, then somehow mapx goes wrong.. seems like i need to add the map_xoff to the person mapx(). but i cant do it because it will mess things up, surely there is another solution how this could be solved?