Page 1 of 2

The Calandiel/David joint plan.

Posted: Tue Aug 29, 2017 4:47 am
by David Buunk
This is the plan that Calandiel and I came up with during some lengthy discussions. We hope that Demian weights in and approves it.

The code for SotE will be split in two parts, one dealing with the simulation, the other with the user interface. The simulation code will be written in C++, compiled into a dynamic library (for those used to the Windows term, a dll), and then loaded and used from the interface part. The user interface will be written in C# and Lua, and will be using Unity as game engine.

This has a number of advantages:
  1. C++ written code can run faster and with less memory overhead than C# code. The simulation code will be by far the most demanding on those things.
  2. The interface code will have all the benefits of C#. Think of such things as no dangling pointer bugs, and garbage collection preventing memory leaks.
  3. We can use Unity as game engine. Which means we have all the benefits thereof, without the drawbacks of having to work in C#.
  4. There is a clear, enforced, division between simulation and interface code. This will help keeping the code understandable, and bug-free.
  5. Development of the simulation code can take place on Linux, even though Unity doesn't support Linux as a platform for development.
  6. Calandiel can use his strengths in helping develop, as he's good in working with C# and Unity.
  7. I, too, can use my strengths in helping develop, as I'm good with C++.
Comments and questions greatly appreciated.

Re: The Calandiel/David joint plan.

Posted: Tue Aug 29, 2017 11:09 am
by Demiansky
Sounds like a good long term objective, but a few questions: when did you think the best time to implement was? Also, what's the advantage of Linux? Never used it myself.

Re: The Calandiel/David joint plan.

Posted: Tue Aug 29, 2017 11:16 am
by David Buunk
Demiansky wrote:
Tue Aug 29, 2017 11:09 am
Sounds like a good long term objective, but a few questions: when did you think the best time to implement was?
Last week.
Demiansky wrote:
Tue Aug 29, 2017 11:09 am
Also, what's the advantage of Linux? Never used it myself.
Too many to list here.

Re: The Calandiel/David joint plan.

Posted: Tue Aug 29, 2017 4:46 pm
by Demiansky
Okay, so it sounds "ideal" but not necessarily initially practical for me, because it sounds like having to halt the learning process, learn Linux, learn C++, learn how to adapt it to Unity, and then dealing with anything else along the way that was unanticipated. I know you would like to go full steam ahead, but I'm still getting comfortable with some of the fundamental principles of CS and OOP.

Re: The Calandiel/David joint plan.

Posted: Wed Aug 30, 2017 3:11 am
by David Buunk
Demiansky wrote:
Tue Aug 29, 2017 4:46 pm
learn Linux
Eh, no. This set-up is such that it makes development of simulation code possible on Linux, but not necessary. You can perfectly well keep using Windows.
Demiansky wrote:
Tue Aug 29, 2017 4:46 pm
learn C++
It's quite similar to C#.
Demiansky wrote:
Tue Aug 29, 2017 4:46 pm
learn how to adapt it to Unity
The entire set-up, and all adaptation-issues would be dealt with by Calandiel and me.

Re: The Calandiel/David joint plan.

Posted: Wed Aug 30, 2017 4:57 pm
by Demiansky
Okay, so Linux possible rather than Linux mandatory. I'm wondering though how one uses C++ with Unity. I think I remembering reading that there was a pluggin or something to that effect, but also heard that there were a few confounding issues. Granted, I haven't done a heck of a lot of research on it.

Re: The Calandiel/David joint plan.

Posted: Wed Aug 30, 2017 5:03 pm
by David Buunk
Demiansky wrote:
Wed Aug 30, 2017 4:57 pm
Okay, so Linux possible rather than Linux mandatory.
Yes, and that's so that I can actually help you with coding...
Demiansky wrote:
Wed Aug 30, 2017 4:57 pm
I'm wondering though how one uses C++ with Unity.
As I described above: compile the C++ code into a DLL, and use that from the interface code (which is in C# and uses unity).
Demiansky wrote:
Wed Aug 30, 2017 4:57 pm
I think I remembering reading that there was a pluggin or something to that effect, but also heard that there were a few confounding issues
I think that that is a way of doing the interface code, which needs unity, in C++. We suggest no such thing, merely that the simulation code, which does not need unity, is written in C++.

Re: The Calandiel/David joint plan.

Posted: Wed Aug 30, 2017 7:14 pm
by Demiansky
David Buunk wrote:
Wed Aug 30, 2017 5:03 pm
Demiansky wrote:
Wed Aug 30, 2017 4:57 pm
Okay, so Linux possible rather than Linux mandatory.
Yes, and that's so that I can actually help you with coding...
Demiansky wrote:
Wed Aug 30, 2017 4:57 pm
I'm wondering though how one uses C++ with Unity.
As I described above: compile the C++ code into a DLL, and use that from the interface code (which is in C# and uses unity).
Demiansky wrote:
Wed Aug 30, 2017 4:57 pm
I think I remembering reading that there was a pluggin or something to that effect, but also heard that there were a few confounding issues
I think that that is a way of doing the interface code, which needs unity, in C++. We suggest no such thing, merely that the simulation code, which does not need unity, is written in C++.
Well, yeah, but I'm trying to envision how compiling C++ into a DLL plays out during the actual development process. So if I'm working in Visual Studio or monodevelop, does it automatically compile each time I punch the button to play the game? Or is there some intermediary process?

Re: The Calandiel/David joint plan.

Posted: Thu Aug 31, 2017 2:42 am
by David Buunk
When developing the simulation code, you hit the "build" button, which figures out what needs to be recompiled, re-compiles that, puts the dll in the right place. Then you start the game to test.

When developing the interface code, it would work just like now.

Re: The Calandiel/David joint plan.

Posted: Thu Aug 31, 2017 11:01 am
by Demiansky
Alright, doesn't sound too complicated. Maybe I'll write a little more code in C# and then make the switch. It might sound like a waste, but I kinda want to be able to rewrite a nice chunk of the code in C# as a means to practice.