Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 13 Sep 2012
Offline Last Active Yesterday, 10:13 PM

#5224335 is it possible to program one app with different languages?

Posted by ByteTroll on 19 April 2015 - 12:47 PM


Yes it's possible and common to use multiple languages.


 can you explain a little more. just an example how really it works?


for exmple how a python code uses output of a c# function. should it be a compiled library code or it can be simply done?



I find myself doing this all the time; hell, I am doing it as we speak.  For example,  I have an old piece of software that needed to target Android, PC, and iOS.  Since I created the app on Android, the program was in Java.  When I ported it to PC, I decided to stick with Java.  When I ported it to iOS, I had to recode the app using Objective-C.  The Android and PC version of the app shared almost the same code base, with the exception of a select few platform specific parts.  The iOS version used the same ideals as the other two platforms, but was a completely new code base.


EDIT:  I just looked over your last post again, and I believe you are confusing the use of multiple languages.  What you are referring to "FFI."  The language has to support calling functions from other languages; for example, C# offers the ability to call native functions from managed code.  For example, with C# calling C++, the C++ code has to be coded in a specific way and compiled using CLR.  You then hook the DLL in C# and bind your routines.


Here is some more information.


#5223646 Why high level languages are slow

Posted by ByteTroll on 16 April 2015 - 05:45 AM

I still contend that if you're going to use a GC language, then you need to play nice with the GC

I'm curious if you have you tried doing this on a large scale?

I've spent an awful lot of time the last couple of years refactoring swathes of Java code (or porting it to C++), to reach the 'zero allocations' bar that one absolutely must hit if one wants a fluid and responsive android application. I'm not kidding about this - you will not be able to reliably hit 60fps if there are any allocations in your rendering or layout loops. And Java doesn't have struct types, so that means no short-lived compound types at all...
Sadly, this is 100% true. I just finsihed having to optimize both my Android rendering and layout loops for this very reason.

#5222335 An engine to use with teens with no programming knowledge

Posted by ByteTroll on 09 April 2015 - 06:26 PM

If you are looking for something with a visual scripting language, I would take a look at Unreal 4.  Epic just made it free for everyone and it has a visual scripting setup called "blueprints" that does an amazing job.

#5220819 I have one question about drawing ball in football game

Posted by ByteTroll on 01 April 2015 - 05:06 PM

You need to apply an alpha channel/background (or solid color depending on your 2D code).

#5219988 wanting feedback on two design ideas

Posted by ByteTroll on 29 March 2015 - 11:26 AM

I'm about five books away from a proficiency in python

Where do you get this idea from. You don't become proficient in programming by reading books.

#5219987 working with newtonsoft json

Posted by ByteTroll on 29 March 2015 - 11:19 AM

I used Newtonsoft JSON in a previous project. I am on my phone right now, but if you still need help, shoot me a message and I can point you in the right direction.

#5219157 Why didn't somebody tell me?

Posted by ByteTroll on 25 March 2015 - 02:54 PM


Also, my wife just informed me that the song "Take me to church" is about secret sex stuff.  Whaaaaaaat?




Literally, I just found that out the other day.  Call me naive, but I actually thought the song was about going to church!

#5218163 is this possible to access winform members with static function?

Posted by ByteTroll on 21 March 2015 - 05:24 PM

There isn't an ideal solution to this problem. The nature of static is that it is created at runtime, first and generally exists for lifetime of the program. Static can be called in a non static as it is gaurnteed to exist, but non static cannot he called from static because it will non exist at creation time.

#5216629 is it possible to prevent a proggram(specialy a game) to get decompiled

Posted by ByteTroll on 15 March 2015 - 08:55 AM

Not a snowballs chance in hell.  Golden rule: if the binaries reside on a client machine, it is as good as dead.  There are ways to slow down scriptkidies, but anyone with a working knowledge will always get around those roadblocks.  Besides, those roadblocks don't do any good anyways.  All you end up doing is hurting the people that actually pay for your product.

#5216560 How to Acess a singleton from everywhere?

Posted by ByteTroll on 14 March 2015 - 10:43 PM

I don t see how it's easier. You have a memory leak and are unsure how to utilize the singleton pattern.
1) The answer is obvious once you understand the singleton pattern.
2) This is the problem with singletons and why you're being guided away from them. The order of initialization is not absolute.
3) I don't quite understand this question.
4) This is the opposite of the design pattern you're using.
Simply put: inside of the singleton class you would use your members. Outside you would use GetInstance().
In my opinion singletons shouldn't be avoided at all costs, but it's not the greatest choice here.
In the end you're attempting to use a pattern that causes a lot of problems without understanding it or the problem it causes.


before use singletons i was defining every manager (renderer, core, objmanager) like a static object. I was getting some errors.
From the book "game engine architecture" I read how to implement this managers, and the author used singletons, so this is why I used them.-_-

Give me an example on how implement a class with a static object, and maybe I will be convinced. :cool:
I do this all the time. I always prefer the use of static pointers with strict control to the Singleton pattern.

EDIT: as for an example on how, go look at the doom 3 source code. Static pointers are the preferred way in that code base.

#5216559 Why learn game programming?

Posted by ByteTroll on 14 March 2015 - 10:37 PM

I think your first misconception is that there's a difference between programming in an engine like Unity or Unreal and "game programming" when you use a library like SDL or write your own low-level engine. There's not a whole lot of difference in how you program, just in what you're programming. Writing a game from scratch uses the same programming techniques, but you're using them to write things like file loading code or vector math or whatever your libraries don't cover, plus the gameplay code.

+1 for this reply.

#5216465 Why learn game programming?

Posted by ByteTroll on 14 March 2015 - 11:45 AM

The fact of the matter is if you want to program you have to learn how to program. You can't play an instrument without learning; programming
is no different

Even if you use an existing and established toolset, you are still going to have to write a ridiculous amount of code. You are either going to have to pay someone who knows how to code or learn how to code yourself.

#5216394 Why learn game programming?

Posted by ByteTroll on 13 March 2015 - 11:47 PM


I was thinking, why learn game programming when I can just jump into an engine like Unreal,Unity or game maker and create games really fast?
What advantage do I get from learning c++ and then using SDL to create a game, over using something like Unreal.

Unreal, Unity, etc games still require programming...



Unreal still requires a working knowledge of C++.  Unity requires a working knowledge of C# or JavaScript.  Sooner or later you are going to hit a problem where something like Unreal's Blueprint system won't be able to do what you need it to or you find that you need to extend or add to it.  At that point, you are diving head first into code.

#5216382 Compilation errors from Visual Studio 2010 visual C++ compiler

Posted by ByteTroll on 13 March 2015 - 10:06 PM

From what I can tell, you are trying to create a console application from a Win32 project.  The compiler is looking for "INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, INT )," but can't find it.  Thus, it is telling you that it can't find the Win32 entry point.  As "Nypyren" said, create a console application or go into properties and change the system to console.

#5215463 Returning a true in a function that has a bool return type

Posted by ByteTroll on 09 March 2015 - 12:31 PM

Depending on your environment another possibility is that you have a situation where the source code doesn't actually match the object code you're debugging. In that case a full rebuild may eliminate some weirdness. 


This happens a lot; especially under Windows with Visual Studio.  Do a clean and rebuild.