Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

134 Neutral

About Darkor

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello, I have a problem when I try to do this: /contacts/contact[ contains(./particulars/name, 'testname') or contains(./labels/label, 'testlabel') and ./groups/group='testgroup'] What I am trying to do is to implement a search query in XPath. I have to find if the query parameter is found in a name, label or group element. I get some pretty weird behaviour but I'm sure it's something that someone have come across before. The above XPath doesn't test all labels but instead takes the first one. There are multiple labels and groups for each contact, but only one name. Plus it looks to me that the 'and' operator isn't working because no matter what values I give to group, it has no effect.
  2. Darkor

    Using XML DOM

    You just said that DOM requires the entire tree to be available so won't that mean that loading the entire XML database using DOM is inevitable? In that case, the data generated in preparsing will only be used for listings and searches because it's faster? How are your unique tokens generated? Are they like primary keys from your XML elements or simply autonumbers? I realise that all my sentences are questions =x
  3. Darkor

    Using XML DOM

    Is parsing the xml data into my own containers advisable? In your hybrid approach, you say you use SAX to save large chunks of data to disk. I don't get why you're doing this and what do you mean by replacing them with tokens? I'm guessing that by tokens, you mean something like a unique ID. Presumably, you generate these tokens by yourself. But how are you going to use these tokens to represent data in the XML database? Using the index of the elements? Thanks for the reply.
  4. I store quite a bit of information in XML files and was wondering if using DOM to read them all in was a good idea. Firstly, I'm going to edit these data, so most online articles suggest using DOM. However, I wish to implement search functionality and was thinking along the lines of using a forward parser to read in all the data and store them in a SortedList. These will require my XML data to be indexed and will this be a good idea? I will only use DOM, to edit fragments of XML data, which I read in using the index. I believe XPath will be used for this purpose. Am I on the right track?
  5. I feel like I've coded myself into a corner once again. See, I've been working on a 3D engine that's based loosely on how OGRE does things. I now have a render function which grabs renderables from a queue and displays them. Each renderable stores a single world transform matrix which is loaded before rendering. I am now trying to create a Camera class and this forms a big problem because no matter where I locate my camera too, the renderable world matrix transforms it to the same location every time with respect to the Camera. At least, that is what I think the problem is. How would one go about solving this problem?
  6. Darkor

    Best way of defining NPC behaviour

    The game that I'd most like to see done would be an MMO that's populated by NPCs and players can immerse themselves in a world that lives and breathes even without their intervention. Like some have said, there would be heroes and villians in the world. It would be pretty grand, with different cities and races and governing bodies. So the goals of NPCs wouldn't just be living and killing. They would have political agendas and kings could declare war on other nations or improve the social lives of their subjects by building up their cities. Perhaps the player might even play the king and take on these responsibilities on their own. We would make this game go without restrictions but the world will react accordingly to players' and NPCs actions. So if you're a PKer, you'll have to fight off the guards if they see you. If you're too powerful, then vigilante groups or other higher powers will intervene. In fact, perhaps someone who is cunning enough may try to plot the end of the world by turning nations upon each other with some treachery. So there wouldn't be a single goal for players to reach, but they can certainly form their own. However this kind of seems to be rather unrealistic when looking at the games of today. Plus we might need very powerful servers in order to support the simulation of the game world and its NPCs. But how feasible would a game like this be in 5 or so years?
  7. You would want to store the animation parameters in a different class, say a RenderOperation. The RenderOperation will take the start index and end index if your mesh is using keyframe animation. So when you 'draw' an object, you are essentially adding it to a list of RenderOperations. When your renderer does the actual drawing, it just loops through these RenderOperations, uses the keyframe data and draws it to screen one by one. Hope that helps.
  8. Darkor

    Best way of defining NPC behaviour

    Wouldn't it be cool if one day we could create fully autonomous NPC behaviour that could produce a simulation consisting of a few million of these agents? Then we introduce players to the equation where they can fully interact with these agents. It's sort of an MMO but with more NPCs than actual players. In fact, you can't tell if a person is a player or NPC without talking to it. As for your question, I think NPCs should be both need and goal driven as we all humans are. I feel that NPCs should 'work' without player interaction. The interaction between players and other NPCs should be the same for most parts, except in the language used to communicate to humans. You also have to factor into account the psychological side of needs and goals. NPC A might forgo the need of food in order to save NPC B. This would likely be some sort of fuzzy system whereby needs, goals, desire and character traits affect the outcome.
  9. Hmm, so I should implement a function to take in two vectors? Okay I will try out what you suggest. Thanks =p What about a function like glRotatef()? Can I implement something like that as well? I already have a function that replicates the effect of glTranslatef() on the matrix, but it's a bit more complicated with rotation because the rotation matrix for each axis is different. Any advice?
  10. Yes! I got it working. For the benefit of those who might encounter the same problem (however slight that chance), I'll post what went wrong. I kinda forgot that my RenderSystem isn't a MonoState and happily declared another one. Due to the degree of automation, it magically created a seperate window that never displayed but nonetheless existed. So at the point where I was trying to use the existing HDC to create the font, it was using a new HDC that wasn't prepared with OpenGL, and thus the call to wglUseFontBitmaps() failed. This was fixed by creating a new context and making it current, but obviously wasn't the solution because now we have two windows, with the font being prepared on the wrong one. This is once instance why some classes should simply be MonoStates or Singletons.
  11. mikeman: It still doesn't work. But I appreciate the help you've given me so far. I'll post some codes on how I set up OpenGL and see if you guys could spot any problems. =p void Win32Window::setupPixelFormat() { PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), // size 1, // version PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER, // support float-buffering PFD_TYPE_RGBA, // color type mBits, // prefered color depth 0, 0, 0, 0, 0, 0, // color bits (ignored) 0, // no alpha buffer 0, // alpha bits (ignored) 0, // no accumulation buffer 0, 0, 0, 0, // accum bits (ignored) 16, // depth buffer 0, // no stencil buffer 0, // no auxiliary buffers PFD_MAIN_PLANE, // main layer 0, // reserved 0, 0, 0, // no layer, visible, damage masks }; SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd); } void Win32Window::setupPalette() { int pixelFormat = GetPixelFormat(hDC); PIXELFORMATDESCRIPTOR pfd; LOGPALETTE* pPal; int paletteSize; int redMask, greenMask, blueMask; int i; DescribePixelFormat(hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd); if (pfd.dwFlags & PFD_NEED_PALETTE) paletteSize = 1 << pfd.cColorBits; else return; pPal = (LOGPALETTE*)LocalAlloc(LPTR, sizeof(LOGPALETTE) + paletteSize * sizeof(PALETTEENTRY)); pPal->palVersion = 0x300; pPal->palNumEntries = (short)paletteSize; // build a simple RGB color palette redMask = (1 << pfd.cRedBits) - 1; greenMask = (1 << pfd.cGreenBits) - 1; blueMask = (1 << pfd.cBlueBits) - 1; for (i=0; i<paletteSize; ++i) { pPal->palPalEntry.peRed = (BYTE)( (((i >> pfd.cRedShift) & redMask) * 255) / redMask); pPal->palPalEntry.peGreen = (BYTE)( (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask); pPal->palPalEntry.peBlue = (BYTE)( (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask); pPal->palPalEntry.peFlags = 0; } hPalette = CreatePalette(pPal); LocalFree(pPal); if (hPalette) { DeleteObject(SelectPalette(hDC, hPalette, FALSE)); RealizePalette(hDC); } void Win32Window::create() { hDC = GetDC(hWnd); setupPixelFormat(); setupPalette(); hGLRC = wglCreateContext(hDC); wglMakeCurrent(hDC, hGLRC); if (hGLRC == 0) { throwEx(Exception::INTERNAL_ERROR, "Error creating OpenGL window", "Win32Window::create"); } } void RenderSystem::initialise() { mFaceCount = mVertexCount = 0; glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glEnable(GL_CULL_FACE); glFrontFace(GL_CCW); //glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_SMOOTH); glEnable(GL_COLOR_MATERIAL); glShadeModel(GL_SMOOTH); ImageCodec::loadImageCodecs(); Material* mat = (Material*) MaterialManager::getInstance().create("white"); mat->setShininess(16.0f); mat->setAmbient(0.5f, 0.5f, 0.5f); mat->setSpecular(1.0f, 1.0f, 1.0f); mat->setDiffuse(0.5f, 0.5f, 0.5f); loadExtensions(); }
  12. Thanks for the replies, I was starting to think that no one would help me =x Dave Hunt: I am certain that I've called wglCreateContext() prior to setting up the font. Plus I don't have any function calls in between both functions. This is rather perplexing. mikeman: I'm trying that now, but it still doesn't work. Sometimes I get an error saying that it's the wrong pixel format. And I read somewhere that it won't work with double buffered pixel formats. Erm what is this and how do I disable it?
  13. I've already searched on the forums... while lots of others have sufferend similar problems using wglUseFontBitmaps(), none of the solutions I've tried has worked. I guess I should state things cleanly. wglUseFontBitmaps() returns FALSE but when I use GetLastError() it tells me that the operation completed successfully. I got it to work by using (and it returns TRUE): HGLRC hglrc = wglCreateContext(hdc); wglMakeCurrent(hdc, hglrc); And this allows fonts to be displayed, which works perfectly if not for the fact that I can't draw anything else that is in non orthonal mode. Please help.
  14. Hey guys, I need to draw some text. Help would be greatly appreciated! The thing is, when the function call sfails I use GetLastError() but it says that the operation completes successfully... what gives?
  15. HDC hdc = mWindow->getHDC(); HGLRC hglrc = mWindow->getHGLRC(); wglMakeCurrent(hdc, hglrc); oldFont = (HFONT) SelectObject(hdc, newFont); BOOL success = wglUseFontBitmaps(hdc, 32, 96, base); This doesn't work, the call to wglUseFontBitmaps fail. HDC hdc = mWindow->getHDC(); HGLRC hglrc = wglCreateContext(hdc); wglMakeCurrent(hdc, hglrc); oldFont = (HFONT) SelectObject(hdc, newFont); BOOL success = wglUseFontBitmaps(hdc, 32, 96, base); This works and text displays, however, this affects other renderables. But the funny thing is that only renderables that are rendered in orthogonal projection works. Why does wglUseFontBitmaps require a call to wglCreateContext when I already have a context? Does the context expire or something?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!