Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Member Since 05 May 2007
Offline Last Active Dec 23 2014 12:34 AM

#5155777 Choosing c# or c++ for game engine development

Posted by Bearhugger on 24 May 2014 - 09:27 PM

Well if you're not comfortable with C++ then I doubt you will beat the .NET JIT-compiler at writing fast native code in C++, and with Microsoft brewing some native .NET compiler, the speed difference will probably become a lot smaller very soon. (Like compiled VB6 vs C back in the 90s.)


If you want to use C++ because it's your long-term goal to be proficient at it, this is a great opportunity. Using C++ to be able to eventually port to iOS and Android might also be a good idea. If you just want C++ to save a few CPU cycles then I wouldn't bother unless your project is such that it absolutely needs blazing-fast performance. Truth be told, C++ might be a good starting point, but it is not a panacea to slow code. For example, Ogre 3D, which is pure C++, is sluggish and slow, and Runic Games, who are not even making performance-hungry games, had to mod it to improve performance. I wouldn't be surprised if someone could out-perform Ogre3D using XNA.



Also, I'm not sure I'd recommend BinaryFormatter for saving objects during development. I use it in my game editor for saving stuff and I regret it. Whenever I want to refactor something in my code, it breaks binary serialization and I can't fix it by hand, instead I have to use a SerializationBinder, hack some translation code, then load and save ALL my assets, and finally recompile my app without the hack because SerializationBinder slows loading down to a crawl. (It was such a pain that I had to make a library for auto-generating a SerializationBinder.) If I had to code it from scratch again, I'd probably save my levels in XML or JSON and my data in a SQLite database, disk space be damned. I think that binary serialization in .NET is useful for in-process serialization like copy and paste, sending data between AppDomain, and over a network, but not for long-term storage, and especially not during development where stuff can be moved and renamed.

#5149324 DRM protection

Posted by Bearhugger on 25 April 2014 - 01:37 AM

Just make it easier to buy than to pirate. It's not even about the DRM.


I find it much more convenient to spend a few bucks on an online store and not have to worry about viruses, rootkits or trojans, than having to search on torrent sites, looking for a well-seeded torrent, reading the comments, downloading it, and then exposing my machine to viruses, risking getting a crypted zip that you have to pay the pirate to get, follow hacking directive to replace XYZ.dll with a file that will give a heart attack to my AV, or some other crap that is common with pirate site.


On Steam I pay 20$ for a special (I only buy games in promotion) and then that's it, it's really easy. I wouldn't go back to piracy.


Personally, if I ever get to release my game, I will use the DRM of whatever platform I get it on (App Store, Google Play, etc.) because hey it's free, but I'm not going to lose my time trying to lock the game and risk getting false positives on legit users. 

#5102736 Simple attribute/combat system for RPG

Posted by Bearhugger on 19 October 2013 - 05:53 PM

Personally I would change Constitution so that it reduces damage taken instead of increasing health. (Which is actually what I do in my RPG.) As someone who usually picks tanky characters, I'm not too fond of stacking pure health. I know that a lot of old-school RPGs have that kind of system where constitution/vitality/stamina increases health and intend that as THE primary tank stat, but personally I never found the intended way to build a tank to be the best one.


Having a lot of health just delays your character's death, and it makes him or her harder to heal. What do you prefer? Healing a character that has 100 health and 50% damage mitigation, or a character that has 200 health and 0% damage mitigation? Mathematically, they take the same amount of punishment, but the first one needs to be healed half as often as the pure-health tank.


As it is, if I was playing your game, I would probably get just enough health to survive magic attacks, and then put all my attributes into evasion so my tank can get some crazy 90% evade, so that the only thing that can hurt me is magic damage.

#5102582 Final Fantasy VI game - chronological order of building & being challenge...

Posted by Bearhugger on 19 October 2013 - 02:24 AM

I've made my own Final Fantasy VI-alike game engine. (Some screenshots:




Most graphics assets are RPG Maker graphics I borrowed.)


Making a game engine for a 2D RPG is totally doable on your own, however you are going to be working on it for a long time before seeing results. When I built that game engine, it didn't take me an eternity but I had no job, no school and no lover so I could afford to work on that project from 10 AM to 3 AM if I wanted to. And I also had an unending love for old-school Final Fantasy games. I could never afford to do that now at 29. I have stayed away from Final Fantasy since they turned bad, and it gave me an idea for a new battle system that would be (IMHO) a lot more fun and tactical than this ATB that I copied, plus a new skill system, item system, etc. but I just don't have the time to work on it. I wish I had the time to work on it full time. =/


But I disgress...


I would suggest working on a simpler genre. Unlike most other genres, Japanese-style RPGs like that don't have much physics to deal with, which might make them sound easier to make, but the amount of data that is involved in a RPG is absolutely crazy. You have item data, weapon data, armor data, skill data, enemy data, enemy group data, hero data, shop data. And then you have two major and separate game modes to create: the area map mode where you talk to NPC, open chests and show cutscenes, and the battle mode where you, well, fight monsters. If you want the game engine to have features similar to FFVI, you're going to put a lot of work in both. For example, FFVI had a very extensive battle animation system, where you could of course draw sprites, but also generate vectorial stencils that mask parts of the animation, generate trails for character sprites, animate palettes. So a cheap "missile-with-particle-system" 2D animation system just isn't going to cut it. (Again, assuming you want FFVI-level quality.) I could definitely be wrong, but since this is the "For Beginners" forums I'm assuming that you're not ready for that kind of game. A RPG also involves a very large amount of content, and players chew through that content really fast. It can take me 2 hours to make a cutscene of 5 minutes (which is still a joke compared to the time it takes to make a CG 3D cutscene of 5 minutes...) and a player will typically only see a cutscene once, unless it's before a hard boss or something. My RPG took 2 hours to do from start to where I was at when I left it (when I decided to rework it into something that isn't as much of a FFVI ripoff), but I had probably spent 4 months just creating content. (Not programming or drawing.)


I think a simpler genre would be something like a side scroller. You have a lot more physics to deal with, but you only have one game mode instead of two, much less content to do, less music, probably less assets too (although I could be wrong on that one.)

#5100675 2D Oriented Game Engines

Posted by Bearhugger on 11 October 2013 - 07:23 PM

Making a 2D engine is relatively straightforwards so I don't think you'll see a lot of generalist pre-made game engines for 2D like you do for 3D. Normally, the programmer of a 2D game would just hand-pick the libraries she or he needs and stitch them together in his own engine. (For example, could be SFML for graphics, FMOD for music, Box2D for physics, PhysFS for IO, etc.)


There are popular 2D game engines but they're all super high-level engines where you barely have to code anything. Although if those are what you are looking for, those are pretty good ones:

Game Maker.

IG Maker.

#5100312 Installshield LE not working

Posted by Bearhugger on 10 October 2013 - 02:59 PM

I don't think this is compatible with Visual Studio Express. I don't even know if you're allowed by the EULA to release software with it, so supporting an install tool for pre-release doesn't make a lot of sense to me.


You could always use the free NSIS. Personally, I use that professionally to create setup projects for my jobs, and it works great. You have to use a (very simple) scripting language instead of having a point-and-click interface, but unless you have a very complex project to install, it is pretty straightforwards.

#5096011 Who has implemented a licensing API/SDK

Posted by Bearhugger on 22 September 2013 - 02:49 PM

I'd just leave it to my distribution platform (Steam, Apple App Store, Windows Store, etc.) to handle the DRM and focus on making a good game. I would not lose time with it myself, it's just not worth the effort and I don't care to play that cat-and-mouse game with hackers. People who will crack your game are usually not going to buy it anyway. I'm guilty of having pirated games in the past but those were either games I was never going to buy, or games that I wanted to try before buying. I have never pirated a game from developers I trust to not make cheap cash grab games. I have never pirated a Blizzard game, for example.


More importantly, sometimes DRM itself might be the reason why people don't want to buy your game. Don't make it safer and easier to pirate the game than to buy it legit. Mass Effect 3 has been massively pirated, and I bet that one of the reason was that people didn't want to install EA's Origin's DRM/spyware/cloud on their computer. I decided to just not play the game (rumors about the ending cooled my excitement anyway) but those I know that have played it on the PC have all pirated it. Although unless you're called Ubisoft or EA you probably don't have the means to invest into draconian DRMs like Origin or Uplay so you can probably ignore this issue.


You might want to go the always-online way, but if you do so you need to ADD VALUE to the always online factor so that it's not just an annoyance for the players. A lot of people have complained against Diablo III's always-online feature (and who am I to tell them that they're wrong) but personally I grew a large friend list by playing World of Warcraft, so being able to chat with my friends while playing any Blizzard game makes always-online awesome for me. I wouldn't play the game offline even if I could.


On a side note, I have once successfully used a protection scheme to force the customer to pay the full price of a software when I was working for a company that made industrial machines. I hid the lock/unlock flag into the machine's RAM on a chip. Of course he could have "easily" hacked it, but when you're buying hardware that is one-of-a-kind and costs 5M$, you don't want to risk breaking it (plus voiding your warranty) by hacking the chips for the 5k$ software add-on... Of course, games are all software, so you can't do anything like that. 

#5085896 How does a “Build” button in game engine editor window works?

Posted by Bearhugger on 14 August 2013 - 01:40 PM

How these executables access those assets and scripts if they are packed into single archive?


It's quite simple, actually.


Archive formats store some sort of look-up table somewhere in the file. In a very basic archive format, each entry in your table will contain the name of the file, the offset of that file in the archive (ie: where to fseek to), the compressed size of the file, and the size of the file when decompressed. It could also store flags such as whether the file is compressed, which can be useful if you're storing files that are already compressed (such as PNG images) because there's no point in compressing a file twice.


Typically, how it works is that your code will tell your I/O module to include an archive in the search path. Then, the first thing your I/O module will do (well, after maybe file-mapping the archive) when you give it that archive is to read that table and put it in somewhere in memory, probably in a dictionary or a hash table, so it knows where to find all the files. Later, when your program requests a file from that archive, your I/O code can quickly determine whether that file is contained in the archive, and it already knows where to find it. (In what archive and at what offset.)


For a very simple real-life example, here's the archive format of good old FFVII's LGP files: http://wiki.qhimm.com/view/FF7/LGP_format. It's obviously a very simple archive format. A lot of companies want additional features such as encryption or formats that make it easy to update, remove or insert files without rebuilding the whole archive.


Also, sorry if I'm stating the obvious, but Archive formats, including generalist ones like ZIP, don't compress all files together. Rather, each file is compressed (and optionally encrypted) separately, AND THEN concatenated into one single (or several) archive. Otherwise you would have to decompress the entire file to reach a file stored at the end of the archive, which is obviously not optimal.


Shameless plug but since this is related to the topic, I'm actively working on an archive format partly inspired by Blizzard's MPQ format which I am a fan of, with an easy to use C++ 11 API library to access those archives. It has/is going to have features like built-in localization support, platform-based include/exclude of files, first-class support for modding and patching, high performance file reading, multi-threaded access, etc. I wonder if there would be any interest in that kind of library because I wouldn't mind releasing it to the public if it's something that could help developers.

#5085311 How does a “Build” button in game engine editor window works?

Posted by Bearhugger on 12 August 2013 - 04:59 PM

When you hit "build" it probably converts your assets into file formats that are optimized to be read very fast (assuming the editor doesn't do it as soon as you import it into the project), then it takes all those assets and packs them all into an archive for the purpose of blazing-fast access, compression and weak obfuscation. Each big developer has its own archive file format: id Software has .PAK archives, Square-Enix has .LGP archives, Valve has .VPK archives, Blizzard has .MPQ archives (IMHO the best ones featurewise), etc, etc, etc.


In the case of Unity it probably also compiles all your C# code with maxed performance flags and pre-parse your JavaScript as well.

#5082611 JRPG: Average Number of Pieces of Dialog?

Posted by Bearhugger on 02 August 2013 - 05:35 PM

It depends on the JRPG. It's been a while since I made Final Fantasy VI (SNES) mods, but on top of my head, the game had dialog indexes that went up to around 0xE00, which brings us around 3,584 dialog units. However I say "units" because those dialogs could include multiple pages. (As long as you could hit A without the dialog closing, it was the same dialog ID.) If you want to count each dialog reply as one unit, it probably goes upwards to somewhere between 5,000 to 7,000.


Keep in mind that this is a 1994 JRPG with tons of "generic" dialog lines that any of your party members could say. It didn't matter whether you had little Relm, the big muscular Sabin, or Cyan with his Old English accent, there are dialog that would be said the same way regardless of the character.


The next big JRPG that Squaresoft built was Chrono Trigger, and it had customized dialog lines for every character that could ever join you, and on top of that the game really didn't pack as many dialog replies in a single dialog unit like in FF6 because the devs wanted to slip sprite animations between many replies (ie: Marle shaking her head before saying "NO"), so the amount of dialog units probably went way up, to around 10,000 dialog units, and it should be much closer to the actual number of dialog replies. I don't know the exact numbers because I didn't mod Chrono Trigger nearly enough.


For the PlayStation JRPGs there's no easy way to tell with one glance though. The dialogs are all stored in the map files for each individual area instead of being stored in one huge region of a ROM image like the NES and SNES games. You'd have to open every single map in the game in a mod editor and sum the amount of dialogs in them.

#5068536 [c++] Enum, sizeof

Posted by Bearhugger on 09 June 2013 - 08:08 PM

Sure, as long as the code that reads it also has the exact same enum size.

In C++ 11 you can fix the underlying integer type of an enumeration like this:

enum MyEnumeration : unsigned short

You can use this if you need to fix the size of your enums for serialization purposes.

#5066986 Difference between software engineer and programmer

Posted by Bearhugger on 02 June 2013 - 07:52 PM

Programmers write code. They may do other things (especially as seniors) but the only thing that's implied by their title is that they write code.


Software engineers design the software architecture, define the requirements, plan the testing and QA strategies, probably manage a team of programmers and might report directly to the CEO, etc. In small places, they're sometimes both programmers and software architect. They can also be responsible of implementing standards when required by their superiors. A programmer may certainly be good at all of those, but a software engineer is *required* to be good at those as part of their job. A software engineer that's a bad software architect is a bad software engineer, period, whereas a programmer that's a bad software architect can still be a very good programmer. (Maybe he's a genius with algorithms, maybe he can see potential bugs miles ahead and writes very few bugs, maybe he has a great mastery of the programming languages he uses, etc.)


As I see it, a good programmer *may* be a good software engineer, but a good software engineer *is* a good programmer. I think that those who were not programmers before being software engineers tend to cause a lot more harm than good in a project, at least from my personal experience. I had a couple of jobs and have heard a lot of stories where the software engineer came from unrelated disciplines and it never went well. Not that they weren't smart, they simply lacked real-world experience and had no idea how it would be to actually implement their designs. In one job, the designs the engineer produced were completely unrealistic and impossible to follow for programmers. A software engineer with a solid background in programming has a good idea of the kind of work she/he is giving to the programmers. Unfortunately, one year and a half of purely academic Java programming is not enough to give a software engineer a solid background in programming...


The problem with software engineering that makes it unlike most other engineering discipline is that programming software is both a craft (or an art) and a technical discipline. (Which is why we have the aberration where software is both copyrightable and patentable. But I disgress...) An engineer in other fields will design a bridge or an engine, draw the plans in AutoCAD, simulate it in something like Inventor, and then he knows exactly all the pieces it will take and has a very good idea of how it will cost to build it. Writing software is not like that, because even if you have the plans for all the systems, it's extremely hard to predict with reasonable precision how much the project will cost and how long it will take. You can't test and predict the robustness of your design until the programmers have actually written the program, and then once it's done you'll almost certainly have adjustments to do. This is the part where programming software is more like a craft or an art than a technical discipline. Of course, sometimes bridges collapse or cost 10 times more than what it was planned, but it is much more rare than a software crashing or going overbudget. (For that reason, software engineering is not recognized as a real engineering field in some states.)


Another difference between software engineers and programmers is that in some places (some Canadian provinces, for example) the "engineer" profession is protected and you can only call yourself a software engineer if you actually have a degree in an engineering discipline, so if you see a software engineering jobs in those places (big army or government jobs sometimes require software engineers) you can't take the job if you are not an engineer, even if you have a Ph. D in computer science. (Which is kind of silly because an engineer in mechanics or chemistry could theorically take it.)


When it comes to creating interactive games, I'm not sure what kind of benefit software engineers bring. I don't work for a game company, but from what I understand, games have to be released fast and on strict schedule, and the failure of entertainment software is not exactly catastrophic. (The game crashes and you lose like 5~10 minutes of entertainment. Well, suck to be you.) So I'm not sure what benefit a game company would gain by hiring a software engineer to design big software systems, implement thorough QA strategies, force meticulous testing strategies, etc. I figure that implementing something like ISO/IEEE 12207 standard on software engineering and lifecycle would probably be too much effort and constraints for a game company that wants to produce games fast. (Those standards are usually for critical systems.) But again I don't work for a game company, so if a software engineer working for a game company would like to comment this I would be very interested.

#5054573 Coding Style: Curly Braces

Posted by Bearhugger on 18 April 2013 - 08:39 AM

Both coding styles are fine and I would be fine using either. The only style I cannot stand is the GNU style of having half-indented braces. Very annoying to maintain, and if a real TAB slips through the code it's going to look real ugly with different tab settings.



Coding style is a programmer's signature. If you get to call the coding style to be used (or if it's your own personal project) pick a style you like and stick with it, consistency is more important here.


That being said, personally, I have a preference for putting my opening braces on their own line because it makes the blocks pop out more. I already put a lot of white lines in my code to separate the logical "sub-tasks" of a function, and a condition block of a few lines is definitely a sub-task that I would white-line anyway, so putting the brace on its own line feels more consistent and natural with my coding style.


It also serves to separate the condition from the blocks. For short conditions this is a non-issue, but for long conditions that span on multiple lines it becomes harder to quickly spot where the condition begins without that empty white line.

#5050170 Visual studio like app on MFC

Posted by Bearhugger on 04 April 2013 - 07:03 PM

If so, I cannot understand how VS with all amount of components use so little memory? I wrote  not big WPF applications and during work they use near 100 MB of memory. VS is very huge application an it use only ~ 300-400 MB. How could that be if it created using WPF (C#) or they use it only for face and C++ for "background"? 

Microsoft Visual Studio is not monolithic. It's a mish-mash of multiple technologies that have been accumulated over years, some programmed directly against the Win32 API, some programmed in COM, others in .NET, OLE, ActiveX, etc. Visual Studio .NET added a lot of managed code, (AFAIK the WinForms editor is run by managed code), but there's no way Microsoft could afford to rewrite the entire developer suite in .NET.


Visual Studio 2010 is still using all these native components. What was remade was the entire presentation layer in WPF, whcih had to be re-written in managed code. Due to the large native codebase the VS team inherited, they had to hook the main loop in C++/CLI to dispatch the messages to the native components that need i, but the user-interaction code remains largely WPF and .NET. Microsoft has made a presentation about how they converted Visual Studio to WPF. (ie: http://www.microsoftpdc.com/2009/CL09)

#5049945 Visual studio like app on MFC

Posted by Bearhugger on 04 April 2013 - 08:23 AM

And if you remember that all native Windows application like VS, Office and other develope using MFC, you will understand that it is the best practice fro Windows developing a complex MDI applications.

Actually, the UIs of Visual Studio 2010's and Expression Blend are built with WPF, not MFC. Apparently, they did so because you're not the only developer who is skeptical about WPF's usefulness in "real-life work" and Microsoft wanted to prove everyone wrong. ;)


By the way, in WinForms(which actually in same state as MFC) or WPF you just cannot do some specific things which you can do on C++ and to do them, you need to go deeper.
So, I don`t think that MFC worse than any other modern technology.

I have built the first version of my RPG game editor with MFC before switching to .NET/WinForms. The only thing MFC has that I miss in WinForms is WM_CMDUI and maybe updating widget controls directly in member variables because I'm not a fan of data binding in WinForms. (It looks better suited for database binding than objects.)


I'm a big defender of MFC, and I really think it's not as bad as people make it out to be. It might not be a marvel of software engineering, but it has been powering applications since 1992. If I have to build a Win32 GUI application in C++, I'd rather use MFC than Qt, for example.


But as much as I like MFC, I find its range of use cases very narrow. Big commercial applications that need native speed and responsiveness (like Adobe Reader) are typically built in Qt because cross-platform is becoming increasingly important. Business applications and internal enterprise tools are built in .NET or Java because who needs C++ to build a bunch of text boxes bound to a database table? Microsoft is starting to use WPF and WinRT for Windows-specific with rich UIs. Games only need a blank window so just learn how to make one using the Win32 API. I wouldn't be surprised if Visual Studio 2014 does not support MFC.