Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Mar 2005
Offline Last Active Today, 03:13 PM

#5254403 Getting started with game programming!

Posted by on 28 September 2015 - 10:55 AM

flash games ... learning C++ ...  unity, adobe/macromedia flash, and java, but I just can’t get a definite answer.


If I just wanted to put up the simplest game, what programs would I need to do it? I can learn the languages as I go, but I don’t know what to use to actually write the code it. At this point, ANY help would be appreciated.


You can use whatever you want. Those who play the games don't usually care about how they were made.


About the tools you mention:


  • Flash. This was once a popular tool for making games on the Web.  It has fallen out of favor for many reasons.  It isn't dead yet, and it likely won't be completely dead for another decade or so.  But if you are looking to the future, this probably isn't it.
  • C++. Major studios use C++ for console and PC games because the language has many strengths for systems-level work. For major games, usually the core of the game engine is implemented in C++, other languages are used for game scripting, controlling game objects, and simulation work.  While the language is quite powerful, it is a terrible choice for a beginner. C++ assumes the programmer always knows what they are doing, and that the programmer is always right; beginners rarely know what they are doing, and are very often wrong about their implementations. When you do eventually decide to learn C++ you will need to know that the language does not provide direct support for most game-related functionality. Graphics, audio, networking, input devices, and high performance disk operations go through libraries that interface with C++.
  • Java. Java is the officially preferred language for Android devices. It also runs okay on desktop computers, can be fairly portable, and has built in graphics, audio, networking, and other systems. Unfortunately for beginners the design of the language is focused more on small business applications, transactions, and tiny chunks of processing work, so it can be difficult to get high performance. For hobby games and personal learning it is great. It is a fine choice for a beginning language.
  • HTML5 + Javascript (not mentioned in your post). Javascript -- which really isn't related to Java in any way except for the first four letters of its name -- is the current popular language of the Internet. You can do quite a lot with these two combined, but because every browser has their own implementation details and quirks, trying to get a program to run here is often a matter of building for one browser, then fixing the things that are broken in the second browser, then fixing what you broke in the first browser, then fixing it for a third browser and double-checking the first two, then adding another browser, and another.   Every programmer should eventually pick these languages up eventually because they are ubiquitous. It works as a first language, but beware that learning can be quite painful.
  • C# (not mentioned in your post). Works good in Windows with Microsoft's implementation, and with mono it works on most other systems, so it is quite portable. I love this language for quick prototypes and testing out ideas. It has some of the same problems Java has with larger systems and the language's design choices not quite matching what games need, but still a good choice for small hobby projects and personal learning. I recommend it as a first choice.
  • Python (not mentioned in your post). Another good learning language, tools like PyGame can help you build games rapidly.  Inside the professional world python is frequently used for quick scripts and automation tools. Some people recommend it as a first choice, I think it is a good early choice for a second or third language if not your first.


  • Unity.  This isn't a language.  Unity is a game engine where you can write your own scripts that get compiled and run by the engine.  Unity supports three different languages for development: C#, a variant of Javascript, and a variant of Python. Most people who use Unity these days tend to use C#.  Over the past few years they have added 2D support, so you can build 2D and 3D games relatively easy. (They are still a lot of work, easy is relative.) If you want to make games without years of experience, this is a great tool. Many people have built professional quality games with the tool with just a few weeks of effort. It also targets a wide range of systems, including PC, Mac, Linux, and phones/tablets.  Free for most hobby games.
  • Unreal Engine (not mentioned in your post). Another popular engine used for many commercial games. It primarily uses C++ for scripts you write, and it also has another system called Blueprints. You can do quite a lot with the built-in functionality, and is often compared against Unity. Both are very powerful, capable engines that are used in major games. Unreal has a longer history of the two. Also free for most hobby games.
  • GameMaker Studio (not mentioned in your post). Another popular game engine, it uses its own language. It can help you build 2D games quickly.
  • Game Salad (not mentioned in your post). Another popular game engine, using its own language. It can also help with 2D games.


There is no wrong answer, except not to do anything.  Pick something.  My current recommendation (that changes every few years) is to learn C# as a language and learn Unity as the game engine. Both have strong community support and are widely used, both have shallow learning curves.

#5254399 Tool to measure memory fragmentation

Posted by on 28 September 2015 - 10:23 AM

On a PC or other modern workstation that uses virtual memory, those holes don't really mean much. They are only logical holes since the OS will page out lesser-used blocks of memory and page in blocks when needed.


If you start to come close to exhausting your memory space (e.g. 2GB or 3GB on a 32-bit program) and need another large allocation then those are important, but for most PC programmers it hasn't been an issue for two decades.


If you're on a console or embedded system, or a system that does not use virtual memory, then you will likely be using your own custom allocator. Inside your custom allocator you can build statistics on memory fragments.


If you're on a system where it is an actual potential problem, you'll need a custom allocator. Pull from one side for long-term allocations and operate on a stack-based system; allocate on entering that level of the stack, release on exiting that level of the stack, and make sure every system operates on a push/pop design. Short term allocations pull from the opposite side of memory and have strict rules about when you can and cannot allocate. Google can find lots of examples of the rules and requirements for such systems since it needs to match your system's design.

#5254302 Game Development as a Career

Posted by on 27 September 2015 - 09:14 PM

but when my professor told me that this isn't the place for game programming, along with knowing the learning game programming and arts is hard and time consuming, discouraged me from wanting to continue.


He is partially right.  No school will bestow upon you what you need for game programming, not even game-centered schools.


Schools are an environment to help you learn. Instructors guide through topics you may not normally know to cover, and topics you may not want but still need to know. They are guides to help you learn, and hopefully they can offer insights and direction that you wouldn't easily find on your own, but still it is up to you.


Games are software. Courses on software development are useful. You must learn how to develop software if you want to develop games.  Any tool or technology you learn about in a computer science program is going to have uses in game development.  You probably won't use everything on every job, a gameplay engineer is not going to use much of their database schooling, and a back-end game server engineer uses different knowledge, a UI engineer uses different knowledge, a developer working closely with designers is going to use different knowledge, but all the knowledge is useful to people in the industry.


Exactly what you learn and accomplish is entirely up to you.  


If you want to make games, doing it during college is a great time to build a portfolio of small stuff because you are in a safe environment, have tools and resources at your fingertips, have professors and peers to help answer questions, and have time that becomes less and less available as the years roll by.

#5254294 Singleton and template Error (C++)

Posted by on 27 September 2015 - 07:09 PM

The singleton, a type that can only have one instance ever created, where attempting to create more than one is forbidden by code, that is something to avoid. Even on consoles still a terrible idea. Even for logging where some people suggest it is good, it is a terrible idea: I've worked on plenty of projects where I wanted a private logging system.

A well-known instance, sometimes implemented as pointers within a globally readable data structure, is sometimes a compromise made in coding design.

These well-known instances are NOT singletons (you can create multiple instances if needed) and they are not globals (statically allocated objects), but they are dynamically allocated objects with well-known pointer locations, and they come with strict rules about who can use them for what. These also need to have carefully reviewed, vigorously enforced policies to ensure they are not misused, treating them as short-lived constants in almost all places, with well-defined times of when they can change, such as outside of Update() loops.

Sometimes these well-known instances are managed through a single global object that is nothing more than a bunch of pointers. So you could access it through ::Systems.audio->method(), but there are some big concerns about it. If you are careful that they are mutable and immutable at the right times -- that is they are not modified by using them and that they are only modified at specific times, then it can sometimes work out.

The worst bugs are the ones where those values are modified at the wrong time or by systems unknown. Without warning the behavior of the game is suddenly different, and you cannot find who modified what, when, or why. Suddenly a state was set or a value was modified, and you don't know which of the many systems that could have modified it did so in the wrong spot. Those are nightmares, and the reason globals and mutable shared state are considered terrible design generally.

#5254205 How does one Start Building a Top-Down 8-Bit Game?

Posted by on 26 September 2015 - 09:33 PM

Welcome to the site.


Sorry about to do this for your first post, but there is some required reading


After you've read that, if you've still got questions, feel free to ask them.  Just make sure they show you've already done a bit of effort and show you've read the basic rules of the site.

#5254038 What is more charged?

Posted by on 25 September 2015 - 01:19 PM

I'm not sure what you mean by "largest charges".  Do you mean what technology gives you the highest pay?


In general, game development pays high compared to the average wages, but pays low relative to other technology jobs.  If you are looking for the most money, go in to database development or high-performance financial software development.

#5253996 [Java] Most Efficient Way To Iterate Through A File ?

Posted by on 25 September 2015 - 08:16 AM

Yes, disks are slow relative to memory and CPU speeds.


But disks are much faster than are being described.  While no file sizes and times were given, different types of disks (slow spindle disks, fast spindle disks, ssd disks, thumb drives, etc) have performance that shouldn't be too painful.


It is common to see spindle disks with 30MB/s or 50MB/s.  Better SSD drives routinely reach 300MB/s, newer ones routinely sit around 500MB/s.  Then there are the high performance PCI card drives that are currently around 3GB/s. (Yes, gigabytes per second.)


A text configuration file should not be "painful" to load. Even if the configuration file is 5 or 10 megabytes in size, the time spent actually loading the file should be a fraction of a second. It may be a large fraction of a second like 1/3 second for a slow spindle drive, but not to the point of being "painful". 



When files take a long time to load, unless you're loading up gigabytes of files, facing a "painful" loading time likely comes from time spent doing processing and manipulating data, not so much time transferring data from the hardware.  


Java is particularly well known for flooding the world with copies of strings. (Profiling and debugging one tool, I found a vendor's library that in a matter of seconds started triggering garbage collection as it had filled memory with substrings, and surprisingly generated over a quarter million copies of the string "YES", all waiting for GC to clean it up.)  While some strings are automatically interned, it is trivially easy to fill memory with copies of the strings and pieces of strings because so many library functions think nothing of allocating yet another copy of a string.

#5253990 GPU load/temp monitoring for Intel?

Posted by on 25 September 2015 - 07:58 AM

The folks who made GPU-Z have a third-party library that works across cards.
Some of the information can be found with D3DKMTQueryStatistics, which is usually not meant for user-mode code. For a source-code example, ProcessHacker has source as well as header files for the structures you're going to need.  
Beware that these calls are venturing off into undocumented, unsupported, and vendor-specific territory.

#5253857 [Java] Most Efficient Way To Iterate Through A File ?

Posted by on 24 September 2015 - 01:00 PM

Be very careful with allocations as this is Java.


If you are parsing the file by creating an enormous number of temporary objects and throwing them away, that is wasteful and can be incredibly slow.  


Unfortunately the language design of Java makes that the easiest way to go. If you're using third-party libraries they likely are using those terrible techniques of not managing memory well.


Once Upon a Time (about five years back) I was assigned to fix a tool that needed to go through a big collection of data in a file, about 15MB data file. Basically this was the consolidated master resources list for the game, and the tool needed to validate that every model, texture, animation, script, and audio file was present.   It took over a half hour to open and process the file, mostly because it was parsing and allocating everything as it went, spending time doing allocations and releases of tiny strings, calling constructors and destructors, testing the file system for existence of file names to ensure they were valid, and on rare occasion actually doing work.


By the simple process of reusing buffers of objects and loading in larger batches plus caching file system tests, I was able to drop it down from a half hour to about a minute and a half.  It took a few design changes to use a recycling pool of objects, but within about two days it was easy enough to find and eliminate the problems.


From the short description given, it seems you are likely suffering the same problem.


In that case, build a factory method to construct AND RELEASE objects, but instead of allocating with new, attempt to reuse from within a pool. Do not ever use strings, which are of the devil in Java, instead use and reuse byte arrays. Find any other slow operations -- in my case that was checking for the existence of a file -- and attempt to either eliminate the work, or to cache the results, or to spawn a small worker thread to do the work asynchronously.

#5253845 Feedback on this Threading architecture

Posted by on 24 September 2015 - 11:47 AM

I would need to have three copies of data: Lua's data (...), then the double buffer?
Why not just submit one buffer, and let the renderer use that. If we are just interpolating, then the renderer can continue to work with what it has. When lua is done with it's simulation, delete that, and replace it with new data?


Because it doesn't let you decouple your systems.




Any suggestions to this? A better architecture?


Fix your timestep, and decouple your renderer from your simulation.


Rendering and simulating should be completely separate actions.  On smaller hobby games it usually doesn't matter much, but as systems grow these change.  Simulation should be fixed at regular intervals to prevent an enormous number of bugs related to fast and slow simulation steps. Advance the simulator when you are ready, advance multiple times if you need to.


Bigger engines tend to render "as fast as possible", and tend to interpolate between the previous simulation state's time and the current simulation state's time, advancing through one simulator step in the past.  


The buffered versions of data gives you the two snapshots for advancing the renderer. It tends to be a little more complex because you are interpolating through animations and other systems, and you'll want to catch some of the nuance that animators create.



For smaller systems and hobby games that much effort is likely too difficult, you're spending your valuable time writing more advanced engine technologies rather than creating your game.  For a large group where there are several engine developers working along with the gameplay dev team it is a great system to build.


There are many great benefits of decoupling the two.  Some of the more utilitarian are that you avoid bugs that come from variable timesteps. Probably the coolest is that you can run multiple headless simulations.  Just tell a single computer to launch 20 or 50 or 100 simulations, and have the AI play against itself. If a problem is detected, attach a graphics rendering and log everything. Since automated tests are relatively rare in this industry, it serves as a nice way to exercise the system and detect hard-to-catch issues both in the simulator and in the AI.

#5253759 What's the next step?

Posted by on 23 September 2015 - 09:24 PM

Note that education is a location specific thing.

If you're in Thailand or New Zealand or Australia or similar countries where formal education is less necessary, you probably don't need the degree as much. Learn on your own, build a portfolio on your own, get a job on your own.

If you are in a major city in the US with game studios, where there are 10+ universities and even more colleges nearby, your career will be much better with a degree; finding a job at all will be much harder without one. Not impossible, but much harder. Without a degree you will have less to negotiate at every job, meaning lower pay, lower positions, lower rungs on the ladder of life. Work experience and portfolios will help, and after a decade or two the lack of a degree will matter less and less, but it will still make a difference. You'll be in your 40s, or 50s, or 60s, and still need a job to support yourself, and potential employers will still be asking questions about the degree you didn't get.

Assuming the US, also note that college degrees don't need to be expensive. Shop around, find schools that are a low price rather than the popular name-brand schools. Junior colleges can be found for under $1500/year. Universities can be found for under $4000/year. Many people comment about how they want to go to a specific school that is $20K or $30K or $40K per year, but they cannot afford it. That is life. I drive a 2003 prius rather than a 2015 ferrari, the prius is adequate. Similarly, a less expensive college degree is adequate, you don't need to go to MIT or some other ultra expensive school to have a great education.

#5253722 can anyone explain const char*, char, strings, char array

Posted by on 23 September 2015 - 02:34 PM

You might also be interested in the Big List of Naughty Strings. It is useful for helping debug programs and as test input.


The first section is devoted to the problems with null strings, strings containing nulls, and values that many languages silently convert to and from strings. While seemingly simple, they tend to break a surprisingly large number of systems that process strings.

#5253720 can anyone explain const char*, char, strings, char array

Posted by on 23 September 2015 - 02:28 PM



Please be more careful with those.  While they are visually similar -- one is a double quote the other is a single quote -- they mean radically different things.  The first indicates a null-terminated c-string containing a null value (basically the address of the pair {0x00, 0x00}) and the other contains just the null value (basically {0x00})



My point is that std::string can deliver amount of bytes of string value without even knowing encoding, or even after changing encoding, what means that intended string bytes must be apended by '\0' magic byte.

Unfortunately not true. There are several real-world cases of string encodings requiring embedded nulls. Most of the common patterns for manipulating strings assume that input values are c-style strings where the first null character terminates the string.


Yes it is generally true, but not universally true. This was an issue that has been carefully designed around since the first standardization of C++. Strings that contain embedded null characters tend to expose flaws in bad standard library implementations.

#5253699 Orientation help please

Posted by on 23 September 2015 - 11:34 AM

XNA was made as a wrapper for a bunch of DirectX 9 era functionality.  It also supported XBox 360 and Windows Phone 8, both are now replaced with newer devices.  It is discontinued because the systems it supports are generally several generations back. 


XNA still works correctly, and will continue to work correctly until the various old systems begin to break down.  So it should work for at least another decade.


Monogame started as a clone implementation and still focuses on the same DirectX 9 era functionality, but also supports additional platforms. 



They work, and the are more than enough to help develop most hobby games.

#5253695 Name : Utils or Utility ?

Posted by on 23 September 2015 - 11:26 AM

They do SOMETHING and they are used SOMEWHERE, so those could be guidance.


You mention "Core", which could be a good place.  Core\SomeTask\Whatever


I dislike "utility". Look deeper at what it is doing and find a good location for it. Algorithms, Structures, Numerics, Processing, or whatever more generic term is most related to actually doing.