Jump to content
  • Advertisement

MajorShredd

Member
  • Content Count

    70
  • Joined

  • Last visited

Community Reputation

155 Neutral

About MajorShredd

  • Rank
    Member
  1. MajorShredd

    organizing ideas and rules?

    This is all very good information, and I thank the three of you in kind! I've got more than enough to get us going. Cheers!
  2. My friend and I are starting up a game project. We have a whole bunch of rules and activities that we need to capture in written form before we start codingbut we're having trouble keeping track of everything. It's made even harder by knowing that we will probably decided to make major changes if some of the rules just doesn't pan out well. I'm curious how the big boys capture the results of all those design meetings and communicate to the developers, so if anyone is willing to share techniques that work I'd love to hear about it and model our process after the pros.
  3. MajorShredd

    when to overload copy ctor?

    Quote:Original post by iMalc Quote:Original post by MajorShredd There's something else you have to watch out for. This mutton-headed thing I did bit me for weeks in a side project. The bit I read in the first post about 'assigning a class to another class' triggered this thought, so I think it is related but if not then... oh well :) Let's say you have base class B and derived class D. If you create an instance of B on the heap and later cast it to D, things seem ok. Polymorphism at it's finest. My derived class added some new member variables, but they weren't getting initialized at the point of casting. So I wrote a copy constructor hoping to solve the problem, and it worked until I then wanted to delete the allocated object. What ended up happening is that the delete operation tried to remove the size of derived class D from allocated memory, which was bigger than its allocated size, the size of B, so I got an access error from the program when it tried to delete. Moral of the story: rule of three is a great rule but still won't solve all your problems if you aren't careful about what you're doing to begin with!I assume by that last statement you meant that you should never have casted B to D? The language tries to stop you from doing something stupid like that. A dynamic_cast would give NULL and a static_cast wouldn't compile. You would have had to force the issue with a reinterpret cast. Having intentionally done the wrong thing with the cast I presume you then later tried to delete ity through a pointer to the derived type of which the instance is of course not an instance of. The only problem with that relates back to the fact that it was wrong to perform the original cast. The only point I think you've made is that doing stupid things is, well ... stupid. Yes, that was exactly my point, noted in the very last sentence of the post - be careful not to do stupid things. However I was not thorough in explaining that there was no reason to cast in the first place. I should just have used D from the start, and that's what I ended up doing in that program.
  4. I fully expected to get grilled on this thread :) I don't suppose I have the luck that a grizzled veteran would come along and read it. As a postmortem, I found an include path option independent of specific projects that worked for what I wanted. On a lighter note, I've had my copy that long and it serves me fine for as infrequently as I have had to use it. And be fair now, there are still installed code bases in the wild running on MFC.. those bases are probably also running on a PII with Windows 98. Poor users :) As it happens I may have to work in one such base at my next job. Legacy coders can make serious bank slogging mud all day! I knew a guy that easily made middle six figures for a few months maintaining a COBOL base, knowing full well after he was done they were going to kick him. But hell, why not tuck away the extra trimmings after paying your monthlies into some nice investments? :)
  5. MajorShredd

    when to overload copy ctor?

    There's something else you have to watch out for. This mutton-headed thing I did bit me for weeks in a side project. The bit I read in the first post about 'assigning a class to another class' triggered this thought, so I think it is related but if not then... oh well :) Let's say you have base class B and derived class D. If you create an instance of B on the heap and later cast it to D, things seem ok. Polymorphism at it's finest. My derived class added some new member variables, but they weren't getting initialized at the point of casting. So I wrote a copy constructor hoping to solve the problem, and it worked until I then wanted to delete the allocated object. What ended up happening is that the delete operation tried to remove the size of derived class D from allocated memory, which was bigger than its allocated size, the size of B, so I got an access error from the program when it tried to delete. Moral of the story: rule of three is a great rule but still won't solve all your problems if you aren't careful about what you're doing to begin with!
  6. A quick web search on Google turned these up. That at least says they're popular enough that people are searching for them: SMF Vanilla I don't have experience with any forum other than phpBB, and in my experience it was awful and lost information a lot of the time. In fairness, that was over 5 years ago, and it was pre-installed on a free host I was using, and I have frequented a forum running it on better managed servers without experiencing much trouble at all.
  7. The problem I have is that I have a workspace with two projects in it. One is all of my game code, and the other is an MFC diagnostic tool I'm building for the game. I want the tool to include in its build the source files from the game project, but I don't want two copies of source floating around in two different places. I want to keep them organized by project. What I tried doing is setting the game project to be a dependent project of the tool. However I get LNK2001 errors saying it can't find the parts of my game engine I use in the tool, and it ends with LNK1120. I think part of the problem is that the .cpp files reference a relative path of the .h for my classes, and the game code classes are in a different directory than the tool code. So I tried telling the tool project to use the .obj files generated from debug builds of the game, but then I got many errors, among them ones that operators new and delete are already defined. I also tried adding additional include paths to the project settings -> C/C++ tab -> PreProcessor category, but that did not work. I guess I'm looking for something I haven't tried yet, or to know if I'm even going about this the right way. Thanks in advance! [Edited by - MajorShredd on November 9, 2008 8:35:05 PM]
  8. MajorShredd

    Radeon 9600 Pro vs. GeForce 2

    In my laptop I've got an ATI mobility 9000 and I'd swear it runs OpenGL programs faster than DirectX. I'm not familiar with the specs of the card (support of either library) and can't measure between two different programs - but short story, I love my ATi and I'll never go back to nVidia now. Of course, I'm still running a GeForce FX 5200 on my desktop, that might have something to do with it :P
  9. MajorShredd

    Loading a map from a texture

    Best advice possible (and I'm surprised nobody mentioned this) - if you're a beginner, learn to write your own code before using someone else's. Not only will you get better at solving problems, but you will (surprisingly) save yourself headaches!
  10. MajorShredd

    Loading a map from a texture

    Ah, creativity. Gotta love how it can both inspire and frustrate at the same time :) EDIT: you posted just seconds before me =P Anyway, if you're using someone else's library, it must have some sort of pixel indexing scheme (I'm assuming it holds the raster data and at least the width/height or width/number of bytes in memory). If it is possible, try extending the class to give you access to each pixel as an RGB value. That way you can just pick the RGB values out of the object and do what you will with them.
  11. MajorShredd

    glRotated( )

    Omega, I've got the solution. Part of it was indeed the push/pop of matrices you suggested. Also, I discovered that I was not using an adequate viewing volume for the rotations I had to make. The radius of my circles is 75; when calling gluOrtho2D() in the init() to define the device space, the device was only getting a viewing volume of 1 (default). So while the circles were correctly rotated, I couldn't see them because they were totally outside the viewing volume. The camera wasn't the problem, just the near and far distances. To fix it, what I did was call glOrtho() instead and define the viewing volume to span twice the size of my radii, centered on zero (-75 to +75). Then everything worked well. Thank you very much for your help. Rep++ for you :) ~ MajorShredd ~
  12. MajorShredd

    glRotated( )

    Omega, Thanks for the suggestions. However, I realized that I wasn't explicitly clear on what exactly I'm using. 1.) My program doesn't do any culling. Whatever OpenGL's defaults are is what my app uses. 2.) I doubt the object is being rotated so far out of view that it is not translated back properly (see code, maybe I'm wrong?). Here is my draw() for the GLUT window: //globals for application paramaters int g_nWindowWidth = 400; int g_nWindowHeight = 400; //globals for app-specific functionality POINT2D g_ptCenter = {g_nWindowWidth/2, g_nWindowHeight/2}; POINT2D* g_circleXY = 0; //array of points on circle's perimiter int g_approxSize = 330; //number of points in array int g_radius = 75; //radius of circle defined by those points //NOTE: g_circleXY is initialized elsewhere in the program, before // the GLUT window is created. I know for certain that it works, // it has been tested without any transformations. void draw() { glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); /* * objective is to draw circle rotated 45 degrees about the axis of rotation */ //translate to origin of rotation glTranslated(-1*g_ptCenter.x, -1*g_ptCenter.y, 0); //rotate about x axis (should "squish" the circle to horizontal-oriented ellipse) glRotated(45,1,0,0); //plot the points on this rotated plane glDrawCircleApprox(g_circleXY, g_approxSize, GL_LINE_LOOP); //translate plane back to middle of window glTranslated(g_ptCenter.x, g_ptCenter.y, 0); glFlush(); //dump graphics to OpenGL's rendering pipeline }
  13. MajorShredd

    OpenGL glRotated( )

    Hello all, I am taking an introductory course in OpenGL programming in university. I am NOT looking for an answer, but I do need help with a seemingly strange behaviour I get from the glRotated() function. The problem statement is to draw 3 circles in the XY plane rotated to look like ellipses. The output is not animated nor are there models loaded; just a bunch of points I have to transform. To solve the problem, so far I have done the following: * Created a circle approximation function that plots a number of points in a circle around a center point. I have verified its correctness, and it works, the points are defined as they should be. * Created a draw_circle function, it just dumps the points from the previous function into the OpenGL render pipeline, and draws a GL_LINE_LOOP between all the points. This works, I get a circle that looks like a circle. My problem occurrs when I want to rotate one of the circles. Rotating around the Z axis with glRotated(theta, 0,0,1) produces correct output, where theta is any value. Using the rotate around other axes (theta,0,1,0) or (theta,1,0,0) I get no output at all unless theta=0. So my question is: is there some peculiarity I am missing when calling this function? Should I try using the float version of this method? Also: I don't know if this impacts the problem, but I have set up the pipeline's PROJECTION matrix to view the window at the size I need instead of using a viewport. Could this complicate the rotation?
  14. Hello all. I'm using a map type from the C standard library to store contents of an options file. Specifically, my problem is writing its contents back to a file. The std::map does not seem to have a way of iteratively accessing its contents for writing back to the file. If I remember correctly, std::map sorts by key on insertions so it would make sense not to be able to access its members in this way. So my question is, how can I dump the contents of the std::map to a text file without considering specific key names? I've looked over the iterators it uses, I did not see (or may have missed) any way to get from one item to the next. I thought at first by getting an iterator to the beginning of the map would be the key to going through it all, but the things I tried did not seem to work. If it helps, I am using the implementation provided with MS Visual C++ 6.0
  15. MajorShredd

    I'm Deleting it all

    Everyone so far in this thread is completely right - never delete old code. You NEVER know when you'll want to reference it, whether it be for a near- or far- future project. I wrote a map editing application for a top-down RPG once, and it *basically* worked but was so far from completion and such a mess I thought I should trash it. But I saved it, and to this day I've reused SO much code from it. Another good idea is to try and modularize your code - pack it into libraries if you can, and keep an archive of them both electronically and as a hard copy. That makes it easier to pick and choose what you want to use. Print your source!! It's the ultimate backup. I have a 3-ring binder with hard copy of source and a combination of floppies, CD-R's, and ZIP disks of stuff I don't EVER want to lose. Lots of luck, ~ MajorShredd ~
  • 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!