Jump to content

  • Log In with Google      Sign In   
  • Create Account

frob

Member Since 12 Mar 2005
Offline Last Active Today, 01:57 AM

#5134296 Immediate values come from the ALU?

Posted by frob on 24 February 2014 - 07:37 PM

This is an implementation detail that doesn't matter.

As far as the assembly programmer is concerned the data resides in a register or a memory address. When something is processed inside the CPU the black box does its magic, and the result is again stored in a register or memory address.

If you are an expert writing the optimizer inside a major compiler, and if you have studied the exact micro-architecture details, including a detailed study of the processor's internal timings, then it is possible that those details might help you with some extreme pigeonhole reordering optimizations in order to save one or two total CPU cycles, so perhaps it might save a few nanoseconds.

It has nothing to do with either C or C++ languages, and really almost has nothing to do with assembly programming.


#5134177 casting an expression: what exactly casts the compiler?

Posted by frob on 24 February 2014 - 01:26 PM

The language standards specify a bunch of conversions that can happen automatically, called "implicit conversions", and provide the rules for when they happen and why a specific one is triggered. In C++ you can also write conversion operators in your class that might trigger those rules as well.

As for what happens on the actual processor, that is mostly up to the compiler. Some conversions have no effect on the data stored on a register, such as re-interpreting an 'int' to a 'long' on a 32-bit system, or casting a pointer from one type to another on a system with uniform flat memory. Some conversions have hidden function calls or move data from one place to another, or one format to another.


#5134161 ARC in Game Programming

Posted by frob on 24 February 2014 - 12:27 PM

Looks like you are talking about Objective C's Automatic Reference Counting (ARC) garbage collection.


Garbage collection is a mixed blessing and curse.

When you are a beginner it really simplifies things; you can create an object and never worry about the rest of its lifetime. When you are writing small tools and short-running programs you don't have to think about memory management, it takes care of itself.

However, when your programs become more advanced, or when they are long-running, or when they are resource intensive like most modern games, resource management is very important. How important? When working on resource constrained systems like game consoles, mobile devices, embedded systems, and so on, or when you are working with very large data sets like your 9GB file on a desktop machine, I would say resource management is the most important factor in development; even if you introduce other bugs, don't mismanage the resources. You need to think about resource management continuously, and even a smallest error is likely to crash your system. Automatic garbage collection systems often hide or obscure that responsibility from programmers, making it so much easier to accidentally misuse it, hence the curse aspect. Using it properly is one of the biggest responsibilities of the programmer.

In most programs when you watch your resource usage "go up and up and up" like that, it means you have a bug in your resource management. Usually it means a resource leak. Usually it means your app will eventually slow down as it swaps to disk or crash suddenly when memory is exhausted. It is your responsibility to ensure resources are released in a timely manner so they can be reclaimed by the system.

Your next question, about my stance on garbage collections and choices regard it: It is something to be carefully monitored, like all other aspects of resource management. Several languages don't let you disable it, and many times it is a highly useful feature. It can be embraced, as long as you accept both the benefits and the responsibilities.

So in summary, yes, it does appear it is time for you to learn about proper resource management, including memory management, and end your blissful ignorance and reliance on automatic garbage collection. Programmers need to be responsible for the full object lifetime, even if that means a choice to clean resources up or let the GC do it, the programmers are ultimately responsible for the decision.


#5134009 Where to start as a Professional Programmer who want to code games?

Posted by frob on 23 February 2014 - 10:46 PM

Seconding others (beyond the up-votes) -- based on your described experience you could probably go get a job as a video game programmer right now.

The days of one programmer knowing everything about everything in a modern game are long gone. They went away almost twenty years ago. Games today can be massive engineering exercises with hundreds of developers. They can also be smaller teams, which means 20-35 developers. On smaller teams people will touch multiple systems; most people above the junior levels are expected to have ownership of one specific domain rather than a shotgun splattering across all areas.

Right now you are working on back-end database work, you probably seldom (if ever) work on the front end work of making the user-facing components beautiful. That work is usually given to a team who focuses on it specifically. So it is with games; server backend teams, network communications teams, AI teams, tools teams, graphics teams, GPE (gameplay engineering) teams, and more.

If you are looking for a game development job, just start applying. It is unlikely (but not impossible) they will pay for moving costs as you don't have industry experience, but if you live in or near a city that has game developers (see gamedevmap.com and similar sites) you could apply for and likely get interviews for jobs focusing on networking.

/edit: The gems books are good. There are lots of books, basically if you want to learn you need to start somewhere. They assume a pretty solid math background, and if necessary you might want to brush up on college-level math like linear algebra. 3D graphics is little more than applied linear algebra, the math of manipulating things in spaces.


#5134003 How did you learn C++?

Posted by frob on 23 February 2014 - 09:28 PM

Yes and no. It is not about learning c++. It *IS* c++.

It is not a text designed to help you learn. As I mentioned, I spent years reading about C++, learning about keywords and how they were used, and assorted practices, patterns, and properties about the language. That isn't what that document is about.

That document is the language standard. (The final draft anyway. Remove 'draft', swap the cover page, and remove some annotations for the final version.) When people talk about C++11, they are not talking about books like C++ Primer. They are talking about the language described in that document.

A strange thing is that so many people, even professionals, have spent years and even decades reading ABOUT the language, but have never read the actual language.


Imagine reading books about law, studying the effect of court cases, writing contracts, and otherwise doing everything in the legal field... but never actually read the constitution or other actual laws.


Yeah, I thought I knew C++ before reading the standard.


#5133987 How did you learn C++?

Posted by frob on 23 February 2014 - 07:55 PM

I learned how to program by reading books and manuals. Some time after I thought I understood the language I discovered there was such a thing as the C++ language standards committee.

I read the real language standard, and realized that before that, while I knew how to write some c++ code, I had no idea what was actually the c++ language. It was eye-opening.


#5133985 What counts as "Code Plagiarism"?

Posted by frob on 23 February 2014 - 07:43 PM

Moving to business forum.

Plagiarism is a concept in school, so ask your teacher about the policies. In the rest of the real world, it is copyright that concerns us.

Not a lawyer but someone who asked basically the same question to a lawyer...

Copyright is about people and organizations attempting to protect valuable content they have created.

When you get helpful content from a book, website, or other source designed to educate people, double-check the license for the site and content. If the code sample specifically states a copyright notice, such as GPL or BSD or other similar license, follow it. Otherwise use your brains.

When you buy a book or visit a help website, consider: Are they attempting to protect that valuable content? Or are they publicly speaking the content with a clear intent that it be shared and used elsewhere?

There are four factors that go into copyright claims: Purpose and character, nature of the work, substantiality, and effect of the use.

In your case the purpose and character of the original work was to educate people about how to use a concept, the nature of the work has transformed from educational material to a game, the published game might use the entire concept taught but that piece is a tiny part of the game, and the effect of using it in your game is not going to alter the value of the material as it exists in the book or web site.


Unless copyright is specifically claimed in the code sample, it is generally safe to include source code snippits found on educational and tutorial web sites as a small part of a larger product. However, if it specifically does include a notice (like the GPL or BSD license that require every source file be properly marked with a copyright notice) then that applies instead.


#5133929 Legal risk in editors, and giving players freedom to edit

Posted by frob on 23 February 2014 - 03:05 PM

That about sums it up. Lots of programs allow people to create new and custom content. The exact details differ wildly. Sometimes lawsuits result, but I'm not aware of any major game-related suits that have made it all the way to a final ruling about legality involving user-created content.

When the OP asks "how much risk is there", I'm really not sure how anyone could answer that. Quantifying risk is hard. Should we say, "That is risk level 7, beware!" or something similar?

There is risk in everything you do. People can make legal threats and sue you for just about any reason they can imagine. The more money you have, the more creative people are at imagining up how you harmed them. After a series of increasingly-expensive legal posturing ranging from C&D demands through protracted court proceedings, ultimately the decision about the legitimacy of the accusations and any penalties involved falls to the opinions of judges. Because of the cost it is fairly rare for them to even reach the courts, and when they do they are usually quickly settled for a bit of money and possibly with an agreement not to do something in the future. The risk of EA or Activision or another multi-billion dollar company being sued over custom content is much greater than an unknown studio with no money. They also have legal departments that deal with threats and legal posturing every day.

If you are engaged in business you need a business lawyer for occasional work. Have a chat with your lawyer, especially when you have concerns about that. They know your exact situation and can help explain, understand, and mitigate the risks based on your personal situation. If you are concerned enough about it, your lawyer should be able to help you build a safe wording in to your EULA, or if you are even more worried about it, help you figure out what to remove from your game.


#5133921 data compression

Posted by frob on 23 February 2014 - 02:19 PM

Wow.


Data compression is a straightforward mathematical mapping.

You can find alternate encodings in an attempt to reduce entropy. It usually gives a smaller file, but sometimes doesn't. Sometimes running a compression routine results in a larger file. There are many different algorithms out there, the most widely successful ones have the nicknames DEFLATE and COMPRESS, both are internally used in zip formats. More complex statistical analysis is done in formats like .7z, but still the goal is entropy reduction of an arbitrary input stream.

You can remove data and replace it with similar, but smaller, data. For example, you can take a 24bpp image and reduce it to 8bpp. You can take a 192kHz audio file and resample it at 44kHz or 22kHz or even less. You can compress your large image with a highly compressed jpeg with lots of compression artifacts, or resize it. These are domain specific algorithms, and data is lost in the process.


There is no "metaphysical destruction of information" going on. You can have a 50x50 low quality thumbnail generated from a 21 megapixel photograph, it doesn't involve parallel universes, deities, or invisible trans-physical dimensions. The fact that you can't reverse the process -- turning a tiny thumbnail into a highly detailed high resolution photograph, also has nothing to do with eminent destruction of the universe because of data loss.

All the metaphysical stuff, that has nothing to do with the mathematics of data compression.


#5133763 Pros and cons of systems like GameMaker, GameSalad, etc?

Posted by frob on 23 February 2014 - 01:31 AM

I'd say it boils down to a question of intent.

Using an existing game engine is a great thing if you want to make a game. It doesn't matter if the engine is GameMaker:Studio, GameSalad, Unity, or Unreal Engine. Use whatever engine you feel is best for your game, if any.

Now if your intent is to get a job as a game programmer at a major studio, you will need to focus on learning the languages a studio is likely to hire you for. The job listing will probably mention several of C++, C#, Java, Python, Perl, JavaScript, ActionScript/Flash, Objective C, or assorted other languages.


Note that these are not mutually exclusive. If you want to make games for fun that doesn't mean you can't learn to program in the major languages, and if you want to get a job in a major studio that doesn't mean you can't use smaller engines. You can do both if you want.


#5133758 How long for moderator approval?

Posted by frob on 23 February 2014 - 12:51 AM

As far as I understand it, Gaiiden/Drew, jbadams, or Michael Tanczos and possibly a few senior and staff people are involved in flipping the switches, even though it says it needs "moderator" approval.

(Although it is also entirely possible that a few of us have been neglecting a job to flip the switch, but I'm pretty sure that isn't the case.)


It looks like right now there are about ten awaiting approval.

It is a totally manual process and at some point I'm sure they decide when to schedule them for public consumption.


#5133645 Advice for kids?

Posted by frob on 22 February 2014 - 03:10 PM

Seconding (or thirding or whatever number we are at) using a small game engine for this.

It doesn't sound like your goal is to get them into programming. It sounds like your goal is to give them a game engine to play with. Yes, you can use the game engines to make professional games, but for those who are inclined to make things they can serve as great little toys.

I didn't see GameSalad mentioned, it is another good one.


#5133644 Want to make a game for android and iPhone. Where do I start?

Posted by frob on 22 February 2014 - 03:00 PM

What is your real goal?

If your only goal is to make simple games on the devices, and you don't care about programming, and you aren't asking about a career, you only want to build a game, then use one of the tools just mentioned.

There are many great games that have used GameSalad, GameMaker, and the rest.

If you are thinking about a long-term career in making games, then you will certainly need to learn much more. You won't be making AAA blockbusters with them, but for relatively simple games, or for some simple experimentation and some fun times, the little engines can be great fun.


#5133456 Another one of those "Where to start, what to learn" posts

Posted by frob on 21 February 2014 - 11:00 PM

I'd go pick up a copy of GameMaker Studio or GameSalad or a similar system.

Unlike most of the For Beginner posts, you're not looking to get a job in a major game studio when you grow up, or make the next major breakthrough, so you don't need to learn the core game programming languages. Since she's already an artist, extracting the parts she needs to provide great art should be fairly easy.

With your combined background it could make for some very interesting GameSalad results. If nothing else it could give you some new creative activities for a weekly date night.

I'd give an anti-recommendation against Unity in your case unless you are planning on a serious investment of time. Unity is a great tool, but based on the description I don't think it is ideal here.


#5133453 deinstancing c-strings

Posted by frob on 21 February 2014 - 10:31 PM

You've been asking a lot of questions about what the compilers "should" do in certain circumstances, and what they "must" do. Similarly there have been questions about linkers and other compilation steps. Not just in this thread but in most of the others that were started recently.

 

Usually when a programmer gets to that point, it is good for them to have a detailed study of the language standard.  

 

That is usually a great thing. It means you want to know how things really work versus how they are supposed to work, and want to understand the inner workings. 

 

 

A surprisingly high percentage of programmers are content to read books ABOUT the language. They will read books that describe how to use the language, how to leverage it effectively. They will read books about optimizing the code. They will read books about making code portable. But few read the actual language standard.

 

 

The final draft of the C11 standard is located here (pdf). The final version has a different first page and removes the word "draft" and some annotations, but is otherwise the same. It is about 700 pages long, and it has all the answers to what they MUST do.  

 

Pay attention phrases like "shall", "shall not", and "may". 

Pay attention to "at least", "at most", and "exactly".

Pay attention to "unspecified", "undefined", and "implementation defined".

 

 

Usually people who think they know a language are in for major discoveries when they read the actual language standards.






PARTNERS