Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

Burnt_Fyr

Member Since 25 Aug 2009
Online Last Active Today, 06:37 AM
*****

#5010683 How to draw some objects "always on top"?

Posted by Burnt_Fyr on 14 December 2012 - 12:01 PM

A simpler method IMO would be to draw all overlays last, disabling depth testing before hand.


#5006424 How do you check collision against 1000x1000 objects?

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(int i=0; i< objects.size() ; i++)
{
   for(int j=0; j<i; j++)
   {
	   // check collisions
   }
}

Your implementation results in n^2 tests, the above in a little over 1/2 that.


#4995551 Sorting vertices of a polygon in CCW or CW direction

Posted by Burnt_Fyr on 30 October 2012 - 02:03 PM

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.


#4995387 Resizing a UI element (Best practice)

Posted by Burnt_Fyr on 30 October 2012 - 06:58 AM

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.


#4995148 PROBLEM - Block breaker with air hockey PLAYED with 2 HUMAN PLAYERS

Posted by Burnt_Fyr on 29 October 2012 - 02:10 PM

#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.

#2 no...

#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.


#4981716 Project Planning? (UML?)

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.


#4976832 Quaternion x,y,z rotation

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 :)


#4971184 Boat Navigation physics

Posted by Burnt_Fyr on 19 August 2012 - 01:27 PM

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.


#4970979 Lighting in caves

Posted by Burnt_Fyr on 18 August 2012 - 07:49 PM

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.


#4923741 Renderer class, Textures + VBO

Posted by Burnt_Fyr on 20 March 2012 - 03:08 PM

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.


#4899366 About 2D Engines

Posted by Burnt_Fyr on 03 January 2012 - 01:45 PM


@IceBreaker23

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.


#4899358 lookAt... mouse?

Posted by Burnt_Fyr on 03 January 2012 - 01:28 PM

is there any other way I can solve 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 : )


#4882943 [D3D9] Deferred Rendering: Point Lights (includes PICTURES)

Posted by Burnt_Fyr on 11 November 2011 - 09:15 AM

have a look at catalins xna blog here

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?


#4878966 giving the game some 'structure'

Posted by Burnt_Fyr on 31 October 2011 - 12:47 PM

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.


#4873861 RGB to hex

Posted by Burnt_Fyr on 18 October 2011 - 06:23 AM

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?




PARTNERS