• 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

288 Neutral

About EricsonWillians

  • Rank

Personal Information

  • Location
    São Paulo, Brazil.
  1. I've recorded a video explaining how to structure a Pygame application and deal with basic input from scratch. I'd like to share it with you (I can record more), in the case of someone being interested in developing games with Python and feeling lost.   [media]https://www.youtube.com/watch?v=ukXErtzpaOo[/media]
  2. Greetings Thok,   I thank you very much for your answer. I've managed to solve the problem. It was really difficult, and probably because of my structure. Nonetheless, I've increassed the code's complexity. Now I'm using hashmaps/dictionaries for the slots (A storage-dictionary whose keys are tuple-positions, whose values are lists with two indexes: One for the item, other for the hotkey). I've commented the code step by step, and I'll post here so that you can see what I've done. As soon as I finish the game, I'll announce it here on Gamedev. class Inventory(ImageEntity):     def __init__(self,filename):         ImageEntity.__init__(self,"GFX",filename,0,0)         self.interface = gIBGI(filename)         self.cursor = InterfaceSelectionCursor("GFX","selectionCursor.png",0,0)         self.storage = GridMap(interfaceGrid) # A GridMap is a dictionary-custom-class with all possible positions within a grid as keys.         for slot in self.storage: # Iterates through that empty dictionary with all the key-positions with empty values.             self.storage[slot] = [0,"No hotkey"] # Assigns a default value to them (No item and no hotkey, inside a list).         # Generate random starting-positions for the starting-item in the inventory.         ew0InitialPos = (randint(0,7),randint(0,7))          ew0.x = self.getInterfaceX(ew0InitialPos[0])         ew0.y = self.getInterfaceY(ew0InitialPos[1])         self.storage[(ew0InitialPos[0],ew0InitialPos[1])][0] = ew0         self.isItemSelected = False # Necessary to move the item in real time through the slots.         self.slotHolder = None # Necessary to transfer the item-object from the mouse-down loop to the mouse-up loop.         self.slotToBeErased = None # Necessary to erase the previous item in order not to allow copies to be accidentally made.     def watchForPositionalMouseRequests(self):          # Iterates over the event list.         for e in event.get():              # Checks if the mouse button 1 was pressed.             if e.type == MOUSEBUTTONDOWN and mouse.get_pressed()[0] == True:                 # Checks if no item is already selected.                 if self.isItemSelected == False:                     # Iterates over the storage dictionary (All the slots,                     # which are lists with 2 indexes: One for a possible item and other for a possible hotkey).                     for slot in self.storage:                          # Filters the slot specifically under the mouse selection cursor (The one that shall be used).                         if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                             # Checks whether that slot under the mouse cursor has an item object or not.                             if isinstance(self.storage[slot][0],Item): # If it has, then it is an instance of the Item class.                                 # If all those conditions are true, then, the item is finally selected.                                 self.isItemSelected = True                                 # Checks if there's no previous item in the slotholder.                                 if self.slotHolder is None:                                     # Changes the drawing-positions of the item, but does not update them in real time.                                     self.storage[slot][0].x = self.cursor.x                                      self.storage[slot][0].y = self.cursor.y                                     # Copies the item to the slotholder.                                     self.slotHolder = self.storage[slot][0]                                     # Copies the slot that was initially clicked just                                     # to keep track of it through the loops in order to erase it in the next one.                                     self.slotToBeErased = slot             # Checks if the mouse button 1 was released.             if e.type == MOUSEBUTTONUP and mouse.get_pressed()[0] == False:                 # Guarantees that an item is indeed selected when the mouse button is released.                 if self.isItemSelected == True:                     # Iterates over the storage dictionary again, separately.                      for slot in list(self.storage):                         # Filters the slot specifically under the mouse selection cursor, again                         # (But this is the new slot, which is the item's destination.)                         if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                             # Checks if there is an item in the slotholder from the previous loop.                             if self.slotHolder is not None:                                 # If all those conditions are true, then, there's really an item selected and                                 # it certainlly is that one that was firstly clicked to be moved.                                 # Then, since the mouse was now released, the item can be "dropped" to its final destination.                                 self.isItemSelected = False                                 self.storage[slot][0] = self.slotHolder                                 self.slotHolder = None                                 if self.slotToBeErased is not None:                                     if slot != self.slotToBeErased:                                         self.storage[self.slotToBeErased][0] = 0                                         self.slotToBeErased = None                                      def draw(self):         screen.blit(self.interface,(0,0))         self.cursor.draw("INTERFACE")         self.cursor.move()         for slot in self.storage:             try:                 if isinstance(self.storage[slot][0],Item):                     if self.isItemSelected == True:                         self.storage[slot][0].x = self.cursor.x                         self.storage[slot][0].y = self.cursor.y                     self.storage[slot][0].draw("INTERFACE")                 for n in range(1,10,1):                     if str(n) in self.storage[slot][1]:                         gPT([str(n),self.storage[slot][0].x,self.storage[slot][0].y],                             [str(n),self.storage[slot][0].x,self.storage[slot][0].y],(255,255,255),32)             except:                 pass         if self.slotHolder is not None:             self.slotHolder.draw("INTERFACE")     def watchForHotkeyAssignments(self):         for slot in self.storage:                          if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_0] or key.get_pressed()[K_KP0])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "No hotkey"             if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_1] or key.get_pressed()[K_KP1])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "Hotkey 1"             if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_2] or key.get_pressed()[K_KP2])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "Hotkey 2"             if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_3] or key.get_pressed()[K_KP3])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "Hotkey 3"             if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_4] or key.get_pressed()[K_KP4])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "Hotkey 4"             if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_5] or key.get_pressed()[K_KP5])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "Hotkey 5"             if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_6] or key.get_pressed()[K_KP6])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "Hotkey 6"             if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_7] or key.get_pressed()[K_KP7])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "Hotkey 7"             if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_8] or key.get_pressed()[K_KP8])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "Hotkey 8"             if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_9] or key.get_pressed()[K_KP9])):                 if (self.getInterfaceX(slot[0]),self.getInterfaceY(slot[1])) == (self.cursor.x,self.cursor.y):                     self.storage[slot][1] = "Hotkey 9"  
  3. You could work with blocks (x,y,w,h) instead of lines. Then, you could create patterns of walls as different objects. You could create a default Wall class that has all the basic information of each block (With x, y, w, h, etc). Then, you could create the different patterns: class WallType1(Wall): ... ?class WallType2(Wall): ... ?class WallType3(Wall): ... Each one of them could store the blocks in their different raw positions in a list or array, and the whole walltype (With their different blocks) could be moved just by setting the x and y. Then, you could procedurally generate their positions for each map and create unpredictable mazes at each game. The free-blocks would be just positions, like the walls, but they would comprise no walls, so, you could filter them with a "if not in wall-positions" logic, and allow the player and the ghosts to walk only through them. Concerning the AI, I think it would be a lot easier to think about once you have the free blocks. You could procedurally generate just "lines of blocks", alternating randomly between horizontal and vertical wall-lines, but that would give you a much more randomic maze than the ones of the video. So that's why I've recommented the pattern-wall-objects (Groups of wall-blocks that can be randomly positioned at the creation of the level). I've made an algorithm that procedurally generates mazes for my game, and a more simplified version is available on Khan Academy. Check it out and see if it inspires you: https://www.khanacademy.org/cs/procedural-maze-generation-with-camera-translation-and-minimap/6384329197355008
  4. I'm developing a game with procedurally generated dungeons with a somewhat minecrafty spirit (But 2D), and it's time for the inventory. I've never programmed an inventory before, so I'm figuring out how to do it by my own. Here's my humble inventory with a humble item at a random position:       The first thing that came to my mind when I faced the necessity of creating an inventory, was, naturally: "A list!" (Python). So, here's the code of my Inventory class:   class Inventory(ImageEntity): def __init__(self,filename): ImageEntity.__init__(self,"GFX",filename,0,0) self.interface = gIBGI(filename) self.cursor = InterfaceSelectionCursor("GFX","selectionCursor.png",0,0) self.slots = [] for i in range(8): self.slots.append([]) for j in range(8): self.slots[i].append([0,"No hotkey",(j*interfaceWidth,i*interfaceHeight)]) ew0InitialPos = (randint(0,7),randint(0,7)) ew0.x = self.getInterfaceX(ew0InitialPos[0]) ew0.y = self.getInterfaceY(ew0InitialPos[1]) self.slots[ew0InitialPos[0]][ew0InitialPos[1]][0] = ew0 self.slotHolder = 0 self.itemSelectedByMouse = False def watchForHotkeyAssignments(self): for i in self.slots: for slot in i: if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_1] or key.get_pressed()[K_KP1])): if slot[2] == (self.cursor.x,self.cursor.y): slot[1] = "Hotkey 1" if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_2] or key.get_pressed()[K_KP2])): if slot[2] == (self.cursor.x,self.cursor.y): slot[1] = "Hotkey 2" if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_3] or key.get_pressed()[K_KP3])): if slot[2] == (self.cursor.x,self.cursor.y): slot[1] = "Hotkey 3" if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_4] or key.get_pressed()[K_KP4])): if slot[2] == (self.cursor.x,self.cursor.y): slot[1] = "Hotkey 4" if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_5] or key.get_pressed()[K_KP5])): if slot[2] == (self.cursor.x,self.cursor.y): slot[1] = "Hotkey 5" if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_6] or key.get_pressed()[K_KP6])): if slot[2] == (self.cursor.x,self.cursor.y): slot[1] = "Hotkey 6" if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_7] or key.get_pressed()[K_KP7])): if slot[2] == (self.cursor.x,self.cursor.y): slot[1] = "Hotkey 7" if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_8] or key.get_pressed()[K_KP8])): if slot[2] == (self.cursor.x,self.cursor.y): slot[1] = "Hotkey 8" if (key.get_pressed()[K_LCTRL] and (key.get_pressed()[K_9] or key.get_pressed()[K_KP9])): if slot[2] == (self.cursor.x,self.cursor.y): slot[1] = "Hotkey 9" def watchForPositionalMouseRequests(self): for i in self.slots: for slot in i: if mouse.get_pressed()[0]: if slot[2] == (self.cursor.x,self.cursor.y): if slot[0] != 0: pass # At this point it iterates over all the slots (Which are filled with 0 by default.) # If the slot[0] is equal to an item, then, I can access its x and y position (Set it to the cursor pos, for example). if mouse.get_pressed()[0] == False: if slot[2] == (self.cursor.x,self.cursor.y): pass # Do something when mouse button 1 released. def draw(self): screen.blit(self.interface,(0,0)) self.cursor.draw("INTERFACE") self.cursor.move() for i in self.slots: for slot in i: if slot[0] != 0: slot[0].draw("INTERFACE") Interface width and height are 128 by 96 (The size of each tile, including the item and cursor (They are transformed for the inventory screen)). As you can see, I figured out how to assign hotkeys for each slot (A vital necessity in the game I'm developing). Nevertheless, I would like to move the item to a new slot when clicked. How would you do that? I know how to filter the slot (I mean, when I click, I know how to capture the Item, which is an image-object with a x and y position). Things get weird when I try to make the item's x and y positions the position of the selection cursor, considering that I access it only when I filter to the first slot that was clicked (Therefore, if I move the item, I cannot move it again and things get pretty confusing). Anyway, I would like to know how a more experienced programmer would deal with this problem. I thank you very much!
  5. I'm developing a 2D game with Pygame with a procedurally generated world from scratch and alone. What I can tell you is: It's really hard to have a solid way to start it. First, I t've tried to develop a whole engine for my game, and then I realized that it was way too general and did not fit in my original intentions (So, it requires a whole lot more planning if you want to develop a general-purpose engine). First things first, start by creating the "functioning". Make some basic level/scenario and build the game from there (How the player interact with everything, for example). Then, build the Graphical User Interface later. If some key element of the user interface is required for interaction, like an inventory, than do it before the GUI as if it was just part of the basic "functioning". The ground-structure is how the game works. If it has AI, then you have to create it in this test-level. After everything works fine in the test-environment, then, you could start developing a Map Editor and the GUI. Since I work alone and have no time for Map Editors, I personally vote for procedurally generated levels. I. Image the gameplay in your head. II. Create a testing environment with a test-player and start developing that gameplay. III. One you achieved what you imagined in a general form, start adding the details like GUI, specific players, enemies and levels. Nevertheless, there's no FINAL solution on how to structure your game. Unfortunately, you'll have to discover it by yourself, and it's a vital process in your personal evolution as a programmer and game developer.
  6. Thank you very much for your answer lactose. I think I understood what you mean. I'll try to apply it in this test-code. In my actual game, I gave up this idea. Way too much headache. Instead, I'm moving by 64w and 48h pixels. I could not do this because of the speed of the movement, but then I've found a decent solution to the problem in this question of gamedev.stackexchange.   I'm using a "cooldown" logic based on the clock.tick() at each frame. The movement is not as smooth as if I was moving by 1 or 3 pixels each (Of course), but the collisions are perfect and I can move through my maze, touching the walls randomly without having to worry myself.
  7. So far the "Bounding Box" method is the only one that I know. It's efficient enough to deal with simple games. Nevertheless, the game I'm developing is not that simple anymore and for that reason, I've made a simplified example of the problem. (It's worth noticing that I don't have rotating sprites on my game or anything like that. After showing the code, I'll explain better). Here's the whole code: from pygame import * DONE = False screen = display.set_mode((1024,768)) class Thing(): def __init__(self,x,y,w,h,s,c): self.x = x self.y = y self.w = w self.h = h self.s = s self.sur = Surface((64,48)) draw.rect(self.sur,c,(self.x,self.y,w,h),1) self.sur.fill(c) def draw(self): screen.blit(self.sur,(self.x,self.y)) def move(self,x): if key.get_pressed()[K_w] or key.get_pressed()[K_UP]: if x == 1: self.y -= self.s else: self.y += self.s if key.get_pressed()[K_s] or key.get_pressed()[K_DOWN]: if x == 1: self.y += self.s else: self.y -= self.s if key.get_pressed()[K_a] or key.get_pressed()[K_LEFT]: if x == 1: self.x -= self.s else: self.x += self.s if key.get_pressed()[K_d] or key.get_pressed()[K_RIGHT]: if x == 1: self.x += self.s else: self.x -= self.s def warp(self): if self.y < -48: self.y = 768 if self.y > 768 + 48: self.y = 0 if self.x < -64: self.x = 1024 + 64 if self.x > 1024 + 64: self.x = -64 r1 = Thing(0,0,64,48,1,(0,255,0)) r2 = Thing(6*64,6*48,64,48,1,(255,0,0)) while not DONE: screen.fill((0,0,0)) r2.draw() r1.draw() # If not intersecting, then moves, else, it moves in the opposite direction. if not ((((r1.x + r1.w) > (r2.x - r1.s)) and (r1.x < ((r2.x + r2.w) + r1.s))) and (((r1.y + r1.h) > (r2.y - r1.s)) and (r1.y < ((r2.y + r2.h) + r1.s)))): r1.move(1) else: r1.move(0) r1.warp() if key.get_pressed()[K_ESCAPE]: DONE = True for ev in event.get(): if ev.type == QUIT: DONE = True display.update() quit() The problem:   In my actual game, the grid is fixed and each tile has 64 by 48 pixels. I know how to deal with collision perfectly if I moved by that size. Nevertheless, obviously, the player moves really fast. In the example, the collision is detected pretty well (Just as I see in many examples throughout the internet). The problem is that if I put the player to move WHEN IS NOT intersecting, then, when it touches the obstacle, it does not move anymore. Giving that problem, I began switching the directions, but then, when it touches and I press the opposite key, it "glitches through". My actual game has many walls, and the player will touch them many times, and I can't afford letting the player go through them. The code-problem illustrated:   When the player goes towards the wall (Fine).     When the player goes towards the wall and press the opposite direction. (It glitches through).     Here is the logic I've designed before implementing it:   I don't know any other method, and I really just want to have walls fixed in a grid, but move by 1 or 2 or 3 pixels (Slowly) and have perfect collision without glitching-possibilities. What do you suggest?
  8. I've handled things in a somewhat unconventional way, I suppose. First of all, I don't exactly move things in my engine by pixel. I've created a generic Grid class that takes in its constructor a number of tiles in width, a number of tiles in height, the width of each tile and the height of each tile. I've created another class called GridMap, where I permute every possible "tile position combination" in the map (20x20 tiles, por example, than I would have: (0,0), (0,1), (0,2), ........ (5,7).... and so on). These tuples are keys in a dictionary, and I store the surfaces as a value for each key (And I draw them by iterating over the whole HashMap (Actually is more complicated, because of the XML file. So each value for each key-position of the hashmap has a tile ID and a surface asssociated with it.)). I did not show code because I would need to explain firstly how I've implemented the whole "grid system".. It's all based in keys/hashmaps, and things move by keys instead of pixels (And one can use more than one grid in the engine. Big tiles for drawing and small tiles for locomotion, for example.. But everything always fixed).
  9.   I was walking in the streets today and I was "programming mentally" as I usually do.. And I was philosophizing in what you've just said earlier: "The player within the list..".. And I kept saying to myself: "The player within the list.. The player within the list.." And then I said: "Bloody hell! The guy was right." Then, it was clear as hell that I needed to include the zeros/empty-tiles on the list as well (Together with the player) to serve me as reference (Just what you said now). I'll implement it now :). I can't detect collision through iteration because the list has only the obstacle-tiles (Only their positions), and I need to move the player through the list (Through the zeros). In that way I'll be able to check wether the tile is an obstacle or not.
  10.   The list does not contain the "empty" tiles (I'm developing a platform game, therefore, the "empty tiles" are actually the background). Here's a screenshot of my engine/game:   The map information is a XML file:   <?xml version="1.0" encoding="UTF-8"?> <map version="1.0" orientation="orthogonal" width="10" height="10" tilewidth="175" tileheight="150"> <tileset firstgid="1" name="ts1" tilewidth="175" tileheight="150"> <image source="../../Evil Shadow/GFX/ts1.png" width="875" height="300"/> </tileset> <layer name="Tile Layer 1" width="10" height="10"> <data> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="1"/> <tile gid="1"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="1"/> <tile gid="1"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="1"/> <tile gid="1"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="1"/> <tile gid="1"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="1"/> <tile gid="1"/> <tile gid="3"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="4"/> <tile gid="1"/> <tile gid="1"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> <tile gid="1"/> </data> </layer> </map> As you can see, the game obstacles are the gids above 0, and the 0 ones are the "empty" tiles. The final result of my parser gets all tile-objects above 0 and put them in a list, and each one has a x and y position (The width and height are default in the specified grid). I can't determine the position of the player within the list because the list are just the obstacles, but the player moves within the same grid.
  11. Given a N number of surfaces within a grid, each one being a game obstacle where collision makes itself an unavoidable necessity, how can I detect the collision of a player or any game object if the whole map or grid of surfaces is being drawn through iteration? Suppose that the whole map has a total of 20 tiles of walls (The grid has "free spaces" displaced randomly between the walls creating paths), now imagine that each tile is a surface (a loaded image), and that their x and y positions are being set through iteration (Considering that the map is actually a XML file from Tiled software, and, therefore, there's iteration because of the necessity of reading).  These 20 tiles, each one with their own x and y positions (and width and height) need to be detected by the player or game object. Considering that I'm programming in Python and that each one of these tiles are stored in a list, I can easily iterate through all of them... But then comes the problem:   If I iterate through all the tiles and get the x and y positions through the index, I can't test wether the player is above or below or left or right anything, because all the tiles are being accessed "at once"! (Not technically speaking) At the same time, I need to iterate over everything, because the map could have 3000x3000 tiles. If I test if the player is above the index y position, the condition will be true many times because there'll be many tiles below it as a whole. I did not post any code because the whole is quite complex, and I'm afraid I would not make myself sufficiently clear (I don't know if I've made it anyway). It's a complex problem and I'm still trying to solve it. I had the idea of "projecting" an invisible tile at the next position of the player considering it's moving-direction in the grid to test wether there is an obstacle-tile there or not, but I'm still thinking about it. I appreciate any idea/comment, for it would be much helpful.
  12. And that just means that John D. Carmack will be working for Facebook?.....
  13.   And that is why Star Trek's transporters use a Heisenberg Compensator     Haha.. I'm reading about those transporters to get to the "Heisenberg Compensator" part.
  14.   That's essentially how the transporters in Star Trek work.  Their biggest shortcoming is being limited to the speed of light, so they would be no good for long distance travel.     You're right, it reminds a lot Star Trek. How long is that "long distance"? If it was from a country to another, I guess it would be good enough already :).
  15. Why not talk about... portals?     (Not related to Valve's Portal).   I'm not a physicist, and I have a lot to learn yet. But, isn't this "wormhole" idea a little too much absurd?   Why not think in wireless communication instead? What if matter could be converted to specific waves and then transferred perfectly to any "receiver" (And then converted back)? It's a concept much different from "wormholes". It would work much like radio. Is this idea widespread? (I have no idea), or everyone always think in "wormholes"? (I guess it would not work exactly like in the Valve's game, considering the "conversion time". So, it would end up being more like a "teleport" instead of a portal.)