Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 49 50 [51] 52 53 ... 91

Author Topic: Programming Help Thread (For Dummies)  (Read 100773 times)

Mephisto

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #750 on: July 19, 2012, 03:04:37 pm »

And lo, we have discovered rubber duck debugging.
Logged

head

  • Bay Watcher
  • Whoop Whoop.
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #751 on: July 20, 2012, 06:56:23 pm »

That feeling when you catch yourself having a conversation with yourself via comments.

C#: How would I go about loading all the images from a folder into an ArrayList without knowing the filenames or the amount of files in the content folder?

http://pastebin.com/W2TuAYhg

Something like that.
Logged
Dev on Baystation12- Forums
Steam Username : Headswe

Thendash

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #752 on: July 21, 2012, 02:44:42 am »

Thanks Head and Mephisto, I'll try those out.
Logged
Thendash's Livestream

This game could honestly give out hand jobs for free and people would still bitch.

Neonivek

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #753 on: July 21, 2012, 11:00:37 pm »

I did a lot of PM work for my problem and it ended hillariously. I will say thanks to the thread anyhow even if it didn't really pan out.

I guess I'll just have to try harder on my own, or just hunt down someone who did what I did (which is no one on this forum)

---

So I am guessing no one still knows about to make a graphical Adventure game (Point and Click adventure game) like Kings Quest the way I want it to be. So I'll continue on the endless quest.
« Last Edit: July 23, 2012, 07:15:20 pm by Neonivek »
Logged

dizzyelk

  • Bay Watcher
  • Likes kittens for their delicious roasts.
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #754 on: July 31, 2012, 02:47:11 am »

So, I've spent the past good while trying to get A* implemented. It works, usually. However sometimes it stops, and when I look at what its doing during these hangs, I see its looking for a cell that doesn't even come close to being on the map, like -6534x-5276 (made up values, several thousand, anyways, and not the same when it happens).

Spoiler (click to show/hide)
Any thoughts on what the problem might be?
Logged
Dwarf Fortress - Bringing out the evil in people since 2006.
Somehow, that fills me more with dread than anticipation.  It's like being told that someone's exhuming your favorite grandparent and they're going to try to make her into a cyborg stripper.

Starver

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #755 on: August 01, 2012, 08:25:29 am »

I can't tell from the code you give, and with the made up values representing ones that are "several thousands, anyways" adrift, but it sounds like a classic underflow/overflow error.

If not, could it instead be some obscure type-conversion that's (say) taking a value 0..65536 and either 1:1 mapping it to -32768..32767?  Either 0 to -32768 all the way to 65536 becoming 32768 (or vice-versa), or interpreting the bits of a signed (2's compliment) value as an unsigned value (or, again, vice-versa[1]).

Either way, perhaps there's some way you can work out what value should be seen, and see if its any 'power of two' value (maybe plus or minus one) away from what it should be?  Otherwise, put some debug statements in that check (and display/log, somewhere handy) the possibly erroneous variables' defined types at various stages.


There's some other possibilities, and it's strange that it doesn't always error, so the problem might be in some conditional code[2], but I'd rule the above out first.


[1] That'd only affect the top half of the value range, though, and I can't see raw coordinate values going that high, unless your ambitions or implementation give you such huge array location values...

[2] I got something like this in some "wrap-around" code I did, once.  When on one edge (e.g. having a coordinate of zero, in one/more dimension), it was supposed to translate a "-1" offset to the "max" number, and "-2" to "max-1", etc.  I doubt you're doing that, either, but you may still have something of a similar ilk, where the error yet-to-be-identified lies mostly dormant, except when it isn't.
Logged

Kofthefens

  • Bay Watcher
  • Keep calm and OH GOD CAPYBARAS
    • View Profile
    • Marshland Games
Re: Programming Help Thread (For Dummies)
« Reply #756 on: September 08, 2012, 05:14:09 pm »

I'm trying to make a program that will check a yahoo email. However, when I do emailChecker.recieve(), it gives me an error message. I am using JavaMail. The code looks like this:

Spoiler: Code (click to show/hide)

And the error message looks like this:
Spoiler (click to show/hide)

Thanks in advance for the help.
Logged
I don't care about your indigestion-- How are you is a greeting, not a question.

The epic of Îton Sákrith
The Chronicles of HammerBlaze
My website - Free games

Derekristow

  • Bay Watcher
    • View Profile
    • Steam ID
Re: Programming Help Thread (For Dummies)
« Reply #757 on: September 09, 2012, 08:48:31 am »

Well, it seems to be failing at
Code: [Select]
store.connect(popServer, popUser, popPassword);due to a time out.  Are you sure the server exists and is responding to you?  Google will be able to help more than me, as I've never even heard of that library, but looking up what will cause that exception in that function is where I'd start.
Logged
So my crundles are staying intact unless they're newly spawned... until they are exposed to anything that isn't at room temperature.  This mostly seems to mean blood, specifically, their own.  Then they go poof very quickly.

Lompocus

  • Escaped Lunatic
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #758 on: September 10, 2012, 07:06:35 pm »

I have a decision to make, both options have their pros and cons.  I'm trying to decide if I should learn win32 GUI programming so I can make a 2d map editor for a game I'm making, but the thing is I'm planning on ending up making the levels procedurally generated, but I need a map or two made for when I am doing tests and making the game other than the world / level gen.

Someone already answered your question, but I'll add some stuff. The win32 API is something you should know if you're using windows. In practice, for any GUI (that's not a game's GUI), you will _not_ write code using the win32 API to open windows (nor will you use MFC!); you'll use something else like Qt or Gtk if you want to use C++, or WinForms (C# and other stuff... I'm not so sure) or Tk (Perl) if you're using a different language. However, it comes in handy at the weirdest times, e.g. SFML's current stuff from its repo has a bug in it where it renders window titles incorrectly, something which is fixed in 1 win32 api function call whenever you want to change the window title. Buy the Petzold WinAPI book (5th edition). Go over most of the first section (short at ~340 pages) and parts of the 3rd section as needed.

And, for some extra gui stuff, here are a few more GUI libraries:
-SFGUI (or whatever it's called) -- It's a GUI library built for integration with SFML.
-GLUI (which provides a look and feel just like regular windows 95) -- Another OpenGL GUI. Very simple.

Here's something else I stumbled across when trying to remember what GLUI was called (GLConsole); not a GUI, but it looks like a useful OpenGL console system:
http://www.robots.ox.ac.uk/~gsibley/GLConsole/

*edit: Here's a linky with ~180 Qt tutorials. Excellent ones. Here's a case where you want to build a gui for a tool for building your game, but you don't want to learn another language (though Tk w/ Perl doesn't take more than a few days to pick up at a simple level): http://www.youtube.com/watch?v=Id-sPu_m_hE&feature=plcp
« Last Edit: September 11, 2012, 11:15:09 pm by Lompocus »
Logged

Sergius

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #759 on: September 16, 2012, 11:04:26 pm »

Ok, here's a open-source licensing question. It's not about coding so I hope it's not off-topic.

I'm spoilering it just in case it's the wrong topic and people can skip it.

Spoiler (click to show/hide)

BTW, java + libgdx + android SDK RULES! Multiplatform development FTW!
« Last Edit: September 17, 2012, 12:26:46 am by Sergius »
Logged

Shades

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #760 on: September 17, 2012, 03:18:40 am »

I'm not a big fan of "copyleft" (CC:Share-Alike, GPL) and forcing non-commercial use on people, as long as there's attribution.

Not sure what you mean here, GPL doesn't force non-commercial use, just that any modification is available as source. I think the LGPL would work better in this case, or the GPL with linking exceptions (like a lot of compiler runtimes use) as it gives more flexibility to the user.

However personally I'm not a big fan of the GPL, as useful as it has been, and would instead suggest either BSD or MIT licences and just assume any good change will be pushed back to you. Seems to work well enough for most github projects, and companies are getting better and better and pushing back.
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

Sergius

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #761 on: September 17, 2012, 10:09:46 am »

I'm not a big fan of "copyleft" (CC:Share-Alike, GPL) and forcing non-commercial use on people, as long as there's attribution.

Not sure what you mean here, GPL doesn't force non-commercial use, just that any modification is available as source.

I meant those two as separate things. Share-Alike (copyleft) and Non-Commercial. Like two of the CC licenses.

Quote
I think the LGPL would work better in this case, or the GPL with linking exceptions (like a lot of compiler runtimes use) as it gives more flexibility to the user.

Well, thing is, this isn't a library, so linking isn't really an issue (it's a program, it runs "datafiles" or "resource packs" or whatever). Maybe "engine" isn't the right description. Game interpreter?

Quote
However personally I'm not a big fan of the GPL, as useful as it has been, and would instead suggest either BSD or MIT licences and just assume any good change will be pushed back to you. Seems to work well enough for most github projects, and companies are getting better and better and pushing back.

I know what you mean, just that I'm having problems imagining a case with this specific program where I'd like someone to make changes to the engine and keep them proprietary. Except, yeah, some people MIGHT make the changes BECAUSE they can keep them proprietary, then have a change of heart later and release the code... changes which might not be made otherwise. It's a tricky issue...

I've set the project to GPL 3 for now and put the license text (I'm working on SourceForge right now), I assume I can later change it to something more permissive when I make my mind?
« Last Edit: September 17, 2012, 10:25:57 am by Sergius »
Logged

Chattox

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #762 on: September 18, 2012, 01:53:25 pm »

C++: To use a struct in a function outside of main(), can you use forward declaration and define it in main(), or does it have to be defined outside of a block?
Logged
"10 z levels down, 10 tiles north is some blood, i shall go clean it before it drives me to insanity with it's crimson color"
The setting of Half-Life 2 Episode 3's release: "It is the 41st Millennium. For more than a hundred centuries the Gabe has sat immobile on the..."

lorb

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #763 on: September 18, 2012, 08:33:13 pm »

C++: To use a struct in a function outside of main(), can you use forward declaration and define it in main(), or does it have to be defined outside of a block?
Is there any specific advantage you're getting from defining it inside main when you're using it outside of main?
Logged
Please be gracious in judging my english. (I am not a native speaker/writer.)
"This tile is supported by that wall."

Chattox

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #764 on: September 19, 2012, 03:55:40 am »

C++: To use a struct in a function outside of main(), can you use forward declaration and define it in main(), or does it have to be defined outside of a block?
Is there any specific advantage you're getting from defining it inside main when you're using it outside of main?

Other than being retarded, nope. Turns out I'd completely misunderstood how they work xD

EDIT: How do you define a range for rand()? Example; if I wanted to generate a number between 1 and 100, what would I do?
« Last Edit: September 19, 2012, 04:59:28 pm by Chattox »
Logged
"10 z levels down, 10 tiles north is some blood, i shall go clean it before it drives me to insanity with it's crimson color"
The setting of Half-Life 2 Episode 3's release: "It is the 41st Millennium. For more than a hundred centuries the Gabe has sat immobile on the..."
Pages: 1 ... 49 50 [51] 52 53 ... 91