Jump to content


Member Since 20 Jul 2006
Offline Last Active Dec 04 2015 02:19 AM

#5199894 design question: data driven: best methods?

Posted by djtesh on 24 December 2014 - 03:06 PM

Although your question is not very specific, here are 3 popular methods that won't let you down:


1. JSON, with a parsing library available in most languages. JSON is easier to read and edit, smaller than XML and works with RESTful APIs and internet technologies all over the world now.


2. XML. XML is also easily consumed and parsed in most languages. It is older and somewhat clunkier, but it is still being used in many commercial game engines as a general data format.


3. Design a database using SQLite. This is a file based database format that can be easily consumed in C++ and most other languages. If you know SQL and relational database concepts, this is a powerful way to store and query your game data.


My opinion is that writing custom text file parsers is a waste of time compared to these options, unless you have to do something so extraordinary with it that it makes it impossible to use all of these methods.

#5199287 How can I create an installer for my game?

Posted by djtesh on 20 December 2014 - 12:58 PM

As far as I remember, the Visual Studio Installer project can be configured to include the installation of other components like the runtime library as part of the install. It won't embed the whole thing but rather download and install the latest from Microsoft's servers during the install process.


Look it up. If not, there's Inno setup. It is a powerful, script driven system that definitely handles pre-requisite installs.

#5199284 I need advice for beginning game programming

Posted by djtesh on 20 December 2014 - 12:50 PM

Hello there,


I have worked in both AAA and indie environments and different sizes of games. Just wanted to leave some random information here for you to consider:


Since Terraria renders and maintains thousands of terrain tiles per frame, performance will be an issue, and Python may or may not be fast enough to handle the computational aspect of it. For this particular case, I'd recommend something using C# or C++. If you don't know either language, you'll likely find C# to be much easier yet more capable (out of the box) than pure C++. C++ takes many years to master because the language leaves you to consider things that have been neatly "solved" for you in C#.


If you go with C#, you might want to consider MonoGame or XNA to help jumpstart your rendering and game systems. You could also use Unity Free. Building a game engine from scratch will take a lot more effort - and architectural level understanding of how game engines work. A lot of reading and experimentation..


MonoGame / XNA allows you to piece together your game and works more like a swiss-army-knife styled utility library.

Unity is a full fledged engine that takes over all of the heavy lifting, allowing you to simply focus on gameplay prototyping.


And this is where the important question comes up. Do you want to make an awesome game now - or do you want to become a badass programmer? What is your ultimate goal with this project?


If your focus is to learn more, go with MonoGame / XNA or even write your own engine. However, if you want to make your game quickly and focus on bringing it to market sooner, then you may want to choose Unity instead.


C++ is used in high end AAA studios in several engines that are almost a decade old (or even older). The reason C++ is used is for raw power. Most of these engines use a scripting language like Python / Lua in order to allow designers and other scripters to flesh out the gameplay - things like missions, switches, triggers for sounds and particles, loading levels, spawning items and such. The really low level graphics, particles, physics and other subroutines are tucked away and maintained in C++ by "well paid" "badass" programmers who hardly work on the game. Their job is to manage and ensure optimum memory usage on consoles / PC, multi-threading, performance optimization, shader optimization and balancing tasks between the CPU and GPU - much closer to hardware level of concern - hardly anything to do with a particular game. Such a complex setup works well for larger studios as they can separate the concerns of each department in different layers.


When people say "real game developers use C++", they aren't giving you the full picture. Most indie developers should not need this level of sophistication. Building games of Mario / Galaga level of complexity on the studio setup is actually a huge waste of time and talent. It makes sense for games like Call of Duty - something that pushes the limits of visuals and technology with hundreds of people on the team. I've known many people who wanted to make a full-fledged FPS or RPG on their own - and these projects go on for years with very little progress. So don't let someone else dictate what programming language or tool you "must" use in order to be "cool".


Just some thoughts.

#5199279 I need help with some maths

Posted by djtesh on 20 December 2014 - 12:27 PM

Seems like you are not normalizing correctly.


You want to move "r" units from "p" in a direction that points towards "t". Directions are always normalized (unit vectors), so that they make sense when moving any amount of units along them (even fractions).


Check that and try again.

#5195443 Unity or C++?

Posted by djtesh on 29 November 2014 - 11:20 PM

I agree with Nypyren's reply.


Also wanted to add that award winning games and studios are also using Unity for complete games.

Think Monument Valley and Hearthstone.


Time is a resource. The quicker you can prototype your game ideas, the more likely you are to spend the time to polish them.

C++ is great for truly learning how programming works at a deeper level, but you should decide what is more important - your programming ability or the product / game.

#5192556 Newbie Game Dever

Posted by djtesh on 12 November 2014 - 07:17 PM

Welcome and good luck ahead!

#5187919 Percentage Health (100%) vs. Numbered Health (100/100)? Which ones better?

Posted by djtesh on 18 October 2014 - 09:31 PM

Consider from the player's perspective, given your own game's design. What's the most beneficial thing to show and what's redundant? Also, which combination leads to the most "fun"? Sometimes, the absence of information can heighten the tension.


Think for a little while and I'm sure you'll get arrive at the answer. If you still aren't sure, let some people play it both ways and tell you.


There's no universal truth to such UI and game design.

#5177099 unity monthly subscription question?

Posted by djtesh on 30 August 2014 - 01:20 PM

Sorry but the Unity3D subscription membership is for a minimum of 12 months.

#5172911 Can't solve problems without googling?

Posted by djtesh on 11 August 2014 - 03:12 PM



This is a very interesting conversation to have! I've been programming for over 10 years. I really enjoy it and the feeling of wanting to improve persists! Here are some things I've found:


#1) Most regular professional jobs are results oreinted. They really do not care if you've written the best search algorithm or the most optimized string parsing routine. You can get into trouble as you are bombarded with deadlines, and tasks cannot be consistently challenging. Here, it is very common to be an OK programmer and do well with a bit of politics. To do the really good stuff, you'll have to turn to #2. If you have a burning desire to do cutting edge things, steer your career away from jobs that don't need it.


#2) A lot of great programming achievements were started as pet projects / hobby projects. These are the projects that someone really cared about intensely, and found the time and energy to devote to something exceptional. Never stop making stuff on your own.


#3) There are a few exceptionally rare companies that try to build the very best libraries themselves, and then release them to the world. For example, Twitter with Bootstrap, Google with AngularJS and their plethora of tools and Apple with their various frameworks that they provide to App developers. You can make decent money if you find yourself at one of these coveted companies. Microsoft and Facebook have really really smart people too, and there may be many companies that could have exceptional teams. Finding these hidden gems can be difficult.


#4) Finish stuff. Today you have so many avenues to see if people care about what you made. App Stores, GitHub just to name a few. Let people play with or use the things you make. The art of finishing is lost on many (including myself for so many years). It is hard to learn the really valuable stuff that a real life use will teach if you can't finish your projects. Start small if you have to. Find passionate teammates before attempting massive stuff.


#5) If you have the time, take great open source projects and make them better. The world will thank you for it. I will thank you for it!


If you are not a naturally great problem solver - or if you don't know, the best path is to join a place with REALLY smart people. You'll see their tricks, their way of thinking and you will learn quickly.


Ok I'll stop here for now. Let's see what others have to say.


Best Regards,


#5115412 What Language or Languages for Web and Mobile Apps

Posted by djtesh on 08 December 2013 - 12:14 PM

I recommend Unity3D for what you want to do, as it can do PC, Mobile and Web with the same game scripts so you won't have to rewrite after that.


Polish, test and release your games. Then, sell it for Windows 8 & Surface RT, Windows Mobile, and Android. When you make some money from them (by selling them in the respective App Stores), invest in a Mac Mini and iPod Touch (cheapest entry into the Apple world) and you've got a full studio for all the platforms you want to hit. One of the best ways to score Apple gear for less is to look at the Apple Store online in the "Refurbished & Clearance" link. You'll save 20% or more.


Wish you the very best. Writing and selling multi-platform games can be very fulfilling :)

#5089073 passing std::shared_ptr to a function?

Posted by djtesh on 25 August 2013 - 10:27 PM

The problem with the code above is that after the function call, the shared pointer will end up with 0 references and destroy the object (as it is the ONLY shared pointer to own that object).



If you would like to pass in a shared_ptr but keep the object alive, store your member as a shared_ptr and then pass it in to the function like so:

void NBodySim::DrawCSOutput(std::shared_ptr<NBody::Renderer> graphics)

			RECT destRect;
			destRect.left = 0;
			destRect.right = 256;
			destRect.bottom = 256;
			destRect.top = 0;

			graphics->SBatch->Draw(this->uavSrv, destRect);

		catch(std::exception e)
			const char *wat = e.what();
			int i = 0;

//DrawCSOutput() is called like this:

//this is the graphics member variable:
std::shared_ptr<Renderer> graphics;

#5086854 C++ Lib with C# GUI

Posted by djtesh on 17 August 2013 - 02:54 PM

This might not be useful in all cases, but I have a game engine written in C++ and I wanted an editor in C# from the very beginning.


== My Approach ==


In my case, I use a library called SWIG to generate C# wrappers around C++ classes that I want to expose to an editor. It might take a long time to tweak the ".i" files so that the C# output is exactly what you want.


So, the typical setup is:


- Special build for Editor. First we run SWIG to generate C# wrappers and a master .cxx file that contains the DLL invoke receiver functions.

- Engine compiles to a DLL with regular C++ files and the .cxx file.

- Link in your DLL into the C# project as a reference.

- File link your C# files into the Editor C# project.


You'll need to keep them somewhat synchronized when you make changes to your C++ api. You can write many extensions on top of the C++ classes to bring in really nice C# functionality like reflection, properties etc.


== Second Approach ==


I did this in the past but it is Windows ONLY.


- A version of your C++ editor that properly compiles into a C++/CLI DLL.

- Use the DLL as a reference in your pure C# editor project.


Writing CLI compatible C++ code requires a lot of consideration though.


Hope this helps,