Pokémon X and Y Fan Community
March 28, 2024, 08:58:23 pm
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
  Home Help Search Arcade Gallery SHOUTBOX Staff List Calendar Members Login Register  

Programming Thread

Pages: 1 ... 4 5 [6] 7 8 ... 12
  Send this topic  |  Print  
Author Topic: Programming Thread  (Read 3238 times)
0 Members and 2 Guests are viewing this topic.
Shihen
Magical Misdreavus
****

Level: 5
Offline Offline

Posts: 126


View Profile WWW
Badges: (View All)
« Reply #75 on: December 18, 2012, 01:47:50 pm »

Actually, HTML5 may be young but it's growing exponentially. A few people I know are making a living off HTML5 games because they jumped in with it very early.

I finished my entry for Ludum Dare yesterday, I entered the 72 hour jam as I slacked too much and didn't finish in time for the 48 hour run.
My first released game in Java and I even ported it to an applet after an hour of battling the signing process... http://harrk.com/applets/LD25/
Report Spam   Logged

klondikebar
Global Moderator
Malevolent Murkrow
*****

Level: 44
Offline Offline

Posts: 2977


View Profile
Badges: (View All)
« Reply #76 on: December 18, 2012, 02:01:15 pm »

Actually, HTML5 may be young but it's growing exponentially. A few people I know are making a living off HTML5 games because they jumped in with it very early.

I finished my entry for Ludum Dare yesterday, I entered the 72 hour jam as I slacked too much and didn't finish in time for the 48 hour run.
My first released game in Java and I even ported it to an applet after an hour of battling the signing process... http://harrk.com/applets/LD25/

Very cool! And that only took you a few days?
Report Spam   Logged
Shihen
Magical Misdreavus
****

Level: 5
Offline Offline

Posts: 126


View Profile WWW
Badges: (View All)
« Reply #77 on: December 18, 2012, 02:02:34 pm »

Very cool! And that only took you a few days?
Three days, would have been two if I didn't decide to slack Tongue (I visited the Science Museum in London on Saturday!)
Report Spam   Logged

klondikebar
Global Moderator
Malevolent Murkrow
*****

Level: 44
Offline Offline

Posts: 2977


View Profile
Badges: (View All)
« Reply #78 on: December 18, 2012, 03:31:38 pm »

Three days, would have been two if I didn't decide to slack Tongue (I visited the Science Museum in London on Saturday!)

Well, I'm having another look at Java. The book "Head First Java" is actually hilarious (in a good way).
Report Spam   Logged
Shihen
Magical Misdreavus
****

Level: 5
Offline Offline

Posts: 126


View Profile WWW
Badges: (View All)
« Reply #79 on: December 18, 2012, 03:41:06 pm »

Well, I'm having another look at Java. The book "Head First Java" is actually hilarious (in a good way).
I saw that book in Waterstones as I like to look at their display of computer books, never considered buying it though :p
Might have another look at it now that you've mentioned it.

Oh the language jumping phase - how you gotta love it.
Report Spam   Logged

klondikebar
Global Moderator
Malevolent Murkrow
*****

Level: 44
Offline Offline

Posts: 2977


View Profile
Badges: (View All)
« Reply #80 on: December 18, 2012, 05:03:34 pm »

@Shihen

Yeah, language jumping is a fun time, because I don't care what I'm learning. And the book is really great, it's very humorously written so it's fun to read, but it still teaches well. Great reviews too.
Report Spam   Logged
Aperl
Eccentric Elgyem
**********

Level: 20
Offline Offline

Gender: Male
Posts: 1005


View Profile
Badges: (View All)
« Reply #81 on: December 19, 2012, 06:08:48 am »

I'm almost never buying books for my courses, it's quite funny because I'm still one of the best students in my program when it comes to grades ^^.
I have Starting Out With Java - From Control Structures Through Object, and Absolute Java. Haven't looked at them for years.

And I borrowed C++ for Dummies from my library Wink.

@Sato last post of the previous page, if you haven't seen it already:
I'm honestly not sure what to pick between C# or C. C# has XNA, C has Allegro, and it'll make it easier for me to learn C++ (which I want to do eventually, but not in the near future). Thoughts? Most people would say C as it makes it easier to learn everything else.

Also, I've come up with a fun idea for a new Python text game, so I'm happily planning it. InDev title is "Dark Adventure".
I would suggest C# because you won't have to deal with explicit memory allocation and pointers when you don't want to.

Personally, my learning process in programming (suggested by school) was to start with Java, then give a try to Visual Basic .NET and then start C#. Java has a very consistent and legible syntax and logic, and it takes minutes to write a working application. Visual Basic was just to apply what we know in a less instinctive syntax, while introducing the .NET framework. Then C# combines the .NET framework with Java-like syntax.

For having tried C for a networking class, I know it makes simple functions extremely complex because you have to constantly think about what to do with the objects and variables you create. Errors pop up and you can't understand a thing they say because they target the problem at a totally legit line while the problem started dozens of lines before.

C++ made things a bit more instinctive with object-oriented programming, but you still need to deal with pointers and a bit of memory allocation.

C# has all functions combined. You can use some keywords (ref and const) to use dynamic pointers and thus allow multiple return values for functions (great advantage over Java), you can explicitly manage memory, but it's optional. Event management is incredibly simple and strong. You can use properties rather than getter/setter functions, so when you say myChild.Age = -10; it can validate the data and throw exceptions if needed, while in Java you'd need to do myChild.setAge(-10);.

I would also say that Java is a safe bet, it has loads of libraries available, I still use Java to create games and applications, except the independent project I'm working on, where we use C#.
Report Spam   Logged

WHy do i have a feeling your going to be the serious wise man of the forum Tongue
D:< I hate you! That made WAY to much sense.
Shihen
Magical Misdreavus
****

Level: 5
Offline Offline

Posts: 126


View Profile WWW
Badges: (View All)
« Reply #82 on: December 19, 2012, 09:14:39 am »

I'm almost never buying books for my courses, it's quite funny because I'm still one of the best students in my program when it comes to grades ^^.
I have Starting Out With Java - From Control Structures Through Object, and Absolute Java. Haven't looked at them for years.

And I borrowed C++ for Dummies from my library Wink.

@Sato last post of the previous page, if you haven't seen it already:I would suggest C# because you won't have to deal with explicit memory allocation and pointers when you don't want to.

Personally, my learning process in programming (suggested by school) was to start with Java, then give a try to Visual Basic .NET and then start C#. Java has a very consistent and legible syntax and logic, and it takes minutes to write a working application. Visual Basic was just to apply what we know in a less instinctive syntax, while introducing the .NET framework. Then C# combines the .NET framework with Java-like syntax.

For having tried C for a networking class, I know it makes simple functions extremely complex because you have to constantly think about what to do with the objects and variables you create. Errors pop up and you can't understand a thing they say because they target the problem at a totally legit line while the problem started dozens of lines before.

C++ made things a bit more instinctive with object-oriented programming, but you still need to deal with pointers and a bit of memory allocation.

C# has all functions combined. You can use some keywords (ref and const) to use dynamic pointers and thus allow multiple return values for functions (great advantage over Java), you can explicitly manage memory, but it's optional. Event management is incredibly simple and strong. You can use properties rather than getter/setter functions, so when you say myChild.Age = -10; it can validate the data and throw exceptions if needed, while in Java you'd need to do myChild.setAge(-10);.

I would also say that Java is a safe bet, it has loads of libraries available, I still use Java to create games and applications, except the independent project I'm working on, where we use C#.


I really don't like .NET or C#, I admit that pointers would be a great advantage but I can live without :p When you say myChild.age =- 10;, you can do that in Java by simply making a property public. I doubt you missed something like that out as you're a Java veteran so I'm guessing you're referring to Java's good coding practices when you mention that? As for the exception handling, I don't really see an issue there; can easily wrap in try/catch blocks.

Providing that the code behind myChild.setAge(-10); is only just:
Code:
public void setAge(int age){
this.age = age;
}

Overall, C# isn't as portable for my liking. I've never looked into it much and when I did I jumped right into XNA. Honestly my main put-off is the fact that Microsoft is directly behind it, so there's going to be some unfair competition control going on (like Apple is with Objective-C). MonoDevelop makes it look promising to me though. But maybe another time for me.
Report Spam   Logged

Aperl
Eccentric Elgyem
**********

Level: 20
Offline Offline

Gender: Male
Posts: 1005


View Profile
Badges: (View All)
« Reply #83 on: December 19, 2012, 10:06:14 am »

I really don't like .NET or C#, I admit that pointers would be a great advantage but I can live without :p When you say myChild.age =- 10;, you can do that in Java by simply making a property public. I doubt you missed something like that out as you're a Java veteran so I'm guessing you're referring to Java's good coding practices when you mention that? As for the exception handling, I don't really see an issue there; can easily wrap in try/catch blocks.

Providing that the code behind myChild.setAge(-10); is only just:
Code:
public void setAge(int age){
this.age = age;
}

Overall, C# isn't as portable for my liking. I've never looked into it much and when I did I jumped right into XNA. Honestly my main put-off is the fact that Microsoft is directly behind it, so there's going to be some unfair competition control going on (like Apple is with Objective-C). MonoDevelop makes it look promising to me though. But maybe another time for me.
Actually, properties are not exactly variables. It's a way to control the integrity of data whilst avoiding to make explicit getters and/or setters.
Look at this piece of code in Java:
Code:
public class MyClass {
public int myAge = 10;
}
With that, you can simply write:
Code:
instance.myAge = 18;
But in that case, you could also set a negative age, which is an unacceptable value. Setting attributes public is a direct violation to encapsulation. Hence you need to control that:
Code:
public class MyClass {
private int myAge = 10;
public int getMyAge()
{
return myAge;
}
public void setMyAge(int myAge)
{
if(myAge < 0)
throw new IllegalArgumentException(
"Your age must be positive");
this.myAge = myAge;
}
}
Now everything is fine, you cannot do this anymore:
Code:
instance.myAge = 18;
because the attribute is not visible, the access modifier being private. You must thus use:
Code:
instance.setMyAge(18);
instance.setMyAge(-23);
And everything is working fine.
All good. But it's ugly. Making get's and set's, plus is's if you have boolean attributes, ex: isFinished().

C# found the right way to do it, in my opinion.
Let's start back with the class we had at first, let's assume it's in C#:
Code:
public class MyClass {
public int myAge = 10;
}
C# is same as Java, setting myAge to -10 will work, but shouldn't.
So we have two choices. Either go berserk with getters and setters and waste hours commenting every one of them, and then having to remember whether or not you have done it for every variable. Oooooor, you can use properties. Properties is declared as a variable, with a name convention as a class, and instead of being attributed a value, it is attributed a block of code, where you can specify the get and set conditions. The value reserved keyword takes the variable that is attributed in the set. Look at this marvelous piece of code:
Code:
public class MyClass {
private int myAge = 10;
public int MyAge{
get{
return myAge;
}
set{
if(value < 0)
throw new ArgumentException(
"The age must be positive.");
myAge = value;
}
}
}
Now, imagine you set up a variable that cannot be modified, just don't write a set. Or put the set private, it's also possible. The way to use it now is:
Code:
instance.MyAge = 18;
instance.MyAge = -10
And what's amazing too, is that you can use the gets and sets without even noticing it.
Look at that:
Code:
//My birthday!
myself.MyAge++;
And it totally works!
What is the Java code for that again?
Code:
//My birthday!
myself.setMyAge(myself.getMyAge+1));
Beauuuutiful... -_-
So no more setMyAge and getMyAge, you just use MyAge instead of myAge and all validation is done for you. You can even create properties for non-existing variables, just as you could have a getter in Java that does some calculation. I'm using properties everywhere, it would be so easy for Java to implement such feature.

Oh also in C#, you can specify the operators, so doing instance1 + instance 2 could actually result in something. Like in Java we have such functions:
Code:
if(myDate.compareTo(myOtherDate)>0)
myNewDate = myDate.addDate(myOtherDate);
In C# you can specify what ==, >, <, >=, <=. != does and what +, -, *, /, ^ may do as well. So the above statement could be translated as:
Code:
if(myDate > myOtherDate)
myNewDate = myDate + myOtherDate;

Though I'm still using Java more than C#, I still find C# has made everything more easy and beautiful. Also, even though they're only for Windows, I quite like having .exe files because some of my friends don't like when their computer asks for the permission to use Java to view my stuff. While an exe opens right away.

Oh, and Visual Studio is a marvel Cheesy
Report Spam   Logged

WHy do i have a feeling your going to be the serious wise man of the forum Tongue
D:< I hate you! That made WAY to much sense.
Shihen
Magical Misdreavus
****

Level: 5
Offline Offline

Posts: 126


View Profile WWW
Badges: (View All)
« Reply #84 on: December 19, 2012, 10:20:03 am »

(Won't quote as you wrote a lot there)

Ah, I see what you mean now. It was an interesting read and I see how you really prefer the way C# does it. I still think Java is well structured - it has its flaws but so do all languages. I still have an iso for Visual Studio on my computer, gotta love Dreamspark. I don't like what they've done to DS recently though; downloading downloaders to download a freaking program -.-. I usually pirate the software when I have to go through all that rubbish.

Thank God I still have the iso handy!

I really want to give C# a go now but meh, I'll wait. I'm past my language jumping phase since I landed on Java and I'm taking my time to master it before moving onto another language. (Not limited to University throwing random languages at us) Haha, next semester we start Java and OOP so that'll be a breeze Smiley
Report Spam   Logged

Aperl
Eccentric Elgyem
**********

Level: 20
Offline Offline

Gender: Male
Posts: 1005


View Profile
Badges: (View All)
« Reply #85 on: December 19, 2012, 12:40:54 pm »

(Won't quote as you wrote a lot there)

Ah, I see what you mean now. It was an interesting read and I see how you really prefer the way C# does it. I still think Java is well structured - it has its flaws but so do all languages. I still have an iso for Visual Studio on my computer, gotta love Dreamspark. I don't like what they've done to DS recently though; downloading downloaders to download a freaking program -.-. I usually pirate the software when I have to go through all that rubbish.

Thank God I still have the iso handy!

I really want to give C# a go now but meh, I'll wait. I'm past my language jumping phase since I landed on Java and I'm taking my time to master it before moving onto another language. (Not limited to University throwing random languages at us) Haha, next semester we start Java and OOP so that'll be a breeze Smiley
Well Java is still the language I'm using day to day, I find it easier to test things, I'm a lot more comfortable with it. I know the Java libraries probably 100x better than the .NET ones, and even when I code in C# I find myself reusing the Java logic. Like in C# they don't have TreeSet as a core library class unlike java.util. Same with Observer/Observable. So for my game in C#, I coded the Observer and Observable classes, and I'm about to code my own data structures based on how Java does it.
Plus, conventions are really strong in Java, Javadoc is also marvelous, it makes everything so consistent and well documented.
I've studied programming in three schools now, College for 2.5 years, university in France for a semester and now a semester at my engineering school, and everybody uses Java. It for sure makes things easier, and I just like it.
But at some point, it should evolve a little I think, otherwise it'll be surpassed by other languages. Last notable update was Java 5... Sept. 30, 2004.
Report Spam   Logged

WHy do i have a feeling your going to be the serious wise man of the forum Tongue
D:< I hate you! That made WAY to much sense.
Shihen
Magical Misdreavus
****

Level: 5
Offline Offline

Posts: 126


View Profile WWW
Badges: (View All)
« Reply #86 on: December 25, 2012, 05:10:44 am »

When pathfinding... goes wrong:
(Yellow = Start, Red = Goal, Sky Blue = Path)



Still can't seem to get A* pathfinding down, it makes a path and avoids solid objects perfectly fine. As well as returning if a path can't be found, eg when surrounding the goal with solid nodes. It just... doesn't make a very convenient path - it's drunk.
The background terrain isn't joined up with the grid yet - I'm just working on getting the A* working perfectly before implementing it into any form of game.
Report Spam   Logged

klondikebar
Global Moderator
Malevolent Murkrow
*****

Level: 44
Offline Offline

Posts: 2977


View Profile
Badges: (View All)
« Reply #87 on: December 25, 2012, 07:01:06 am »

Code:
if christmas == True:
    print "Merry Christmas!"
else:
    print "Or chanukah or whatever....
Report Spam   Logged
Shihen
Magical Misdreavus
****

Level: 5
Offline Offline

Posts: 126


View Profile WWW
Badges: (View All)
« Reply #88 on: December 25, 2012, 07:04:49 am »

Code:
if christmas == True:
    print "Merry Christmas!"
else:
    print "Or chanukah or whatever....

Python and its uppercasing of True/False - I'll never get used to that. Merry Christmas! Smiley

New update, got a less drunky-route and got the terrain plugged into the grid. Still not efficient as it could be but I'm happy with it for now. It'll be good to have a little leeway in the paths.
Report Spam   Logged

klondikebar
Global Moderator
Malevolent Murkrow
*****

Level: 44
Offline Offline

Posts: 2977


View Profile
Badges: (View All)
« Reply #89 on: December 26, 2012, 09:59:56 am »

I think I get classes now, but I'm not entirely sure. I definitely see how useful they can be though.
Report Spam   Logged
Pages: 1 ... 4 5 [6] 7 8 ... 12
  Send this topic  |  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
Free SMF Hosting - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy
Page created in 0.048 seconds with 30 queries.