• Content count

  • Joined

  • Last visited

Community Reputation

167 Neutral

About monachus

  • Rank
  1. OpenGL particles in c++ using openGL

    Are you completely new to OpenGL? I would advise to learn "modern" OpenGL programming and most tutorials only teach the old ways. A good reason for learning modern GL is that WebGL and Mobile devices don't support the old way. This is a great resource: [url=""][/url]
  2. The Lean Design

    [quote name='Ashaman73' timestamp='1338541125' post='4945251'] The whole software industry is moving into a more agile direction the last several years, agile development processes includes lean, scrum and xp. All share the same basic idea: smaller iterations and feedback based design. So, yes, this is a good idea. [/quote] So feedback based design is already common practice? How early in development does playtesting usually take place? I thought that playtesting was done later in production. [quote name='aattss' timestamp='1338554448' post='4945282'] It's the opposite of every other game. In many games, players play but stop after beating the game so many hours later. Games like Minecraft, on the other hand, only grow more and more. [/quote] So don't you think it is possible for most games to change the game design and game idea based on player behavior? I think it is possible to have a prototype of the game with most of the design implemented; just gameplay, even if it is buggy, graphics are ugly, has no story and no sound, and expose that to the players (or playtesters) as early as possible so you can improve the design, get rid of crappy ideas and discover new ones before the game is too big to be maleable. I'm talking of 'design development' before 'game development' and doing the former in a more "agile" fashion.
  3. The Lean Design

    Have you read The Lean Startup, or heard of it? If you haven't, it is collection of simple concepts: Launch a minimium version of your product, learn from consumer behaviour and modify or produce more. Iterate indefinitely. The Lean Startup is a fad, but there are lessons to be learned from it and I think that game design can benefit from them. I'm working on my first indie game and the idea is still not completely defined. I am working on the minimum possible version 1.0. I am doing this because it is fun but I also want to make money. I believe that if the process of designing my game follows these principles I will have a better chance of success and end up with a better game. An (exceptional, but still...) example I like to think about is Minecraft. It was developed in an open fashion with continuous feedback from it's exploding community; very similar to the 'lean startup' ideas on how things should be done. I don't think this design strategy could work for all games. And I don't presume that it leads to minecraft-level success; but I think that it may work for certain games, especially in the mobile space like in my case. It is certainly better than working on something for a year or more only to find out that people don't like your idea and they don't want to play your game. I just wanted to share these thoughts and read your opinions. =)
  4. OpenGL Isometric drawing troubles.

    Try glLoadIdentity after the matrix push. Maybe you are compounding matrix operations. Showing us more code would help, I think
  5. TGA Import Error

    What do you need it for? This is a good opportunity to read the TGA spec and implement a very simple reader that suits your needs. In my case, some time ago I needed a TGA loader for a simple arcade game. I implemented a simple, small reader that only read 24bit uncompressed images that I had exported from GIMP. Good enough for my needs and I was a better programmer when I finished. Read the spec, you will learn a lot and you will have a lot more fun because you will have understanding.
  6. pyCave, a 3D tunnel game.

    Thanks for trying it out! You're not the only one who thinks it's tough. Some people can't get past the first bar, and some people find it too easy until they reach "Hardcore Mode" at the end of the tunnel. I am not 100% happy with the shadows. The tunnel can't cast a shadow over itself, and if the ship gets close enough to another surface the shadows disappear. Both of those problems are related to the precision of the depth-buffer. A solution would be to implement shadow volumes just for the tunnel, but that method is very CPU-hungry and Python probably wouldn't cut it. I don't know what you mean with the shadows overlapping part of the cave. Maybe you're refering to the huge shadows that the bars sometimes cast? (Like in the screenshot)
  7. Coding a Fallout-like game

    It's looking very nice! It's a pretty ambitious project. Best of luck. How are you doing the isometric projection? Are you making a custom matrix for OpenGL? Or is it not isometric and is truly 3d?
  8. Hi! I just wanted to show off the first beta version of my game: pyCave. It is a clone of SFCave, an old game for the palm pilot. Other similar games are the 'Helicopter Game', or Jetman (on facebook). I tried to keep it close to the original. The game is finished in the sense that it is playable and fun, but there is still some work to be done. I want to add more effects and make a decent ship with an actual texture. It is written entirely in Python and I implemented shadow maps for eye-candy. If you are on Windows, you don't need python to play it, everything you need is enclosed in the zip (which by the way is a little heavy at 16MB.. sorry about that) Screenshot: Windows version Linux version PyCave's site Please check it out! I hope you like it; Let me know what you think =) (Edit: I changed the links to a newer version that fixes a compatibility issue with the Zip file, and reduces the size.) [Edited by - monachus on March 9, 2009 12:43:34 AM]
  9. Music on an arcade game

    Thanks a lot for the replies! Already there are varied opinions. From 'annoying' to 'part of the arcade experience'. I am going to go the lots-of-audio-options way. Thanks again guys =)
  10. (This question isn't about composition or anything related to the creation of sound, I thought Game Deign was a better category for it. The moderator can move it if they think otherwise) I am finishing an arcade game (SFCave/Jetman clone) and my brother is composing some music for it that will be great for the menus. Now I'm faced with the decision of adding the music to the game itself. I know how annoying the background music on arcade games can be. Lately when I play simple games downloaded from the Internet, I tend to just mute the sound. The music my brother is writing is an upbeat techno track, the kind that I would find very annoying. What is the best background music for an arcade game? Would it be better to leave the actual game without music and just add some sound effects? Do I leave the techno music with a low volume? Do I tell my brother to write another (more mellow) track for the game? Just write your opinions on arcade game music so I know what the general views are :). It may be that it's just me and everyone else loves loud techno music for arcade games.. Thanks!
  11. OpenGL OBJ loader problems

    Actually I have already fixed it, but thanks anyway! =) Here's the working modules: from OpenGL.GL import * from tga import * class Model: def __init__(self,fname,texFile): self.mesh = OBJMesh(fname) self.pos = (0,0,0) self.list = 0 self.createDisplayList() self.texFile = texFile if self.texFile != 'none': self.loadTexture(texFile) def createDisplayList(self): print 'MESH: Creating display list...' self.list = glGenLists(1) glNewList(self.list,GL_COMPILE) glBegin(GL_TRIANGLES) for face in self.mesh.faces: for i in xrange(3): v = face[0][i] t = face[1][i] n = face[2][i] v = self.mesh.vertArray[v-1] t = self.mesh.textArray[t-1] n = self.mesh.normArray[n-1] glNormal3fv(n) glTexCoord2fv(t) if len(v) == 3: v.append(1) if len(v) == 4: v[3] = 1 glVertex4fv(v) glEnd() glEndList() print 'Done.' def loadTexture(self,fname): self.texture = TgaTexture(fname) self.texture.newGLTexture() def draw(self): glEnable(GL_TEXTURE_2D) glBindTexture(GL_TEXTURE_2D, glPushMatrix() glTranslatef(self.pos[0],self.pos[1],self.pos[2]) glCallList(self.list) glPopMatrix() glDisable(GL_TEXTURE_2D) def freeList(self): glDeleteLists(1,self.list) class OBJMesh: def __init__(self,fname): self.vertArray = [] self.normArray = [] self.textArray = [] self.faces = [] self.numFaces = 0 self.openObjFile(fname) def openObjFile(self,fname): print 'MESH: Reading OBJ file...' f = open(fname,'rt') lines = f.readlines() f.close() words = [] i = 0 for line in lines: words = line.split() i += 1 if len(words) < 1: continue if words[0] == 'v': x = float(words[1]) y = float(words[2]) z = float(words[3]) self.vertArray.append([x,y,z]) if words[0] == 'vt': u = float(words[1]) v = float(words[2]) self.textArray.append([u,v]) if words[0] == 'vn': x = float(words[1]) y = float(words[2]) z = float(words[3]) self.normArray.append([x,y,z]) if words[0] == 'f': verts = [] texcoords = [] norms = [] for w in words[1:]: ind = w.split('/') v = int(ind[0]) if(ind[1] != ''): t = int(ind[1]) else: t = 1 n = int(ind[2]) verts.append(v) texcoords.append(t) norms.append(n) self.faces.append( [verts,texcoords,norms] ) self.numFaces +=1 print 'done.' print 'MESH: Loaded', len(self.vertArray), 'vertices,',len(self.textArray), 'texture coordinates and',len(self.normArray),'normals.' print 'Mesh has' , self.numFaces , 'faces.' The TGA loader: # -*- coding: utf-8 -*-, by Sergio González, 2007 #Class that loads TGA textures and can upload them into OpenGL from OpenGL.GL import * import struct import global_opts #Only loads 24 or 32 bit uncompressed TGA textures #Use textures with powers of two dimensions on older hardware.. class TgaTexture: def __init__(self,fname): f = open(fname,'rb') #Skip useless stuff w = struct.unpack('h', h = struct.unpack('h', bpp = struct.unpack('B', descriptor = self.size = (w[0],h[0]) self.bpp = bpp[0] #Tga format stores it as BGR. #Let OpenGL do the changing. if self.bpp == 24: self.internFormat = 3 self.texFormat = GL_BGR if self.bpp == 32: self.internFormat = 4 self.texFormat = GL_BGRA else: print "Image Format not supported" exit(-1) pixnum = self.size[0] * self.size[1] imgSize = pixnum * self.internFormat self.texels = f.close() print 'TGALOADER: Loaded', self.bpp, 'bit,',self.size[0],'x',self.size[1],'image:',fname def newGLTexture(self): = glGenTextures(1) glBindTexture(GL_TEXTURE_2D, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexImage2D(GL_TEXTURE_2D, 0,self.internFormat,self.size[0],self.size[1],0,self.texFormat,GL_UNSIGNED_BYTE,self.texels) print 'TGALOADER: Stored 2D texture in OpenGL with name',
  12. I have some problems when importing models into OpenGL using my own obj loader. The vertices are perfect but the normals and the texture coordinates are doing strange things. Here is the rendered model: and here is a screenshot of the imported model: I don't know what is it that i'm doing wrong. As you can see, the lighting is not completely wrong, but some vertices are brighter or darker than they should be. The texture seems to look better as the resolution of the model goes up. When it is a cube, instead of a jagged smiley face you get two black stripes. I've gone over and over the code and I can't find the issue. Here is my obj loader (It uses my own tga loader, which I know it works.) It is all written in Python: (edit: i didn't use the source tag) from OpenGL.GL import * from tga import * #Each member is and index to vertex, normal and texture arrays. class ArrayIndex: def __init__(self): self.vert = 0 self.texcoord = 0 self.normal = 0 class Vertex: def __init__(self,x,y,z): self.x = x self.y = y self.z = z class TexCoord: def __init__(self,u,v): self.u = u self.v = v class Mesh: def __init__(self,texName,objFile,texFile): self.numTriangles = 0 self.has_texcoords = True self.texName = texName self.vertArray = [] self.textArray = [] self.normArray = [] self.index = [] self.readObjFile(objFile) if texFile != 'none': self.loadTexture(texFile) self.createDisplayList() #This function returns numbers found in lines of .obj files #line to iterate, i is the character from where to start #returns the number and the place where it ended. -1 if the line finished def iterateLine(self,line,i): num = '' while True: if line[i] == '\n': i = -1 break if line[i] == ' ': i += 1 break else: num += line[i] i += 1 return (float(num),i) def readObjFile(self,fname): num_vertices = 0 num_texCoords = 0 num_norms = 0 file = open(fname,'rt',) print 'MESH: Reading file' , fname , '...' lines = file.readlines() file.close() #Indices start at 1. 42 is our magic number at [0] self.vertArray.append(42) self.normArray.append(42) self.textArray.append(42) #self.index.append(42) for line in lines: #Found a vertex if line[0] == 'v' and line[1] == ' ': #Res: Tuple: a) Value of x y or z coordinate # b) Index of next value (or -1) res = (0.0, 2) vert = Vertex(0,0,0) for i in xrange(3): res = self.iterateLine(line,res[1]) #self.vertArray.append(res[0]) if i == 0: vert.x = res[0] if i == 1: vert.y = res[0] if i == 2: vert.z = res[0] num_vertices += 1 self.vertArray.append(vert) if line[0] == 'v' and line[1] == 't': res = (0.0, 3) tex = TexCoord(0,0) for i in xrange(2): res = self.iterateLine(line, res[1]) if i == 0: tex.u = res[0] if i == 1: tex.v = res[0] num_texCoords += 1 self.textArray.append(tex) #Found a normal if line[0] == 'v' and line[1] == 'n': res = (0.0, 3) norm = Vertex(0,0,0) for i in xrange(3): res = self.iterateLine(line, res[1]) if i == 0: norm.x = res[0] if i == 1: norm.y = res[0] if i == 2: norm.z = res[0] num_norms += 1 self.normArray.append(norm) #Found a face if line[0] == 'f' and line[1] == ' ': self.numTriangles += 1 num = '' indexType = 'vert' #vertex, texcoord, normal v = t = n = 0 i = 2 #This loop reads the line while True: #A space means we have the 3 indices if line[i] == ' ': n = int(num) tmp = ArrayIndex() tmp.vert = v tmp.texcoord = t tmp.normal = n self.index.append(tmp) num = '' v = t = n = 0 i += 1 indexType = 'vert' #A new line means we have 3 indices and no more within the line if line [i] == '\n': n = int(num) tmp = ArrayIndex() tmp.vert = v tmp.texcoord = t tmp.normal = n self.index.append(tmp) break #We've got an index for a vertex, texCoord or Normal. Reset the number if line[i] == '/': if indexType == 'text' and self.has_texcoords == True: if num != '': t = int(num) else: self.has_texcoords = False #indexType = 'norm' if indexType == 'vert': if num != '': v = int(num) else: print 'objLoader: ERROR. No vertex information.' return indexType = 'text' num = '' i += 1 #We're in the middle of a number, add the digit. else: num += line[i] i += 1 print 'MESH: Loaded ', num_vertices, 'vertices,',num_texCoords,'texture coordinates and', num_norms, 'normals.' print 'Model has', self.numTriangles ,'Triangles' def loadTexture(self,fname): self.texture = TgaTexture(fname) self.texture.newGLTexture(self.texName) def createDisplayList(self): print "MESH: Creating display list..." self.list = glGenLists(1) glNewList(self.list,GL_COMPILE) glBegin(GL_TRIANGLES) for i in xrange(self.numTriangles * 3): index = self.index[i] vIndex = index.vert nIndex = index.normal tIndex = index.texcoord vert = self.vertArray[vIndex] norm = self.normArray[nIndex] tex = self.textArray[tIndex] glVertex(vert.x, vert.y, vert.z) glTexCoord2f(tex.u,tex.v) glNormal(norm.x,norm.y,norm.z) glEnd() glEndList() print 'Done.' def drawGeometry(self): glEnable(GL_TEXTURE_2D) glBindTexture(GL_TEXTURE_2D,self.texName) glCallList(self.list) glDisable(GL_TEXTURE_2D) def freeList(self): glDeleteLists(self.list,1) Hope you can help =) Thank you [Edited by - monachus on February 6, 2008 9:11:58 PM]