Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
New Server | HOMM1: info forum | HOMM2: info forum | HOMM3: info forum | HOMM4: info forum | HOMM5: info forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Other Side of the Monitor > Thread: The Programming Thread
Thread: The Programming Thread This thread is 3 pages long: 1 2 3 · NEXT»
LizardWarrior
LizardWarrior


Honorable
Legendary Hero
Age of erwins is over
posted February 19, 2017 06:41 PM
Edited by LizardWarrior at 16:50, 22 Feb 2017.

The Programming Thread

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

________________________________________________________________________
Why is this not a thing yet? I have seen plenty of people programming around here, either for mods as a hobby or for their daily job. Let's gather around and discuss computer programming, be it low level or high level, for either hobbyists or professionals. What languages do you got under your belt or plan to learn? What projects are you working on? Or maybe you are new to programming and need some advice. In short, this thread is dedicated to any kind of programming or scripting languages and anything that comes from them.
________________________________________________________________________

Hello world library

Java

public class Program
{

static public void main (String[] args)
 {
   System.out.println("Hello world");
 }

}


Python

print("Hello world")


C++

#include<iostream>

int main(int argc, char ** argv)
{
  std::cout<<"Hello World";

  return EXIT_SUCCESS;

}


C

#include<stdio.h>

int main(int argc, char ** argv)
{
  printf("Hello World");

  return 0;

}

_______________________________________________________________________

Object Oriented library

Java

public class Program
{

public static class Object
{
   public Object(int val)
   {
      value=val;
   }

   public int GetValue()
   {
      return value;
   }
   private int value;
}

static public void main (String[] args)
 {
    Object obj=new Object(10);
 }

}


Python

class Object:

  value=0
 
  def _init_ (self, val):
   self.value=val

  def GetValue(self):
     return self.value
   
obj=Object(10)



C++


class Object
{
 public:
  Object(const int& val):value(val)
  {}

  int GetValue()
  {
     return this->value;
  }

 private:
   int value;

};

int main(int argc, char ** argv)
{
  Object obj(10);

  return EXIT_SUCCESS;

}


C

//C doesn't support OOP, but there are structs
#include<stdio.h>

typedef struct Object_
{
 int value;
} Object;

int main(int argc, char ** argv)
{
   Object obj;
   obj.value=10;

   return 0;
}

_____________________________________________________________________

My top 10 favorite data structures (no particular order)
+ Dynamic Arrays/(C++)Vectors (gotta love them)
+ Red Black Trees (very good for lots of insertions, AVLs are more balanced tho')
+ Hash Tables  (when you have no idea what to use, use hash tables )
+ Rank-Paired Heaps (efficient A* FTW)
+ Raddix-Trie (efficient word search)
+ Monte Carlo search tree (games and stuff)
+ XOR lists (can't get a more geeky list)
+ Stacks (love them unless they overflow)
+ Undirected Graphs (3D models duh)
+ Tuples/Pairs and all the jazz (the last, but not the least)
_____________________________________________________________________

So, what languages, do you guys know and use? I personally know Java, C++, Python and a little of Assembly x86 NASM/MASM. Also at the moment I'm working on a 3D model viewer with OpenGL and WINAPI (though I'm using C++).
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Galaad
Galaad


Honorable
Undefeatable Hero
Enrothian Conservative Party
posted February 19, 2017 06:46 PM

Was Erwin really necessary?
____________
#Give JVC Might and Magic rights back!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Geny
Geny


Responsible
Undefeatable Hero
of nastiness
HC SUPPORTER
posted February 19, 2017 06:46 PM

You mean this?
____________
geny is a meanie - fred79

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
LizardWarrior
LizardWarrior


Honorable
Legendary Hero
Age of erwins is over
posted February 19, 2017 06:49 PM
Edited by LizardWarrior at 19:12, 19 Feb 2017.

That thread is lame, this thread rocks.

edit: Seriously? Bashing visual studio? Praising MinGW? Wtf is with that garbage thread.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Galaad
Galaad


Honorable
Undefeatable Hero
Enrothian Conservative Party
posted February 19, 2017 06:50 PM

That one on the other hand seems good?
____________
#Give JVC Might and Magic rights back!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Galaad
Galaad


Honorable
Undefeatable Hero
Enrothian Conservative Party
posted February 19, 2017 06:52 PM

LizardWarrior said:
So, what languages, do you guys know and use? I personally know Java, C++, Python and a little of Assembly x86 NASM. Also at the moment I'm working on a 3D model viewer with OpenGL and WINAPI (though I'm using C++).


I know no languages at all and feel like I'm completely retarded everytime I try to get some sense in there, but I might ask for advice here if I ever motivate myself for Python.
____________
#Give JVC Might and Magic rights back!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
LizardWarrior
LizardWarrior


Honorable
Legendary Hero
Age of erwins is over
posted February 19, 2017 06:54 PM

You should mate, Python is a good choice for beginners, you can learn the basics in a week then jump directly into GUI.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Galaad
Galaad


Honorable
Undefeatable Hero
Enrothian Conservative Party
posted February 19, 2017 06:55 PM

Yeah what seduces me with Python, other than is considered an easy language, is that since I do 3d as hobby at times I could create scripts to run in Python, since Blender offers that possibility.
____________
#Give JVC Might and Magic rights back!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
LizardWarrior
LizardWarrior


Honorable
Legendary Hero
Age of erwins is over
posted February 19, 2017 07:20 PM

You can use python scripts with Maya and 3DS Max too. For 3DS max I use now C++ with SDK and MFC, it's lower level than python.

Galaad said:
Was Erwin really necessary?


yes, it's part of my 3d model viewer I'm working now Next I need to implement some good anti-aliasing algorithm and find a way to organize the textures into the shaders

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Neraus
Neraus


Supreme Hero
Emperor of the Bromans
posted February 19, 2017 07:40 PM

I believe you've grown an unhealthy fascination with that model lizard, you're scaring me...
____________
Wait, where is my clever punchline?

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Geny
Geny


Responsible
Undefeatable Hero
of nastiness
HC SUPPORTER
posted February 19, 2017 08:20 PM

Galaad said:
That one on the other hand seems good?

Makes sense. Dimis knew what he was doing.
____________
geny is a meanie - fred79

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
EnergyZ
EnergyZ


Legendary Hero
President of MM Wiki
posted February 19, 2017 08:57 PM

Yeah, snake language is good to begin with. I recall the first time I met up with C. It was terrible, but on the second try, I learned most  out of it.

But still, using those pointers is a hell of a job. And what also annoys me if that if you miss a single ";" character, the program won't run at all.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
LizardWarrior
LizardWarrior


Honorable
Legendary Hero
Age of erwins is over
posted February 19, 2017 09:31 PM
Edited by LizardWarrior at 21:34, 19 Feb 2017.

Neraus said:
I believe you've grown an unhealthy fascination with that model lizard, you're scaring me...


Sorry H7 scarred me for life

EnergyZ said:
Yeah, snake language is good to begin with. I recall the first time I met up with C. It was terrible, but on the second try, I learned most  out of it.

But still, using those pointers is a hell of a job. And what also annoys me if that if you miss a single ";" character, the program won't run at all.


C is a pretty difficult language to start with. It originally was planned to be a more friendly (higher level) version of assembly, in order to actually use C to its full extent you need to be aware of the memory model. C++ has made pointers more safe with smart pointers (first std::auto_ptr, then std::unique_ptr, std::shared_ptr and std::weak_ptr), still ownership is a challenging concept for a beginner, so C and C++ aren't a good choice for a beginner. I know that universities use C as an introductory language, but what they teach is generally very abstract and not enough for dabbling at the level C should be used.

As for semicolons, never had a problem with them. Personally I don't have a problem forgetting them, but even so, the compiler and the IDE will signal you, for example Visual Studio and Eclipse will highlight such syntax errors in real time, so there's no way to forget them.

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
EnergyZ
EnergyZ


Legendary Hero
President of MM Wiki
posted February 19, 2017 11:07 PM
Edited by EnergyZ at 23:09, 19 Feb 2017.

LizardWarrior said:

As for semicolons, never had a problem with them. Personally I don't have a problem forgetting them, but even so, the compiler and the IDE will signal you, for example Visual Studio and Eclipse will highlight such syntax errors in real time, so there's no way to forget them.



I know. It's just very annoying, however, that after nearly each piece of code you need to put that semicolon. After you start testing the code, it doesn't even ignore that error and if you add the semicolon, it starts to point out the other errors it didn't before. Python doesn't have any of that, thankfully.

As for C++, I had it this year. It wouldn't be much of a problem if we had some homework to do. The only thing we could learn from are the professor's notes and a script that had 12 tasks, one for each lesson. And those tasks were very hard to finish.

Luckily, I barely managed to pass. That object oriented programming is a bane to the people, a lot of students from my colleague cannot pass it.

Speaking of which, is Java easier to learn? Or C#? I am supposed to take one of these classes (including C++).
____________
Come and visit the Might and Magic Wikia!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
LizardWarrior
LizardWarrior


Honorable
Legendary Hero
Age of erwins is over
posted February 19, 2017 11:20 PM
Edited by LizardWarrior at 23:24, 19 Feb 2017.

I'm a hobbyist programmer and with C++ OOP I have had most fun I gotta say Well, they are mostly the same (I personally use Java), Java and C# OOP are easier to learn than C++'s, at least from my experience. In C++ you will need copy and move constructors (and operators), you need to be sure you don't make shallow copies, as well as taking care of memory management via destructors (though smart pointers make this easier). In garbage collected languages, this is easier, especially since both Java and C# embrace OOP to its fully extent. Also, it's good to note that instead of interfaces, in C++ you need to use pure abstract classes.

Between Java and C#, if you want cross platform, go Java all the way, C# monochrome is slooooooooow as sh1t. But for windows, C# is pretty good. Another piece of trivia is that C# appeared after Microsoft got sued by Sun Microsystems for not implementing Java correctly in the late 90's and thus C# was born in 2000, most probably as a Java replacement
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
EnergyZ
EnergyZ


Legendary Hero
President of MM Wiki
posted February 19, 2017 11:29 PM

I'll keep that in mind. Hopefully the Java class will be available, since there is a limit how many students can attend it. And I'd rather not go to C++, since it is held by the same guy as before, and passing that class was pure luck to me, I say.
____________
Come and visit the Might and Magic Wikia!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
NimoStar


Promising
Famous Hero
Modding the Unmoddable
posted February 21, 2017 09:29 AM

And they said there were no programming people in the forum...

BTW, I only ever actually programmed in Turbo Pascal :v

And hex editing assembly
____________
CLICK on the image to discover H4 Greatest Mod!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
LizardWarrior
LizardWarrior


Honorable
Legendary Hero
Age of erwins is over
posted February 21, 2017 10:39 AM
Edited by LizardWarrior at 22:37, 02 May 2017.

As you see, not enough programmers This thread should have gotten more attention (I think it needs more erwin heads )

Never used Pascal myself, but most h3 tools made by Grayface were done in Delphi and I've never had problems with them. Anyway, it's way easier to learn more languages if you already used one before. And hex editing assembly is hardcore, dude
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted February 21, 2017 01:31 PM

LizardWarrior said:
And hex editing assembly is hardcore, dude


It's also a ton of fun to figure out how it works - and then manipulate it . In that way, I actually once managed to introduce a new variable assignment and use that new variable a bit further, within the existing code. Was something in the map generation routine within X-Com2: Terror from the Deep. Kinda cool that it actually worked too .

That as an aside, I got a college course in Turbo Pascal, then taught myself C++ (though mostly on the surface) and currently I mostly program stuff in Excel's VBA. It's kinda fun to do.

I remember having a lot of fun with Heroes 5's script editor too.
____________
The last Reasonable Steward of Good Game Design and a Responsible Hero of HC. - Verriker

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
frostysh
frostysh


Bad-mannered
Famous Hero
WHY?
posted February 22, 2017 02:54 PM
Edited by frostysh at 14:58, 22 Feb 2017.

From what books is better to start self education by a motto "How machines works?", the field of interests is deep understanding of structure of computers and stuff. Of course, will be amazing if those stuff can bring some money in the future. Coz' I have no any money per month for now

Basically I am interested in the Physics, Cybernetics, Machine-stuff, Neurology, AI, etc.

Thanx for the answers.
____________

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 3 pages long: 1 2 3 · NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0564 seconds