Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 249 250 [251] 252 253 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 907345 times)

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3750 on: January 24, 2013, 07:24:00 pm »

On the other hand I fear it may have spoiled me for post-university...
Meh, I can probably get you a job like that, as long as you're willing to join the dark side.
Your avatar is relevant. :P
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3751 on: January 27, 2013, 08:22:58 pm »

Why should I use XML instead of just plain data files?

Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3752 on: January 27, 2013, 11:27:18 pm »

Because there's no such thing as a plain data file.
Logged

Fayrik

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3753 on: January 28, 2013, 12:21:55 am »

Because there's no such thing as a plain data file.
What about .bin and .dat, and other Binary Serialization dumps?

Why should I use XML instead of just plain data files?
Simply put, because if the data is largely text based, XML makes it much easier to read and or modify.
Unless you're using a SQL database but that has it's own set of ups and downs.
Logged
So THIS is how migrations start.
"Hey, dude, there's this crazy bastard digging in the ground for stuff. Let's go watch."

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3754 on: January 28, 2013, 01:02:12 am »

What about .bin and .dat, and other Binary Serialization dumps?

Even binary files contain an encoding that must be deciphered and often parsed. But I suppose they are close enough.
Logged

Killjoy

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3755 on: January 28, 2013, 10:40:28 am »

Why should I use XML instead of just plain data files?

Because XML has a few nice features, there exists a lot of parsers of varying quality, and it can be handwritten.
Depending on how much data you need to load, XML can be an okay file container.
If you need to load a lot of data fast, binary files will be the best choice.
Logged
Merchants Quest me programming a trading game with roguelike elements.

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3756 on: January 28, 2013, 06:57:11 pm »

Why should I use XML instead of just plain data files?

Because XML has a few nice features, there exists a lot of parsers of varying quality, and it can be handwritten.
Depending on how much data you need to load, XML can be an okay file container.
If you need to load a lot of data fast, binary files will be the best choice.

this was the kind of answer I was looking for.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Lightningfalcon

  • Bay Watcher
  • Target locked. Firing main cannon.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3757 on: January 28, 2013, 08:20:25 pm »

I managed to succesufully sign up for AP Computer Science the other day, and I have a question-
How easy is Java to learn?
How similar is it to C++?
Logged
Interdum feror cupidine partium magnarum circo vincendarum
W-we just... wanted our...
Actually most of the people here explicitly wanted chaos and tragedy. So. Uh.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3758 on: January 28, 2013, 08:24:26 pm »

How similar is it to C++?
Pretty easy to learn, but takes some time to master. Java is an OOP language, so while the syntax and language specifics can be picked up without too much effort, what you really need to learn are your patterns.

How similar is it to C++?
If you asked me how similar German is to English, and I only spoke German, English and French, I would say it was very different. If you asked me how similar German is to English, and I only spoke German, English and Korean, I would tell you it is very similar.

It has its differences. I would say that Java is easier. Still, across the spectrum of all programming languages, I would say that they are very closely related.

Toxicshadow

  • Bay Watcher
    • View Profile
    • github
Re: if self.isCoder(): post() #Programming Thread
« Reply #3759 on: January 28, 2013, 10:45:16 pm »

In XNA 4.0, is it possible to use variable's values in a texture file name? For example,
Code: [Select]
//Snipping everything except what I'm specifically referring to:
    "SpriteBase_" + Direction;
//Direction is an Int16, based on Up/Down/Right/Left, this is meant to achieve a filename of "SpriteBase_1" or "_2", etc...
Also, could you give me some pointers on how to achieve this in the update logic. Even better, how to achieve this in my Sprite class?

Excuse my nubness, just started with XNA :/
Logged
Quote
'ere the Chias get hungry...

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3760 on: January 28, 2013, 10:51:40 pm »

I managed to succesufully sign up for AP Computer Science the other day, and I have a question-
How easy is Java to learn?
How similar is it to C++?

In my opinion, Java is very easy to learn, but difficult to master. It gives you a lot of slack with concepts, so it's great for introduction to programming. However, it doesn't do so great of a job of weaning you off of those bad practices, so when you move to more complex programming, you run into brick walls frequently. See Stargrasper's rant about Strings; link is in the OP.

Toxicshadow

  • Bay Watcher
    • View Profile
    • github
Re: if self.isCoder(): post() #Programming Thread
« Reply #3761 on: January 28, 2013, 10:54:53 pm »

I managed to succesufully sign up for AP Computer Science the other day, and I have a question-
How easy is Java to learn?
How similar is it to C++?

In my opinion, Java is very easy to learn, but difficult to master. It gives you a lot of slack with concepts, so it's great for introduction to programming. However, it doesn't do so great of a job of weaning you off of those bad practices, so when you move to more complex programming, you run into brick walls frequently. See Stargrasper's rant about Strings; link is in the OP.
Not to steer off his question, but imo scripting languages like Python are much better for an introduction to programming. Though, Python is the same with Java in that you can develop bad practices.  (Like omitting ;'s since they arent required in Python(As far as I remember?))
Though, taken from a different post, the Java and Python are very different:
Code: [Select]
#In python:
name, age = john.summary()

//In Java:
Object[] summary = john.summary();
String name = (String) summary[0];
int age = ((Integer) summary[1]).intValue(); #primitive types require boxing
« Last Edit: January 28, 2013, 11:00:13 pm by Toxicshadow »
Logged
Quote
'ere the Chias get hungry...

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3762 on: January 28, 2013, 11:11:10 pm »

Code: [Select]
#In python:
name, age = john.summary()

//In Java:
Object[] summary = john.summary();
String name = (String) summary[0];
int age = ((Integer) summary[1]).intValue(); //primitive types require boxing
...fixed? :P

Currently having trouble with a bug where all the numbers in my vector ending up being -1.#IND, which, I think, means I divided by zero somewhere. @_@ I don't think I did... but...

Also, it seems that my perlin noise module is returning 0, always. Why!? ;_;
« Last Edit: January 28, 2013, 11:13:33 pm by Skyrunner »
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3763 on: January 28, 2013, 11:16:40 pm »

Not to steer off his question, but imo scripting languages like Python are much better for an introduction to programming.
Eh, if you want to introduce the layman with no intent of doing anything too serious, then a scripting language is a good start. For a first year CS student with a some knowledge of basic programming concepts, you'll want a high-level OOP programming language, like Java, C# or C++. (I actually think it's better to start people off with C++. It might be harder to teach, but the people who get it will be better off in the long-run.)
Logged

Mini

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3764 on: January 29, 2013, 12:04:09 am »

In XNA 4.0, is it possible to use variable's values in a texture file name? For example,
Code: [Select]
//Snipping everything except what I'm specifically referring to:
    "SpriteBase_" + Direction;
//Direction is an Int16, based on Up/Down/Right/Left, this is meant to achieve a filename of "SpriteBase_1" or "_2", etc...
Also, could you give me some pointers on how to achieve this in the update logic. Even better, how to achieve this in my Sprite class?

Excuse my nubness, just started with XNA :/
You can yes, Content.Load simply takes a string and gets whatever content happens to have that name. However in this situation it would probably be better to have all of the direction sprites be in a single sprite sheet, and use the direction*spritesize as an offset for which sprite to draw, using one of the draw methods that has a source rectangle.
Logged
Pages: 1 ... 249 250 [251] 252 253 ... 796