top of page
Writer's picturequadcuiwayfranwicf

Programming An Rts Game With Direct3D: From Basics to Real-Time Strategy



Movement with our Look-at camera is a little more complicated than our FPS camera, since we needto move the target position relative to the XZ components of the look and right vectors. Toget good-looking results, we need to make sure that we normalize the XZ vector, as otherwise wewill get varying movement speed depending on the alpha and beta angles of the camera. Ascurrently implemented, the camera target is bound to the XZ plane; if we wanted to make our camerafollow the terrain, as in most strategy games, or the character, as in a third-person camera, wewould need to manually update the Y coordinate of the target after moving.




Programming An Rts Game With Direct3D



To my understanding, DirectX is just a means of displaying graphics to the scene. I will still have to code any games in C++ using game logic code, input, etc. Was I naive in thinking I could read the book with the MSDN tutorial site open for DirectX 10, and convert all of the samples to DirectX 10, or is that gonna be extremely difficult for me to do?Also, is DirectX 9 still relevant, or would it really behoove me to go about converting to DX 10?


To asnwer your specific questions, DirectX is an API to facilitate running high performance graphics and sound on the computer. You will still write your game logic in C/C++, as I recall DirectX has some classes for dealing with user input as well. With respect to API changes between 9, 10, and 11 I do not really know, but I cannot imagine that a good programmer would have difficulty figuring it out, given a well written book and MSDN. I should also mention here, that I don't do much native DirectX programming, so take my words about API changes with a grain of salt.


We have this time DirectX 9 and OpenGL 1.41. Which is the faster, if we use them as better as we can? (Ok! Ok! It depends from what we are programming but I ask in general)2. once, many games are written in OpenGL. More than games written in DirectX. Today why more games are written for DirectX?3. Is anything that DirectX can do and OGL not?4. Which of both supports better the newest capabilities from newest video cards?P.S. I am not a troll!


I think this a matter of taste, both support the newest features of the video cards. Which you choose is down to your programming style and probably what best fits with your idealized vision of a 3D API. For me neither is perfect, my program uses as idealized 3D API that is perfect for it and then further within the program goes about making DirectX and OpenGL fit this model.


W> Does OpenGL require COM or Hungarian notation? I'm just asking W> because W> Direct3D doesn't require it either. You used to have to use COM with W> DirectX but no longer.it's no more using COM interfaces for everything? that's something new..you mean that it can work as pure C structs with methods passign this asparameter?but it's really ugly, as for me, and it requires much more work to bind itwith some programming language. and possibly on some languages it'simpossible at all.with OpenGL pure C can be used, it's as standart as API can be.there is Jogl, there are OpenGL bindings to Ocaml, Ada.. are therefunctioning d3d bindings with this languages? W> You can if you want to though. Hungarian notation? W> Never been necessary AFAIK...OGL only requires GL_ or gl prefix for each enumaration member/function,other part of it is mostly plain english word, so it's clear enough foranybody, including newbies, to easily understand code.in Direct3D they use prefixes for all enumerations, types and so on, soprograms look long and frightening. kompare: device->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); device->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);OpenGL version is 2.5 times shorter.With best regards, Alex Mizrahi aka killer_storm.


> but it's really ugly, as for me, and it requires much more work to bind it> with some programming language. and possibly on some languages it's> impossible at all.> with OpenGL pure C can be used, it's as standart as API can be.


>> but it's really ugly, as for me, and it requires much more work to>> bind it with some programming language. and possibly on some>> languages it's impossible at all.>> with OpenGL pure C can be used, it's as standart as API can be.> > ? What do 'pure C' and 'standard' have to do with each other? As a> C/C++ guy, I find the idea of smart pointers much more alluring than> 'pure C'.


>> there is Jogl, there are OpenGL bindings to Ocaml, Ada.. are there>> functioning d3d bindings with this languages?> > I don't know, but why would there be? Direct3D is for games (although> you can use it for whatever you want),


>> but it's really ugly, as for me, and it requires much more work to >> bind it with some programming language. and possibly on some >> languages it's impossible at all. >> with OpenGL pure C can be used, it's as standart as API can be.


W> I don't know, but why would there be? Direct3D is for games W> (although you can use it for whatever you want), why would anyone W> write a game in Ocaml, or (ack) Ada?many games use scripting languages, having C/C++ only for parts of enginewhere high performance is needed.and there is more applications that can use 3d graphics other than games.some applications are easier to write on language other than C++, and partthat uses 3d can be not the main part. W> In any case, the OGL bindings for many of those languages are W> incomplete and/or out of date (not all of them.)but it's easy to do bingings yourself. i bet i can write perl script in10-20 minutes that will produce OGL header from gl.h for any language thatsupports foriegn function interface(if i know syntax of that language). i'mnot sure that write binging with d3d is easy enough.OpenGL has very few requirements to run - language doesn't even have to havepointers to run it(at least with limited performance).so OGL will be unreachable when task is other than another one game writtenon C++ for Windows by Mircosoft beurocratic API fans. W> Shorter, but it is actually clearer in D3D what D3DRS_SRCBLEND meansthan W> GL_SRC_ALPHA. D3D Render State option, versus GL option... D3D Blend W> option versus GL option. All the GL options are clumped together. Itis W> clearer to newbies about which options are usable where (in thepipeline) by W> giving them a clearer name. (Neither of them is friendly in any case,lol.)i think i have seen direct3d code(and code inspired by direct3d) enough tomake a conclusion that OpenGL API is more programmer-friendly and strainsbrain by redundant information less.


Of course I have. Do you actually know anything about deploying softwareupon a broad variety of video cards? What is just about the only thingprofessional game developers dislike about OpenGL? I'll give you a hint, itstarts with ext and ends with ensions. WTH


> THIS is why I'm complaining.> I don't want this to continue. People who think everything is copacetic> will be the death of OpenGL in the gaming world. Soon its only saving grace> will be "cross platform." What if MS challenged that (I doubt they would> though, there's no market growth for *nix based visualization.)> > > > ...and nobody with an objective viewpoint would view 'extensions' as a> > > satisfactory method for supporter all the new features available from> modern> > > 3D hardware.> > >> >> > Rubbish. It works perfectly.> > You think so because you don't understand the benefit/cost tradeoff in using> extensions. Good luck writing a commercially successful game in OpenGL that> supports a wide range of video cards and uses late version extensions.


> >> but it's really ugly, as for me, and it requires much more work to> >> bind it with some programming language. and possibly on some> >> languages it's impossible at all.> >> with OpenGL pure C can be used, it's as standart as API can be.


LOL. "very bad looking". Try to be objective. In any case, none of thetripe you posted above has anything to do with your original statement about"pure C" and there being a "standard." I would spend the 5 minutesdeconstructing your argument except it has nothing to do with this thread.You appear to be trying to turn this into a C versus C++ thread. If youlimit yourself to working in C, that's fine, but don't try to make OpenGLlook better than D3D because you think it is more 'C friendly.' VERY fewgame developers work in just C (none that I am aware of, but I don't knowmany of them.)


> OpenGL has very few requirements to run - language doesn't even have tohave> pointers to run it(at least with limited performance).> so OGL will be unreachable when task is other than another one gamewritten> on C++ for Windows by Mircosoft beurocratic API fans.


3DSMAX is also used novadays by movie industry, and there DirectX 8 is therecommended editor renderer. It says nothing about what renderer is used forthe movie frames. Neither it does say what happens after rendering, whencomposing the final frames from layers which are produced on wide range ofgraphics packages.Neither is much said what is used to produce data for Flame, Combustion,etc. which have sgi versions and have very heavy pricetags for heavy-ironused for rendering.DirectX 8 / 9 and OpenGL both are good for previews as they are, and themovies themselves aren't rendered with either API, they're just realtimetools. OpenGL is multi-platform, DirectX isn't (with the exception of fewgame consoles).All the same, we should think how productive it is to 'fight' which isbetter API..


The beginner series is meant to teach fundamental C++ programming concepts. It also covers some basic graphics programming theory. Also: making shitty little games. It is suitable even for those with zero programming experience. If this ain't your first rodeo, you can use this page to jump through the lessons, skipping any B.S. you already know. 2ff7e9595c


1 view0 comments

Recent Posts

See All

Baixar teste de velocidade

Speed Test Indir: Como verificar a velocidade da sua Internet na Turquia Quer saber a velocidade da sua conexão com a internet? Você quer...

Comments


bottom of page