Posted by Burnt_Fyr
on 02 December 2012 - 04:53 PM
in addition to what was said,ie: using some form of broad phase culling of objects that can't possibly collide, your loops are naive in that they check each item with each other item... twice. Better would be to change the second loop to:
for an example in code, look for Eberle's paper on clipping a mesh against a plane. It has a function Get ordered vertices that does exactly what you want, and describes the process, which is essentially the same as Khos described. Pixalot's method will work as well, but might be confusing in the realm of 3d, where left and right are not absolutes.
I think most people would recommend CEGUI, though I have no experience with it, so I can't say if it is the tool you are looking for.
As Xanather mentioned, box 9 or 9 quad or what ever it is called is a very nice method for ui window construction, allowing windows to stretch without distortion. I'm sure something similar could be done for basic circles, but i have a feeling you want something more organic than that.
Resizing from a control is as easy as calling window.resize(), howeve, implementing resize() that will work in multi resolutions, will require a layer of abstraction, using a virtual coordinate system(or just make the entire thing in NDC space).
There was a really good article on here a while back, about making a custum ui... I'm sure you can still find it here somewhere. Basically all windows and controls are decendents of a base class, and each is a node in a linked list of windows/controls that are drawn from bottom up. When you resize your window, it can pass the resize info down to it's children, as well as to it's siblings, so that they maybe adjusted in turn.
#1 no... easy as pie, use 2 arrays, on keydown, mark key as down, on key up, mark key up... next frame, copy 1st array to the second, and repeat... A key that was down last frame and this frame is held, else it's a new button press.
#3 Input should be just like any other task such as physics, or rendering, ie: it will be processed during a slice of the timestep, so collect your key ups key downs when they occur, process them all at once.
As Alvaro mentioned, each os will have it's own method of providing keyboard input. In windows, this would be the windows message pump, and the keyup/keydown messages. This is where a prebuilt library will help, but it is not necessary.
Posted by Burnt_Fyr
on 19 September 2012 - 09:30 AM
In my experience, which compared to many here is negligible, UML is a nice tool. I use basic class diagrams to get an idea of how classes can be generallized(hmm... all 3 of these have a transform function, perhaps a superclass should be created) and broken into separate codebases/libs. I also am a big fan of sequence diagrams, so I can see who will call what to get the job done.
On the other hand, as Simon mentioned, UML is it's own language, so essentially you are writing code twice, each time you change your code, you must update your UML model to reflect the changes, or vice versa. I find it the same way with documentation. So you may end up writing your program 3 times in 3 languages. Enter tools like doxygen, to extract usable documentation, or staruml(my personal fav uml modeller) to extract uml class diagrams from a code base.
My work flow now is: a
quickie design model, using starUML, pen and paper is fine, but with starUML I can then export as c++( interfaces only, unfortunately it doesn't write implementations ).
test/debug/rinse/repeat until I'm happy it works as expected.
import the 'finished' project into starUML as an implementation model.
create docs with doxygen.
Posted by Burnt_Fyr
on 05 September 2012 - 08:32 AM
Rather than building your quat from scratch each time, you need to update your models orientation from it's previous orientation. I'm not great with quats but here is what i do with matrices, the ideas should perkolate through regardless.
Edit: didn't see answer previously, do as derkai says
to match a real sailing vessel, you can calculate center of effort from sails(centroid will work) and apply the force there. this will cause the vessel to heel, as well as turn. as the hull heels(rolls) and pitches the center of boyancy changes and provides force and torque as well.
I think I would use a trigger plane at the entrance, which controls the scenes ambience. As you approach the trigger, it activates and records your distance from the plane, as this distance decreases( you approach the entrance) , dim ambient... at a certain point, perhaps when you hit some -r distance from the plane, leave it alone, reverse it on the way out.
I can only speak of what I've done, but here it is
IRenderer->BaseRenderer->Derived (either open gl or dx);
The IRenderer has pointers to ITextureManager, IShaderManager, IMeshManager ( I know the idea of a manager is bad, but in my code they are really just objects that handle the lifetimes of their subobjects).
The base renderer is there just to implement any shared behaviors between OGL and DX. Each derived renderer instances a derived version of the 3 interfaces above(and a few more that aren't relevant to this topic). When a mesh is loaded, all textures are passed to the texturemanager, and the id is stored in mesh::skinids vector. Shaders are handled the same way. The mesh id is stored in the game object that references it, so when it is passed to the renderer, the renderer can use the mesh id to query the meshmanager to find out what textures/shaders need to be bound. It can then(well not yet, but it is high on the priority list) sort all objects
to render in an optimum way.
Thanks for the answer. The problem with 2/4 is that I have lots of items in the same scenario. Do I need to check the x-y axis of all items in oder to know which one I am picking? I do the colission detection with a DirectX function.
If you are testing 100 objects with one point you´ll need 100*4 int-compares(normally a bounding box does it). ( x1 >= x2 && y1 >= y2 && x1 <= x2+width && y1 <= y2+height) But why would you want to make 100 objects on a single screen? Furthermore a modern pc will handle this, I think.
Keep in mind that you are only using 2D and this with c++, a really fast language. Modern 3D games do much more on the CPU in one frame.
Hope I could help you!
This is also where specialized scene hierarchies, such as quadtrees can help. But again, modern computers are more than capable of handling a load like this.
Well, your mouse coords are 2D, your bow trajectory is 3D. So either you convert your 2d mouse coords into a 3d ray from camera to the projection surface, or convert an infinite amount of 3D points to 2D to see if they match the mouse coords. Your choice : )
i also made my baby-steps in deferred rendering based on his tutorial and it's really well written and rather easy to understand
This is even less helpful than the previous response. You have linked the same blog the OP was following.
@ op; I know how frustrating it is seeing the view count go up and the reply count stand dormant. I've looked at your post but as I'm still forward rendering I won't be as helpful as those with time in the trenches.
First, have you tried shrinking the size of your view frustum, there by increasing resolution in the Depth buffer? you had mentioned it in a previous post, and it struck me that this could be a depth issue( especially with the grainy vertical blue lines on the right of the second picture, although upon closer inspection it appears to be the pleats of the curtains). If you have and it wasn't the issue than I would try some simpler geometry that we can solve by pen and paper if need be. Maybe a sphere light with a simple box around it?
hey guys. i am writing up my own framework for building games using XNA. its going fairly well at the moment. Put simply, i have physics working, a particle engine, a finite state machine to swap between menu/ingame/pause, and my entity manager for my game objects. there is alot missing at the moment, but the main things i need to create a game are in place. I am taking a code-as-you-go sort of approach. when i need it, i'll implement it. this is to help me get a general idea of how everything is going to work together and once i am done with this game (A game similar to Asteroids) i can re-write all the messy stuff.
Right now i have the entire game of asteroids working. You can fly around, shoot asteroids, destroyed asteroids split into smaller ones, physics works fine with asteroids bumping into one another and particles are also working. The game play is, for this project anyway, 100% complete. Now i just need something to hold it all together and turn it into an actual game. I need actual menu's. A score keeping system (HUD). Lives. I need to define victory and loss conditions, that would trigger an appropriate end to the game. But i have never programmed anything like this before and i dont know what i need to achieve this.
from what i wrote above, it sounds like i am going to need atleast 2 key components. Something to manage the HUD. and a messaging system to notify everything of events. For example, notify the HUD of player death so it can display "You Loose".
Anyone have any tips to share or advice to give here?
Take my advice with a grain of salt:
3 interfaces IEvent(base event), IEventListener(handles events) and IEventDispatcher(allows registration of listeners, handles dispatching to interested parties).
All entities implement the listener and dispatcher interfaces. I also have a simulation class which holds my object factory, entity manager, etc. which also implements these 2 interfaces.
All UI is done through my GUI class, which acts a tree of UIElements, and I've subclassed this class to create buttons, list boxes, etc. Each (again) implements the two interfaces.
The game receives input, and creates a laser fired message. if the laser beam colides with an asteroid, the Game can pass a You'veBeenHitMessage to the asteroid in question. The asteroid is destroyed, and lets the game know via DeadAsteroidMessage. The game in turn tells the Simulation, which tells the Entity manager. Now this should also give the player points, so I would subclass the UIElement Class, to make a custom ScoreElement, and in it's Handle Event method, handle the DeadAsteroidMessage by incrementing the score.
I got a function which colors pixels but it either needs a single int or a hex value to do so. I've managed to get my values in to a string so I just need to read that string correctly. If all the values are 255 my string would look like "FFFFFF" but I need to send this to my coloring function as 0xFFFFFF.
There is another way I think but I'm not sure if this would work and that would be to interpret the string as hex and return the value as int but I dont know how to do this either.
For something performance critical like real time rendering(which is what i assume your doing), you likely don't want to be using strings in this way. Why not work with ints to begin with?
So is the typical idea that someone should start out with something lower level like sdl and opengl, and once they know whats happening and they just need to be productive, move onto an engine?
No. Knowing what is happening is overrated.
This is one of the most bizarre responses I have ever gotten lol. Is this a serious answer? Do you all actually think like this ? I would honestly hate using something and not knowing what the hell it was truly doing. So you would recommend that a new programmer whos never made games before to use the highest level engine possible to make a game, and not at all concern themselves with anything that they dont need to in order to finish the game?
Can you explain how your microwave works? And if you can, does it make you any better at using it? How about the internal combustion engine? Forced air heating?
Something I struggled with for a long time(and still do to some extent) is that 'why' is more important than 'how'.