|
Hello
Codersky Magazine ( software press poland) would like to propose you to write an article about Game Developement for our magazine. the topic can be chosen by you , you can tell readers about ur past experience .
The article should consist of 3500 words + 5 graphics and should be written in next 2 weeks.
We offer you own publication in our magazine and free advertisement.
Please let me know if you are interested in contribution.
Kind regards
M.M
maia.mekvabishvili@software.com.pl
|
|
|
|
|
Have fun with the wave of spam hopefully jamming your inbox now. By the way, one more report on your profile page and your account here on Codeproject's history. Probably only a matter of minutes.
SoftwareWarsaw wrote: about ur past experience
Wow, is that the level on which you are writing in that magazine? Doesn't look too great.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
hi,
i am working on multiplayer online poker. since this is the first time i am doing this kind of thing, i am not sure that i have a good approach. can u tell me your opinion and way this is usually done?
i have a asp.net web service on server wich holds information, data and state of games. on client i have Silverlight poker wich is connecting on server every 2 seconds to get current situation via "GameSituation" object.
i am afraid of those "2 seconds". if there will be 20 000 players online, is this 2 seconds from each player too much to handle? is this right approach in programming multiplayer games or it can be done like: server waits for client, client contact server, server send info ("GameSituation" object in my case) to all clients in game? is client "hearth loop" good or evil?
|
|
|
|
|
Polling is sometimes necessary. However, here are a few ideas to help you avoid it or minimize its impact:
- Create a duplex service so client 1 sends info to the server and the server sends that info to client 2. I'm not sure if a duplex service uses polling under the hood, but if it doesn't then this could be what you're looking for.
- Find a way to have client 1 talk directly to client 2 without using the server as an intermediary. You'll definitely need the server to hook them up, but once they are in communication they can in theory keep communicating without a server intermediary. I am not sure if Silverlight prevents client to client communication (this will require some research on your part).
- Rather than poll with a constant time gap, decide on a minimum (say, 1 second) and a maximum (say, 10 seconds). The server will keep track of how many connections their are and inform the clients how often they can poll. As more clients are added, the server will increase the time gap between polling.
- Add more servers. Assuming you will be charging money for this, as it becomes more popular you should be able to afford more servers.
- Host it on the cloud. Rather than use your own servers, let Amazon or some other company that manages servers for you do all the work. Pay for more cloud space/time as your clients increase.
Somebody in an online forum wrote: INTJs never really joke. They make a point. The joke is just a gift wrapper.
|
|
|
|
|
I would suggest examining this article, [^]
I used this style when creating a Battleship style online game.
|
|
|
|
|
Hi guys... long time reader first time poster. Please be gentle.
I avidly create games in VB.net. Being a hobby programmer I give my games away for free. Since I'm a hobbiest without formal training I do try and educate myself on proper programming principles and follow them when programming such as OOP. There are however some things I have obviously missed being self-taught that perhaps I would know if I were formally educated.
Once such issue that has really been my bane is how different classes (from now on referred to as objects) 'know' about each other WITHOUT programming specific interaction (stay with me here... please...)
Okay imagine this, you have a space game and the following objects
clsShip
clsMissile
clsAsteroid
clsSpaceJunk
Now each one of these objects has a Health, X,Y and Z private members and properties that are all inherited from clsSpaceEntity for argument sake. Now one way of programming collision between them would be to code out the following logic in the main game loop
for each ship in a list of ships
check each clsMissile in a list to see if it collides with it and if so, reduce health
check each clsAsteroidin a list to see if it collides with it and if so, reduce health
check each clsSpaceJunka list to see if it collides with it and if so, reduce health
... and so on and so on for every object
next
ect ect ect...
Now this might seam okay if your talking about the simple example above but some of my games have tens or even HUNDREDS of objects that interact in this basic way.
Now my question to the experienced programmers out there.
Is there a way in OOP to do the following...
for each thing that inherits from clsSpaceEntity
check against every other object that inherits this type (except itself) and if they collide then reduce health
next
?
This sort of ability for a type of objects/class or whatever to be 'aware' of another and how they are the same/different and interact would save me tonnes and tonnes and TONNES of coding.
Any assistance/help or feedback on this would be very appreciated. Thank you for your time, sorry for the long read.
|
|
|
|
|
Of course you could write a method in your baseclass for each object which takes the list of objects and performs a collision test on each one. Then you would just have to go through your objects and call the method. But if you think about it, this is just a refactored version of what you had before. You would gain nothing.
What you need is something out of the old algorithm and data structure box. The problem begins with using simple lists. If you have n objects in the list, you will have to do n^2 collision tests. When the number of objects gets larger, this very quickly becomes very slow. If you have only 10 objects, you must do 100 collision tests. For 100 objects it would already be 10000 collision tests and for 1000 objets it would be a million.
You need a way to reduce the number of tests. For example, you can have a sorted or an unsorted list. It's obvious that things are easier to find in a sorted list than in an unsorted one. By being sorted, a list can offer additional information which makes searching or testing the objects easier. But graphical objects usually are not lined up, so a sorted list will be of little help. They are distributed over a plane (2D) or in a volume (3D). Now, what could be the right data structures which can hold additional information on how the objects are aligned to each other?
The answer: Trees. For 2D graphics usually quadtrees are used. The objects must be sorted into the tree according to their positions. Then you can easily find objects which are close enough to each other and you must only test those for collisions. But, as always, there is one catch: When an object is moved, it must be taken out of the tree and inserted again according to its new position. Unfortunately you will have to deal with this as well.
So here you have it: Search for quadtrees (2D graphics) or octrees (3D graphics) and you will probably find a million pages discussing this stuff. And you will see that those trees are not only good for collision detection. Good luck!
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
|
|
|
|
|
Thank you so very much for taking the time to reply.
The largest problem I have at the moment is actually my physics routine increasing in ms/tick at a dramatic rate. This physics routine calculate the gravity between EACH space entity. As a dense rock or even a ejection pod has density (as well as the blackholes [warpholes] and planets etc).
I have optimised this routine many many times to keep reducing the time it takes but it's near 'perfect' for my level of knowledge. I would love to have more then 100,000 objects in my 'universe' however any more then that and I start to suffer noticeable lag.
I wonder if the quadtree method will assist with this problem. I'll look into it!
Thank you
|
|
|
|
|
Ahh, gravity. If only Newton had not invented it. Then everything would be much lighter
I see some room for optimization already.
1) It's a game. You don't have to be overly precise. For many problems even a physicist tends to cut some corners because after a certain point precision is lost due to rounding errors anyway. You could, for example, ignore every object if it is too far away and even precalculate this distance individually, depending on each object's mass.
2) You have large objects with a strong gravity field (planets, black holes and the like) which probably don't move around very much. You also have very small but mobile objects like ships. Why not sweep the smaller objects under the rug and calculate gravity only for the big chunks? The small objects should have little to no significance anyway.
3) If the big objects are static and don't move, you might as well precalculate a map of local gravity vectors with a resolution that fits your needs. Looking up a value in a map is far less an effort than calculating the value at every frame.
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
|
|
|
|
|
In answer to your specific question, the only way you can do what you are asking is to have some sort of collection containing all of the objects you want to check for collision - so the simplest would be an array of dsSpaceEntity that you iterate over.
For i = 0 to sizeOfArray
For j = i to sizeofArray
if Hascollided(Array(i), Array(j)) Then
doStuff(i,j)
End If
Next
Next
But as you say, with a large number in the array this will take time.
Using a more complex structure might help.
One of the simplest things you can do is eliminate the need to test for collisions as soon as possible. If each object has a left, right, top, bottom property then if the Top of one is lower than the bottom of another, no more testing is required. Do these tests first so you don't do anything more complex unless you have to (for example I have objects with complex shapes, so checking collisions is very time consuming - but I first check for a small number of large rectangles, only looking at the detail level after eliminating as may as possible by other tests.
You can also use a radius and center point for each object - and simply calculate the distance between the center points - eliminating further checking if this distance > sum of radii
Assuming that MOST collision tests are negative, it is worthwhile doing many tests, eliminating as many as possible as early as possible - e.g. test the top vs bottom, then left vs right, then distance apart - if the two objects fail all three tests there's a fair chance they've collided - so do any further tests (depending on your shape's complexity)
And hey, why not post some of your games for us to play comment on the code
|
|
|
|
|
Dear Friends
I am successfully able to generate a 3D surface by revolving the profiles by 360 degree. Now my 3d model is in red color so the color is so shining I am not able to distinguish various parts in the model. For this I am trying to use some lighting but I am not successful. Can u help me someone what kind of lighting should I use so that my model looks realistics and I would be able to visualize various parts on the model . Check my snippet I am trying to use this kind of lighting but finding black shadows on the sides not able to visualize properly. Thanks a lot for any help.
[code]
void CRevolutionProjView::OnViewShade()
{
// TODO: Add your command handler code here
// TODO: Add your command handler code here
CDC* pDC = GetDC();
wglMakeCurrent(pDC->m_hDC, m_hrc);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_FASTEST);
// Enable light and setup 2 light sources (GL_LIGHT0 and GL_LIGHT1)
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glColor3f(1.0f, 0.0f, 0.0f);
// We're setting up twolight sources. One of them is located
// on the left side ofthe model (x = -1.5f) and emits white light. The
// second light sourceis located on the right side of the model (x = 1.5f)
// emitting red light.
// GL_LIGHT0: the whitelight emitting light source
// Create lightcomponents for GL_LIGHT0
GLfloat emissionLight0[] = {0.2f, 0.0f, 0.0f, 1.0f};
GLfloat ambientLight0[] = { 0.2f, 0.2f, 0.2f, 1.0f };
GLfloat diffuseLight0[] = { 0.8f, 0.8f, 0.8, 1.0f };
GLfloat specularLight0[] = { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat position0[] = { -1.5f, 1.0f, -4.0f, 1.0f };
// Assign createdcomponents to GL_LIGHT0
glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight0);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight0);
glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight0);
glLightfv(GL_LIGHT0, GL_EMISSION, emissionLight0);
glLightfv(GL_LIGHT0, GL_POSITION, position0);
// GL_LIGHT1: the redlight emitting light source
// Create lightcomponents for GL_LIGHT1
float ambientLight1[] = { 0.2f, 0.2f, 0.2f, 1.0f };
float diffuseLight1[] = { 0.8f, 0.8f, 0.8f, 1.0f };
float specularLight1[] = { 0.5f, 0.5f, 0.5f, 1.0f };
float emissionLight1[] = { 0.2f, 0.0f, 0.0f, 1.0f };
float position1[]= { -1.5f, 1.0f, -4.0f, 1.0f };
// Assign createdcomponents to GL_LIGHT1
glLightfv(GL_LIGHT1, GL_AMBIENT, ambientLight1);
glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuseLight1);
glLightfv(GL_LIGHT1, GL_SPECULAR, specularLight1);
glLightfv(GL_LIGHT1, GL_EMISSION, emissionLight1);
glLightfv(GL_LIGHT1, GL_POSITION, position1);
//---------------------------------
// enable color tracking
glEnable(GL_COLOR_MATERIAL);
// set material properties which will be assigned by glColor
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
// ...Somewhere in the main rendering loop of your program...
// Draw a polygon with material properties set by glColor
float specReflection[] = { 0.8f, 0.8f, 0.8f, 1.0f };
glMaterialfv(GL_FRONT, GL_SPECULAR, specReflection);
glMateriali(GL_FRONT, GL_SHININESS, 96);
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
Invalidate();
wglMakeCurrent(NULL,NULL);
}
[/code]
|
|
|
|
|
I'm not so familiar with OpenGL, but perhaps you should take a look at your model again. Lighting will not work properly if the normal vectors of your vertices are not calculated properly and make sure that they have a length of exactly 1.
As a test, you could also load any model and render it with your lighting. This way you can find out wether the model or the lighting is wrong.
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
|
|
|
|
|
Send me all your codez. It's urgentz
Just joking
I do have a little problem, which is not at all unsolvable, but I just don't like to bend and tweak things just to make them fit. And, hopefully, I will not have to provide endless code listings. It's more a matter of making certain that some events happen in the right order.
For a while I have been writing a GUI for XNA and now I have started on the actual game client which is supposed to use it. As expected, there have been numerous smaller and larger bugs and missing features, so that I'm not getting ahead very quickly right now. But the GUI is really getting ahead and is more up to its job every day.
Last I added themes for the GUI. Among other things, the theme contains styles for controls. The styles come in two flavors: Control styles and named styles. Control styles are applied to all controls of a type. Named styles are additionally applied to all controls which explicitly request that style by name. The theme is loaded from XAML and the styles actually are simple data objects with all properties as nullable types. This allows you to incrementally apply a control style and then a named style by changing only those properties of the controls which are not null in the style. And here is where the problem begins.
This would be the best sequence:
1) An instance of a control is created. All its properties are set to defaults in the constructor.
2) Apply the control style according to the type of the control. Overwrite only those properties which are not null in the style.
3) Apply a named style, if any is set, again only overwriting the properties which are not null in the style
4) Controls and forms are also loaded from XAML. If there are any properties set in the markup, they should be set last to give them the highest priority and enable them to override defaults or styles.
This is how it really is:
1) An instance of a control is created. All its properties are set to defaults in the constructor.
2) Controls are instantiated when loading from XAML and the properties from the markup are set right after that. They now have the second lowest priority, not the highest as I would like.
3) Later, when the control is inserted into the GUI, further initialisation is done. At this point the control gets its reference to the loaded theme and now can find and apply its control style and its named style (if any).
As I see it, there is only one way to be faster than the XAML loader: The styles must be applied in the constructor already. The problem is that the theme will not be available to the control until it is inserted into the UI.
Now, I could simply pass the loaded theme as a parameter to the constructor, but that would also make dynamically instantiating controls more awkward. A class factory for the controls would help a little, but still this would be a departure from the way we are accustomed to. That's something I have tried to avoid. I also thought of making the theme a singleton, so that I can access it from the constructors with out having a reference, but this would not work and appears to me like a hack to make fit what does not fit.
So, how do I get a reference to the theme into the constructor without passing it as a parameter? Applying the styles in the constructor is the only way to make sure that things always happen in the right sequence, so there is no way around that. What is the cleanest and least 'hackish' way to accomplish this?
Edit: Constructor parameters are not an option for another reason as well: Any class to be used with XAML must be serializable. This includes having a standard constructor without parameters. Even if there were a second constructor, then XAML would not use it while loading the controls.
Edit^2: Almost a week now and no reply. The title must really have scared everybody
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
|
|
|
|
|
Access it through a singleton.
desired objects will register to the singleton in their ctor.
There might be other ways, if you simplify your question I might know.
For instance when I derive from usercontrol in wpf the answer is to make the control an agregate of a new control and in that way you can better control the auto generated xaml. In other words wrap it with another control is often the way. Is that a hack? Yes, but surely the best way.
I may not understand your question I'm just letting you know what comes to mind.
|
|
|
|
|
A reply! Great! Have some points alone for that.
rj45 wrote: Access it through a singleton.
That's what I also thought. But that's where it really gets complicated. The required object for initialisation would be the user interface object itself. It loads graphics assets, loads configurations, loads themes and styles, sets up the input devices, starts and controls the input thread, starts and controls the rendering thread and also starts and controls the UI thread.
This single object holds everything together and new controls would need a reference to it in its constructor to get acces to the current theme and also some other initialisations. Making this object a singleton would be problematic, but up to now it's also the only way I see.
rj45 wrote: For instance when I derive from usercontrol in wpf the answer is to make the
control an agregate of a new control and in that way you can better control the
auto generated xaml. In other words wrap it with another control is often the
way. Is that a hack? Yes, but surely the best way.
The controls I have up to now form a class hierarchy. Some also use child controls like buttons ore scrollbars internally, so I'm already 'wrapping' them. This also makes it possible to extend this hierarchy as needed.
rj45 wrote: I may not understand your question I'm just letting you know what comes to mind.
That's quite ok. The whole thing has reached some complexity and it's hard to describe the problem at hand without getting into this complexity. I probably already could write a book about it
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
|
|
|
|
|
how can i develope a 3D game????
what are the names of material& programmes i should download ???
what are the best educational web sites in this field i should visit to learn ???
thanks
|
|
|
|
|
If you just want to dip your toes into 3D game creation, then you might want to try out 3D RAD[^]. It's fairly straightforward to use and let's you create games to share with your friends for free.
If you want to program games, you could look at Microsoft XNA or you could look at something like Sandbox[^] or DarkBASIC[^].
|
|
|
|
|
in your opinion .... is the field of game developing :good or not::for money & future point of view ??
does it take a lot of time to be professional ??
what can i do to be excellent &Distinctive؟؟
thanks
|
|
|
|
|
gif2020 wrote: is the field of game developing :good or not::for money & future point of
view
From my POV, no. There's a massive churn of companies/developers in this field. The costs to produce games have become astronomical and require teams comparable to those making films. Pay is historically low in this field because there is such a demand to get into it that the companies do not have to pay that much.
Saying that, I have no idea where you are from, so what I consider low pay you may consider to be a fortune, so it's up to you to look into it based on your own expectations.
Games programming is a hugely complex task, so you need to have a good understanding of maths, preferably physics, etc.
|
|
|
|
|
ok , if u can give me advice .... for the field of programming & developing
& if I like to work at home as some of websites allow us to submit our work homely
what are the main market's demand for pragramming engineer ???????
thanks
|
|
|
|
|
Hi dear firend
to develop a 3D or 3D game first you need to get infortmation about "Open GL" and "Direct X" programming in your language like Visual C++ 2010.
with it you use the GPU power for your code.
take a look at www.opengl.com
good luck
|
|
|
|
|
As Pete had mentioned, XNA is really good to learn from. Microsoft has some good example games developed in XNA for you to look at. There are plenty of good resources on the 'net and here on Code Project for simple game development.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Great 3D physics engine that will handle drawing and everything. Great and wonderful software. Go here.
|
|
|
|
|
I've now released my first (within reason) game for the WP7. As Game Dev section looks a little empty thought I would show. Please forgive me if I burn your eyes, I'm no artist and I haven't even started my Uni course yet :p
Star Side
My next project is going to hopefully going to be a 3D Xbox 360 game
All comments (and criticism) widely accepted
|
|
|
|
|
This is not the place to advertise; this is a technical question and answer forum.
The best things in life are not things.
|
|
|
|
|