Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Mar 2005
Offline Last Active Today, 02:20 AM

#5264190 With which book should I start?

Posted by frob on 29 November 2015 - 11:46 PM

I have the following books in my possesion ...  In which order should I read them in order to get the best out of them and understand them.


Trying to stick to the question that was asked...


I'd say it depends on how rapidly you intend to read them and how comfortable you are switching between subjects.


The math primer will probably help you with the D3D11 book. If you are looking for something quick, I'd skim through the math book to see what you need to learn and what topics it covers, then go back and forth concurrently with the two.  It is easier to learn math if you have actual applications for it, and is easier to learn to manipulate 3D worlds if you know the math. They complement each other.  Apply what you learn from one in the other, then go back and review what you learned when reading in the first. It may be helpful to remember the math book has made functions generic.  In math books you typically see compressed generic notation like f(M, k), in the programming book you might get Point& ComputeSplineLocation( const Point& v0, const Point& v1, const Point& v2, const Point& v3, float knotPosition);   Realizing the math book is trying to teach you the same thing the code describes sometimes takes some mental effort.


I'd read the patterns book before the architecture book, since the architecture book will probably mention the patterns.  These two also work well together because architecture relies on patterns to describe the behavior.  Patterns are just names for solutions people use frequently. The architecture book describes examples where people used those patterns.  Unlike the first pair, I would NOT read these concurrently.  I'd read all the pattern book first, study the patterns, and learn their names.  Then I would refer back to it as needed when reading the architecture book afterward.



Finally, I like to have multiple books going at the same time, usually 2-3. I'd read the first pair back and forth as though they were a single subject, and when I didn't feel like reading them I'd work through whichever one of the second pair I was studying.   Looks like about 3000 pages total?  If I were reading them lightly and quickly scanning it shouldn't take more than two weeks.  If I were studying deeply and trying to apply the knowledge as you gain it, exercising it in the brain, probably a month or two depending on whatever else was going on at the time. I don't know your schedule or reading speed so it may be faster or slower for you.


The D3D11 book is probably the most time sensitive, so I'd read that first and recognize the most important thing is the general theory, not the specific verbs and nouns for the API. Every new API will have different words for theory, but the math and theory behind it will remain the same.  The others could remain on your bookshelf for five years and still be mostly useful.

#5264034 How Can Games Natively Port-Forward?

Posted by frob on 28 November 2015 - 04:27 PM

The Networking Forum FAQ has a link to information about it.


UPNP is one solution that sometimes works.  If it works for you, great.


NAT Punch through is another solution, details available in the FAQ. Basically you have a server on a public IP address that acts as an introducer.  Machine A talks to the server and the server notes the port information.  Machine B talks to the server and notes the port information.  The introducer tells A about B's port information, and tells B about A's port information.  A and B attempt to connect to those ports.  Magic usually happens and they communicate.


Sometimes neither solution works.  There are many reasons why both can fail, such as restrictive routers or hairpin connections. Then you need to look at other options like using a site you control on a public IP address as a repeater.

#5264031 Old MMOs on new Windows (10)

Posted by frob on 28 November 2015 - 04:19 PM

There is a slim chance it will work unmodified.  It is possible it could start up and run correctly.


But after that, you wouldn't know until you tried.  


It may fail to start up at all. 


It may start up and then crash.


It may appear to work correctly but then crash on less-common paths through the code base, or be impossible to win because of a subtle breaking change.


It may start but then have serious performance problems. Even though systems are generally faster today, they often are faster at different tasks. Graphics cards and graphics technology has changed considerably; some things that were fast on that era cards are slow on today's cards. 


It may fail on some specific game logic or obscure rules.  That would be more difficult to test because it would appear to work when you review it, but some key functionality may give wrong results or otherwise behave badly.


Due to its age it may have device-dependent or driver-dependent errors. 


With most of these the easiest way to know is to try to run it, then carefully watch the results.  




If there are any problems, fixing them will require the source code and build tools that are working for that old project.  Those will be difficult to find.  Then you've got to fix them, and that can be time consuming.  Effectively the developer must port the game. It is a relatively small port, but it is still work.

#5264021 Questions regarding how did you manage school

Posted by frob on 28 November 2015 - 03:22 PM

Not in India, but my story.


I started learning by books and computer magazines, because the Internet as you know it today didn't exist. LOTS of trial and error.  LOTS of learning through experimentation. The Internet you know today was built up while I was in college.  There were some online resources like Ralph Brown's Interrupt List and a bunch of coding guides; there were search engines like Archie and Veronica, but there were not tutorials for every subject available.  You were expected to read something and figure out how to apply it yourself without a tutorial.



During classes I was exposed to and given assignments toward many features.  The core of computer science is algorithms and data structures.  While I had picked up some of these in trial and error and experimentation, course work exposed me to many more that I would never have discovered. While it may seem boring to study dozens of different sorting routines, knowing about them and their differences is important because eventually you will run into problems that can be better solved with a less common algorithm than the mainstream default choice.


I was also instructed on topics I did not want to learn but were important anyway.  General education is useful in games. Humanities courses may seem stupid if you are a short-sighted youth, but topics like world religions and societies are important if you consider who the game audience is.  Physics is core to many games.  A business writing class that I hated has proven valuable through my entire career. Chemistry can give new insights on how the world works which you can use in games.  In games there is no useless knowledge; sooner or later everything is useful or can be used.


That is one of the things a college program will do for you.  Those who get a degree have a broad (yet shallow) knowledge, and at least a passing knowledge of many techniques. You may not use SQL in your game code and have no interest in databases, but from your mandatory databases class when you talk to the back-end folks and they start talking about queries you can have at least a vague idea what they are talking about.  You may not be writing networking code and communications systems but because of your mandatory class on the subject you can understand what they are talking about.  Repeat for all the other topics you may not like.


Another key element the program will do for you is help you with the ability to learn new things, to unlearn problematic items, and to re-learn fields as they change.


Both of those can be picked up out in the Real World, but it generally seems easier to pick up while you are in school.



As for getting a job, remember that university training is not career training. You can use it to gain skills that will help you, but the two are not interchangeable.  


Also remember that education levels are regional.  In some regions higher education is not required, just give them some code samples that show you know what you are doing.  In other areas you need a college degree to break in, and even once you are in with multiple game credits employers will be suspicious if you don't have the degree.

#5263992 Online multiplayer,c++ in unreal engine,math required

Posted by frob on 28 November 2015 - 01:07 PM

If you are looking to just write games as a hobby and not become a professional game programmer, you can probably get by with a lot of searching the Internet.


If you are looking to be a professional game programmer, you absolutely need the math.  You will rely on the game engine to perform the math, but when coworkers talk about orientation, about the forward and up vectors, about normals and magnitudes, you better know how to get them. If coworkers talk about using the cross product or dot product for doing something, you should know what that means.  (All of those are linear algebra.) For physics it helps to know real-world physics, but game physics is often made up of whatever feels good rather than being physically accurate, although many realistic games use real-world physics simulations. For geometry and trig, if co-workers use words like coplanar or colinear you need to understand those, as well as the trig functions. You need to understand turning by degrees and by radians. You need to understand when someone wants a sinusoidal cycle.  For stats, that means knowing the basic probability curves.  It means knowing how to make something happen X% of the time. 


You don't need to have all the facts right at your fingertips all the time, like immediately remembering how to compute an eigenvalue. But you do need to be comfortable with the topics and have a reasonable understanding of manipulating 3D space.  It is difficult to build a 3D game without being comfortable with 3D math.

#5263956 Buying a game for private server

Posted by frob on 28 November 2015 - 10:23 AM

The game's link has a client built for Windows 2000, and mentions linux servers.


From what I have read, this is not just a matter of dumping the executables on a machine.


So much has changed.  Middleware has changed. Hardware has changed. Operating system requirements have changed. Even the C++ language has changed four times.


Instead of just pulling it out and running it, my guess will be it means pulling it out and seeing it won't run correctly or run at all.  Then trying to figure out and reconstruct the build chain. Then finding the oldest versions of the libraries that can be built, and trying to build it, fixing whatever is broken.  Then building the executables again, fixing whatever is broken.  Then running the game and hoping it mostly works okay.  This will need to be done both for the server and for the client.





You might get lucky and have everything work out of the box.  In that case, yes, they would likely give you a license to run the program for $50K.  Then the responsibility is on you to get the machines running and keep them going, whatever the cost is to you.


But much more likely you will need to have several months of major development to get the game working on modern equipment. In that case you are looking a a million or so to pay the studio to get the game up to a working state and keep the servers running.

#5263905 C++11 template question

Posted by frob on 27 November 2015 - 10:37 PM

It is information the compiler has on hand because the type is a reference to an array.  As the book points out, this is one of those interesting little quirks of the language.
Remember that template code is not actual c++, it is a template.  The compiler effectively turns the template into a custom invisible cpp file with all the elements filled in, then that invisible cpp file gets compiled in.
Under the old C rules, passing an array is equivalent to passing a pointer to the first element. So as the book points out, the compiler's invisible custom cpp file would have a pointer to the item.  If the type were an array (like: int [10]) it would still be converted to a pointer to the first element (like: int*).  That is why the template needs to use a reference (T&) rather than a plain type (T) or type pointer (T*). 
Since it is a reference to the array, and because the C++ rules on references are slightly different than the old C rules for passing arrays, the compiler has the data to figure out the exact type of the array.  This is information the compiler knows at the time of compilation. 
So when the compiler generates the custom invisible cpp file from the template, the magic happens as the full type information is used to substitute T and N in the template.
The compiler takes the definition of the type that it knows:  int foo[10];
and applies it when it sees: arraySize(foo);
then it generates the invisible file with this function, filling in the blanks T and N in the template with the information it already knows:
constexpr std::size_t arraySize( int (&)[10]) noexcept { return 10; }
Again, this only works if you've got a reference (the & in the middle) because references have the full information. If it was not a reference, the type would be deduced as a pointer to int, (int *) so for this code the compiler could not properly substitute out the array parameter, so the substitution would fail and the compiler would not consider it as a valid template instantiation.

#5263854 Buying a game for private server

Posted by frob on 27 November 2015 - 11:55 AM

So Im trying to understand as much as I can from their perspective, before going back. ... I understood it like there was no problem putting the game back online

Imagine yourself as the business owner.
I'm running a big software company.  I have several business deals going on, each valued in tens, twenties, fifty million dollars or more.
Someone comes along asking for an old product to be revived.  A project we dumped because it did not look profitable.
The product is old, dating back to 2002-2003 era.  
The person wants me to bid on a project to:
* Go through the archives and find the software. It was 13 years ago. Does this software even still exist in our backups and archives?
* Figure out the settings and software dependencies for this 13 year old software.  It probably will not run without engineering work.
* The software probably ran on Windows 2000 servers, which is long dead. We cannot find the same hardware or operating system.
* The compiler and build tools were probably VS2002 or maybe VS6, both long dead. The build tools are out of date and may not work on modern systems.
* It probably relied on several other systems that have vanished over the past decade, or that have changed so much they are likely incompatible. We cannot find the 3rd party dependencies for the product.
* Get the system up and running.  This will likely take many weeks to make all the changes for that 13-year-old software.   Which developer do I assign, removing them from existing projects?  
* If anyone remains from the development team 13 years ago they are going to be senior level employees today. Do I need to remove my technical leads or managers from our current multi-million dollar projects for this? 
* These people already have other roles. Will this make my existing projects late, or put me at risks of missing dates?
This is not like going to a library and checking out a dusty old tome from the back room.  
If all you wanted was a license to use the software, and their only involvement was to give you a copy of the source, then it may be different.


Selling you a dump of the source files, the assets, and a license to use them, I can see that costing $50K.  


Getting the entire system up and running for you, maintaining the servers, taking workers off current projects and re-assigning them to a dead end, there is no way they are charging $50K.

#5263839 Algorithm for automatic ships production

Posted by frob on 27 November 2015 - 10:09 AM

 I'd go a direct approach.


For larger systems I might go with a statistical approach, but this is small.
You already a number of each item to build, and priorities associated with them.  
Now you need a queue of one item, or a "next item to build" slot.  This lets the player know what the AI is planning to do, making them happier.  You might want a longer queue, in that case just continue with this routine removing the items from the list as they get added to the queue.  Adding some complexity, you could let them cancel items or move items in the queue, pushing queued items forward in line and then filling the back again.  
Run this:

If nothing on queue (or empty spots in a multi-item queue):
  For each priority in priority order:
    If items needed at this priority:
      Build collection of all needed items in that priority
      Shuffle collection (or just pick a random item number within the collection)
      Queue first item in shuffled collection (and subsequent items if multiple slots)

If you've got a longer queue with room at the end, use that to fill up slots at the end until all slots are filled.

That method won't work too well if you are queuing up many thousand items, but from your description you're in single digits and double digits. A simple shuffle will mean slots with more items get built more often by virtue of it appearing more often. No fancy weighting required.



You'll need to decide what to do when the player adjusts the sliders.  You might do nothing (the easiest option) allowing the current queue items to build.  You might validate that the first item in the queue is still the highest priority and then insert items at their desired spot. You might remove items if they dropped the needed count to zero. 

#5263747 Buying a game for private server

Posted by frob on 26 November 2015 - 07:26 PM

That size development team costs about $3M per year. Note that isn't just salaries, it is all the other business costs too.


Usually development is around 1/3 of total costs. Marketing is typically as much money or more money than the software development.


So they could turn out an online game with about 3000 players (which is definitely not an MMO, just a regular old online game) 


The product has been archived for a decade.  It needs to be updated to work on modern systems.  And there was a reason they cancelled it, that reason likely still applies.



So what will that cost you?


If you are looking to just buy it directly, talk to them.  They might let the property go cheap.   My estimate of cheap and your estimate of cheap are probably different.



Once you've purchased it, based on your description, I'd expect at least 2 months of serious effort to get it out of storage and functioning on a modern environment.  Given the team size, that's about a half million dollars.


Then you probably want to advertise the game. That's another half million dollars at least if you want it to be well known.  Without the marketing budget, your game -- great as it may be -- will die in obscurity.  Safer to plan a full million, but it doesn't sound like you realistically would.


Then you'll need to pay for your servers and bandwidth, either through a system like Amazon or your own colocation system. For a minimalist setup you're probably looking around $500/month, more realistically $1000/month for what you described since there is a lot of bandwidth needed.  That's relatively small compared to the cost of the people maintaining it, probably about $50,000 per month. 


It will take a few months at least with heavy marketing to attempt to reach a sustainable level.


So I'd peg the whole thing around $2M for your costs.

#5263664 Buying a game for private server

Posted by frob on 25 November 2015 - 10:14 PM

mass produced MMOs in 2000-2005


Mass produced online games maybe, but not MMO.  The "MM" of MMO means "massively multiplayer" and very high capacity, on the order of 100,000 concurrent users or more.


Building a game that supports tens or even hundreds of concurrent users is not too difficult, lots of people have done that. With today's tools that is something you can pull off developing in your basement on no money.


Building a game that supports thousands of concurrent users is a much larger effort, when you approach tens of thousands of users you are talking about maintaining larger data centers and paying a thousands of dollars every month for those machines.


Building a Massively Multiplayer system, MMO, is fantastically more work. Even a small MMO has a budget measured in the hundred million dollars, with data centers costing tens of thousands of dollars every month.

Im sure it could cost $500-$1M to develope. (wild guess)


Are you sure about that?
Most of the "shovelware" style games today cost in the $5M - $10M range to develop in the US and other western nations.
Most of the mainstream games today cost in the $20M-75M range.  Games that are big budget are easily $100M.  
And true MMO launches are easily $100M for main development plus about twice that much again for marketing and deployment and initial launch.




It may be that a company is willing to sell you a ten-year-old engine on the cheap.  They may hook you up with an existing game for $50K.  But if they do, don't expect much from that engine.

#5263606 Depth buffer really confuse

Posted by frob on 25 November 2015 - 12:48 PM

Isnt this on eye space? I must have confuse on how depth buffer works on depth precision. All in all my real confusion was on the depth precision it self. Which happens first? is the the test or the equation for depth precision?


Normally it is a value between 0 and 1, mostly this stems from the nature of floating point.  


At the point in the pipeline it is happening the pixel fragment is generally relative to the view frustum, a value from 0 to 1. 


The task for comparing against the z-buffer is simple enough. The pixel fragment's depth value is compared against the z-buffer using the selected operation (any one of <, <=, ==, !=, >=, >, true, false).  If the result is false the pixel fragment is discarded and processing stops. if the result is true the z-value is written to the z-buffer, and processing continues.


As for what happens first, that gets a little tricky.




From a high level perspective, the test against the z-buffer happens toward the end of the graphics pipeline:  Everything is sent to the card to be rendered.  The vertex shader is run, which can do tasks like skinning and transformation, basically moving stuff around. The hull shader is run that can break down line segments into smoother curve segments. The tesselator runs to connect all the tiny line pieces. The domain shader is run, and it can calculate the final position of each vertex point. The geometry shader runs next and can further modify what vertices are actually drawn. The pixel shader runs and can modify color and depth information.  Conceptually the z-test runs here, as described above. Assuming the z-buffer test passes, the pixel fragment is passed along to be merged with other values. Finally, output of all the rendered pixels are merged together and generate a full final image.



In practice, there are several tricks and optimizations that hardware can do to make the test happen much earlier. The hardware can peek ahead at the shaders being used. 


If the hardware can see that the pixel shader does not modify the z-value, it can run the test before the vertex shader eliminating what is normally the most expensive shader.


If the hardware can also see that the geometry shader does not modify z-value, it can run the test that much earlier and avoid the work if the test fails.  If the hardware can also see the domain shader doesn't affect the z value, it can be bumped again.  Repeat for each shader.


That part happens automatically.



There are methods (I am not fully read up on them) to run an early depth-only processing pass. Basically it runs to transform all the geometry but does not do any of the more expensive lighting or coloring operations.   That information is used to perform earlier or more reliable depth tests in the second pass.

#5263512 execute constructor of derived class

Posted by frob on 25 November 2015 - 12:17 AM

TObjectPropertyEditor something;

In that case, get and study a GOOD book about the language.

Based on your comments over the past few months, I recommend current editions of either of these:

# "C++ Primer" by Lippman, Lajoie, and Moo. (NOT "C++ Primer Plus")
# "Accelerated C++" by Andrew Koenig and Barabara Moo

Don't bother with both since they mostly overlap. The first one has a gentler learning curve than the second.

#5263436 execute constructor of derived class

Posted by frob on 24 November 2015 - 12:06 PM

TObjectPropertyEditor() //TForm constructor will be executed right?





~TObjectPropertyEditor() {} //TForm desctructor will be executed right?


Yes with a caveat.


If the function is not marked as virtual, it is possible for the TForm destructor to be called but the TObjectPropertyEditor not get called.


So that works only if the TForm destructor is virtual, which it should be.  Virtual gets inherited, so if TForm derived from something and it was marked virtual, that would also make it happen.


If it is not virtual, than this won't work:

base* b;
b=new derived;
delete b;

In that case if the destructor is not virtual than the derived destructor won't be called, only the base constructor is called.

If the base class destructor is virtual then both the base destructor and derived destructor will be called.



Or more specific to your example:

TForm* form;
delete form;

In that case if the destructor is not virtual only the TForm destructor would be called, which is a bug.


If the destructor is virtual then when the object is deleted the TObjectPropertyEditor destructor gets called, then TForm destructor gets called, which is what you want.


So make sure the base class destructor is virtual, otherwise there can be serious problems.

#5263418 execute constructor of derived class

Posted by frob on 24 November 2015 - 11:00 AM

Your code and your words don't quite match up.



TObjectPropertyEditor is derived from TForm.  That means TForm is the parent class, and TObjectPropertyEditor is the derived class.


When the objects are created, the TForm constructor is executed and run completely before TObjectPropertyEditor constructor is run.  Base class constructors are called first, in the order they are listed in the class definition, then the constructors of sub objects are called in order, then the current class constructor is called.



Your constructor initializer lists should be in the same order the members appear.  If you have five or ten members getting initialized, put the base constructor first and the member variables in order, the same order they appear top to bottom in the class file.


If you need to pass parameters or initialize variables, you can do it using a constructor initializer list, something like this:

struct TObjectPropertyEditor : public TForm
TEntity * apply_to;
TObjectPropertyEditor() : TForm(), apply_to(NULL)

//Adding this one as an example
//If you want to pass a parameter to a base class, you can do it like this
TObjectPropertyEditor(TController *controller) : TForm(controller), apply_to(NULL)

// Double check that your base class destructor is virtual and public.
~TObjectPropertyEditor() {}

When you create a TObjectPropertyEditor it will first call TForm's constructor, and after the TForm is created the above code will initialize apply_to with the value NULL, then it will run the TObjectPropertyEditor constructor body.


In the second constructor I wrote as an example, it will pass the parameter on to the TForm constructor and run the constructor, then initialize the variable to NULL, then run the constructor body.






Base class destructors -- which should usually be virtual and public, are automatically called.   A class that is free standing can have a regular function for a destructor, but base classes have some special rules. Nearly always, and always when you intend to use polymorphic behavior for the class, a base class destructor needs to be public and virtual.  


These destructors are an exception to the normal rule because they automatically call their base class variant, you don't need to call them.


Without that special rule you would need to write:

~TObjectPropertyEditor() {}
 // My own destruction

 TForm::~TForm();   // DON'T DO THIS, Don't chain virtual destructors, the compiler does it for you.

In any other case if you need to call the behavior of a virtual class you would need to chain it manually.  Destructors are a special case, just make sure the base class destructor is virtual and they will all get destroyed in the correct order, ~TObjectPropertyEditor gets called first, then ~TForm is called next.