• Hey Guest. Check out your NeoGAF Wrapped 2025 results here!

GAF Devs Thread - a thread about programmer's rants

Status
Not open for further replies.
Kinitari said:
So year one of school is done. I now have a bit of experience with languages (C++, C#, SQL), web dev (HTML, CSS, no Javscript until next semester) and Unix. I feel absolutely as though this was a right decision for me. But I still don't feel like I can do anything, we've only dabbled in anything GUI related, and the websites I can make are mediocre at best - what should I do this summer to keep myself sharp? I feel as though if I don't practice I'll lose my way.

Also,

Code:
if(i > x)
{
       x++
{

Is the only way I can read code now, anything else gives me heartburn.

Fix some bugs in https://code.google.com/chromium/
 
Kinitari said:
So year one of school is done. I now have a bit of experience with languages (C++, C#, SQL), web dev (HTML, CSS, no Javscript until next semester) and Unix. I feel absolutely as though this was a right decision for me. But I still don't feel like I can do anything, we've only dabbled in anything GUI related, and the websites I can make are mediocre at best - what should I do this summer to keep myself sharp? I feel as though if I don't practice I'll lose my way.

Also,

Code:
if(i > x)
{
       x++
{

Is the only way I can read code now, anything else gives me heartburn.

Considering you have two open braces there...

Well anyways I was going to suggest making an HTML5 game, but since you hate same line open braces you won't like JavaScript at all.
 
survivor said:
I'm learning Python this summer and will try to make a simple 2d game with it. So yeah go make a game this summer.

I can recommend some libs I'm using:

- Pyglet for windowing
- If you don'nt want to use Pyglet for sprites also, use Rabbyt
- Chipmunk for 2D physics
- Planar for 2D geometry
- py2exe (or GUI2exe) to make standalone executables
 
BomberMouse said:
I can recommend some libs I'm using:

- Pyglet for windowing
- If you don'nt want to use Pyglet for sprites also, use Rabbyt
- Chipmunk for 2D physics
- Planar for 2D geometry
- py2exe (or GUI2exe) to make standalone executables
I was initially thinking of using Pygame but Pyglet seems interesting. Is there any major differences between the two?

My only main concern about making a game outside of abandoning the idea halfway in is finding a good level editor. That's why I even considered using Game Maker but then I realized I rather pick something that teaches me a new language than just use GM.
 
Slavik81 said:
Tabs are displayed inconsistently across different editors. I prefer spaces for that reason. That said, consistency is most important.

Personally, I start with the Google C++ Style Guide and deviate if I think something's dumb.

Everybody at my company uses the same IDE, and since it's all MS they automatically insert tabs anyway.
 
Zoe said:
Everybody at my company uses the same IDE, and since it's all MS they automatically insert tabs anyway.

Microsoft Visual Studio?

Actually, that is set under Tools -> Options. It defaults to inserting the tab character, but it could be changed on a per developer basis.

It's so much nicer when the IDE applies the coding standard automatically upon check-in. That way you don't run into the problem of developers tinkering with bracing and indentation.
 
survivor said:
I was initially thinking of using Pygame but Pyglet seems interesting. Is there any major differences between the two?

My only main concern about making a game outside of abandoning the idea halfway in is finding a good level editor. That's why I even considered using Game Maker but then I realized I rather pick something that teaches me a new language than just use GM.

AFAIK pyglet is more "pythonic" since pygame is just a wrapper for SDL, the selling point for me is the fact that pyglet doesn't require external dependencies, it's pure python.

GM is a great tool too. I don't know of any level editor, I guess you'll have to make one yourself or use a tile editor and export that. If you find anything good, let me know.
 
Andrex said:
Considering you have two open braces there...

Well anyways I was going to suggest making an HTML5 game, but since you hate same line open braces you won't like JavaScript at all.

Hey! That's how we program in Canada...

I think things like Notepad++ and the like spoil me sometimes too, I feel like if I had to code in plain text I'd have syntax errors out my ass.

Edit: Thanks for all the suggestions people :3. I have a friend who is actually extremely well versed in dev and he's going to help me this summer with javascript apparently, it should give me a leg up. Maybe I can work on a game, something simple, I feel like I learn the most when I am bashing my head against the wall because I can't figure out how to do this very specific and mostly useless thing.
 
So I've enjoyed my C++ class this semester, even though I was mostly self taught. But this final project sucks. I can't fathom why you would handle it this way, maybe GAF can enlighten me. This is definitely a "rant" though.

So we have to do a crude simulation of fish in a bay. We have a Fish class, but the only methods it has are setType, getType, setDirection, and getDirection. Why type you say?
Because our class Bay contains an array of Fish representing the grid, and each fish can either be type "f" or type ".", in which case its empty. The grid is literally composed of Fish in either on or off state.

This is incredibly annoying. All the methods for the Fish behavior are actually defined in the Bay class. Everything is updated by running the various behavior methods which scan through the array one by one and update all the values.
It wasn't a huge problem until we had to also define a shark. I can't actually make an inherited shark class or anything, because all the important methods are in the Bay class.

So I have to just designate a third type "s" and then rewrite all of the methods, marginally modified, inside the Bay class, leading to a bloated mess of code. And this is definitely how we were supposed to handle it, the instructions were clear.

This has led to all sorts of headaches. As best as the TAs can figure, there is no way to stop some fish devouring each other accidentally in specific patterns.

Oh, and part of the instructions have us use a list, even though we have a clearly defined size. There's absolutely no reason not to use an array, since nothing in the procedure teaches us about FIFO or FILO at all.
 
The_Technomancer said:
Mayhem...

So I have to just designate a third type "s" and then rewrite all of the methods, marginally modified, inside the Bay class, leading to a bloated mess of code. And this is definitely how we were supposed to handle it, the instructions were clear.

More Mayhem...

Wow, either:
- You misread the instructions
- It's an example of what NOT to do
- It's a very bad C++ class
 
The_Technomancer said:
So I've enjoyed my C++ class this semester, even though I was mostly self taught. But this final project sucks. I can't fathom why you would handle it this way, maybe GAF can enlighten me. This is definitely a "rant" though.

So we have to do a crude simulation of fish in a bay. We have a Fish class, but the only methods it has are setType, getType, setDirection, and getDirection. Why type you say?
Because our class Bay contains an array of Fish representing the grid, and each fish can either be type "f" or type ".", in which case its empty. The grid is literally composed of Fish in either on or off state.

This is incredibly annoying. All the methods for the Fish behavior are actually defined in the Bay class. Everything is updated by running the various behavior methods which scan through the array one by one and update all the values.
It wasn't a huge problem until we had to also define a shark. I can't actually make an inherited shark class or anything, because all the important methods are in the Bay class.

So I have to just designate a third type "s" and then rewrite all of the methods, marginally modified, inside the Bay class, leading to a bloated mess of code. And this is definitely how we were supposed to handle it, the instructions were clear.

This has led to all sorts of headaches. As best as the TAs can figure, there is no way to stop some fish devouring each other accidentally in specific patterns.

Oh, and part of the instructions have us use a list, even though we have a clearly defined size. There's absolutely no reason not to use an array, since nothing in the procedure teaches us about FIFO or FILO at all.
Wow, the Bay and Fish classes were given to you by your teacher? Not sure what to say, other than you probably shouldn't absorb any of the advice he/she gives to you.

Show them this: http://www.parashift.com/c++-faq-lite/basics-of-inheritance.html

and ask them to explain how a Fish is a type of Bay. Sorry man, sounds rough.
 
The_Technomancer said:
fish stuff
What methods are on the Bay class? Why can't you derive the shark from the fish and then just define whatever behavior you need in the new class? In each grid element check the fish settings and do whatever you need to do.
 
BomberMouse said:
Wow, either:
- You misread the instructions
- It's an example of what NOT to do
- It's a very bad C++ class
ha1f said:
What methods are on the Bay class? Why can't you derive the shark from the fish and then just define whatever behavior you need in the new class? In each grid element check the fish settings and do whatever you need to do.
Deriving shark from fish would allow me to use/change the get/setDir and get/setType methods, no more. All of the actual behavior is handled by Bay. Bay's only data is a two dimensional array of Fish, which displays as a two dimensional array of char (either ".", "f" or "s")

The Bay class has four relevant functions. The population function takes in an int, and "flips" that many fish on in random locations, without overlapping. The display function is just overloading <<, a double nested for loop to output the grid.
It gets messy with the other two.
The "cluster" function scans through the Bay one element at a time, and each time it finds a fish it scans the neighborhood for other fish, then sets the direction pointing towards the mean of surrounding fish.
The "move" function scans through one element at a time and moves each fish one unit in the direction specified by their "direction" member.
Now to implement the shark I basically copy paste all of the above two functions, have the scan look for 's' instead of 'f', (if(Boston[j].getType == 's'))
and then made some minor behavioral changes. (like allowing them to overlap with a f occupied square, thus overwriting it and "consuming it")

It really seems like a poor assignment. I mean, even to me it screams "procedural design" Even the TAs were commenting on it.

They weren't given to us, but we were told pretty much step by step how to build them. Exactly what methods and data to use, and exactly what behavior those methods should produce. Only the actual method implementation was up to us.
 
The_Technomancer said:
Deriving shark from fish would allow me to use/change the get/setDir and get/setType methods, no more. All of the actual behavior is handled by Bay.

The Bay class has four relevant functions. The population function takes in an int, and "flips" that many fish on in random locations, without overlapping. The display function is just overloading <<, a double nested for loop to output the grid.
It gets messy with the other two.
The "cluster" function scans through the Bay one element at a time, and each time it finds a fish it scans the neighborhood for other fish, then sets the direction pointing towards the mean of surrounding fish.
The "move" function scans through one element at a time and moves each fish one unit in the direction specified by their "direction" member.
Now to implement the shark I basically copy paste all of the above two functions, have the scan look for 's' instead of 'f', and then made some minor behavioral changes. (like allowing them to overlap with a f occupied square, thus overwriting it and "consuming it")

It really seems like a poor assignment. I mean, even to me it screams "procedural design" Even the TAs were commenting on it.

They weren't given to us, but we were told pretty much step by step how to build them. Exactly what methods and data to use, and exactly what behavior those methods should produce. Only the actual method implementation was up to us.

The thing is, if you are doing a C++ class it should teach you OOP which is clearly the opposite of what you are doing. Even if you weren't, there are many irrational implementation choices like using a "turned off" fish to specify empty spaces.
 
BomberMouse said:
The thing is, if you are doing a C++ class it should teach you OOP which is clearly the opposite of what you are doing. Even if you weren't, there are many irrational implementation choices like using a "turned off" fish to specify empty spaces.
Yeah, it really boggles me. I thought of a much more OO way to handle it all, redesigning pretty much the entire system from scratch, and I would do it too if we weren't graded on using zis precise set of instructions und nicht else.
 
The_Technomancer said:
Yeah, it really boggles me. I thought of a much more OO way to handle it all, redesigning pretty much the entire system from scratch, and I would do it too if we weren't graded on using zis precise set of instructions und nicht else.

I'd say, at least give your idea a try and talk to your teacher or TA. It's hard for me to believe someone would give such instructions unless he is trying to make a point or is testing you. If not, monolothic wall of code is the way to go, fun!
 
BomberMouse said:
I'd say, at least give your idea a try and talk to your teacher or TA. It's hard for me to believe someone would give such instructions unless he is trying to make a point or is testing you. If not, monolothic wall of code is the way to go, fun!
Oh yeah, ran it by my TA tonight, he liked my method. Just can't afford to re-write everything from scratch with an exam this week, and finals looming. I seriously might do one week this summer, just as a hobby.
 
Somehow I managed to make a simple physics simulation that stutters and skips on my home computer, but runs fine on the comp lab's i7 machines.

FML.

It turns out every assignment I did over the semester runs 10 times slower on the lab machines thanks to the discrepency in speed and the variables I used.

Either it's a CPU problem (Phenom X3 vs i7 930), something with OpenGL, or the way VS2010 is configured. I like to think my PC can handle basic physics simulations.
 
Alright school is over, time to learn Python.

Is there any preferred IDE for Python? The tutorial I'm reading is using Python Shell but I feel like I can do better than that.
 
So, about that game I'm making... I'm standing at a crossroads now, I suppose.

  • I've got the concept down. Awesome!
  • I've got a playable demo of how one of the modes would be. Awesome!
  • I should be able to implement the other game modes *fairly* easily. Awesome!
  • The people who have playtested the demo have all stated that they haven't seen anything like this. Awesome!
  • I only work on this sparingly because of work and home commitments. Boo!
  • I know that I have no artistic ability, and before I can do anything to release the game I'll need to get an artist. Boo!
  • I also know that I don't know a damn thing about music or sound effects, so I'll need to get a sound composer. Boo!

The programming ability is there, but I know I'm fucked when it comes to the art and sound assets. This is what kills every one of my motivated game programming efforts.
 
So guys, I have to make a simple webpage in HTML. But my menu should be in javascript.

I found a menu online. It all looks very slick. But the only thing I can't get to work is that when I click on an item, it should open in the "home" frame. I don't know where to put the target.

This is a menu item called: "Sales". It should open in the "Home" frame.

<li><a href="Sales.html" onClick="return expandcontent('sc3', this)" theme="#EAEAFF"><font size="2" face="Verdana">Sales</font></a></li>

For example, in HTML it's <a href="sales.html" target="home">

How does this work in Javascript?

Thanks in advance.
 
survivor said:
Alright school is over, time to learn Python.

Is there any preferred IDE for Python? The tutorial I'm reading is using Python Shell but I feel like I can do better than that.

Well, one of the beauties of python is that you don't need an IDE for it since most of the code is self explanatory and very concise. Also, there's not much an IDE can do on a dynamically typed language, I use a normal text editor like Kate o Gedit. If you're keen on using an editor I've heard good things from PyScripter.
 
survivor said:
Alright school is over, time to learn Python.

Is there any preferred IDE for Python? The tutorial I'm reading is using Python Shell but I feel like I can do better than that.
Notepad++ was my weapon of choice for Python (and still is for many other purposes!)
 
Slavik81 said:
You can install plugins. VisualAssistX is a must for C++.
Doesn't that cost around $200? I guess if I am working for a company I can make them pay it, but in School its not like I have that money sitting around.
 
survivor said:
Alright school is over, time to learn Python.

Is there any preferred IDE for Python? The tutorial I'm reading is using Python Shell but I feel like I can do better than that.
i work in a python shop and pretty much everyone uses vim, emacs, or textmate. hippy complete in vim and emacs tends to work fine for some people, and others just use ctag. it's far from a necessity, though.

The guys who do use ides use pycharm or netbeans. if you're just starting out pydev on eclipse will probably be enough for you.
 
Alright thanks guys for the help. I already have Notepad++ installed so I will give it a try and see if there will be any difference. So far I don't seem to struggle that much with the editor that already came with the installer.
 
eravulgaris said:
So guys, I have to make a simple webpage in HTML. But my menu should be in javascript.

I found a menu online. It all looks very slick. But the only thing I can't get to work is that when I click on an item, it should open in the "home" frame. I don't know where to put the target.

This is a menu item called: "Sales". It should open in the "Home" frame.

<li><a href="Sales.html" onClick="return expandcontent('sc3', this)" theme="#EAEAFF"><font size="2" face="Verdana">Sales</font></a></li>

For example, in HTML it's <a href="sales.html" target="home">

How does this work in Javascript?

Thanks in advance.

Javascript just runs on top of HTML, so if your links are already defined in HTML then they should work the same- so just adding a target=home attribute to the <a> tag *should* work.

Whether it does or not is another question though, as the Javascript could be modifying the behavior of the link in the expandcontent method. There really isn't going to be a catch-all method for setting this target- it's going to depend on specifically what menu scripts you downloaded, and in some cases it may not even be possible.

So if putting target=home in the <a> tag doesn't work, you'll have to check the Menu script's documentation to see if there's a way around it, or modify the script yourself (which could be extremely difficult if it's minified).

Also: <font> tag. It burns IT BURNS
 
Mister Zimbu said:
Javascript just runs on top of HTML, so if your links are already defined in HTML then they should work the same- so just adding a target=home attribute to the <a> tag *should* work.

Whether it does or not is another question though, as the Javascript could be modifying the behavior of the link in the expandcontent method. There really isn't going to be a catch-all method for setting this target- it's going to depend on specifically what menu scripts you downloaded, and in some cases it may not even be possible.

So if putting target=home in the <a> tag doesn't work, you'll have to check the Menu script's documentation to see if there's a way around it, or modify the script yourself (which could be extremely difficult if it's minified).

Also: <font> tag. It burns IT BURNS

Well, I've tried adding a simple: "target=home"

<li><a href="Sales.html" target="home" onClick="return expandcontent('sc3', this)" theme="#EAEAFF"><font size="2" face="Verdana">Sales</font></a></li>

But to no avail. I guess I'm fucked. Unless I build an entire menu myself, but that's too much work for now.

But thanks for the help, Zimbu.
 
argh, .NET rant.

Msbuild is driving me crazy. The project has some unmanaged code in C++ but the damn thing refuses to compile, even though it does it perfectly with Visual Studio in my workstation. I'm uninstalling the whole windows SDK from the build server and installing it again but this is annoying, I've been all afternoon wasting my time making this thing work.
 
Drkirby said:
Doesn't that cost around $200? I guess if I am working for a company I can make them pay it, but in School its not like I have that money sitting around.
The student version is $50. I got the hobby one for $100.
 
I was going through some code last week fixing up compile warnings when I happened across an array. An array named...B. Just B.

Brilliant.

Luckily (?) it was unused so I didn't have to try and figure out what the hell an array named B would be used for.
 
Quick C# question that I'm pretty sure I know the answer to.

I'm trying to make some of the functions in my game a little bit more generic so they can be used across multiple game modes. As it stands now, I've only been working on the 'standard' mode, but the other modes in the game will all act similarly.

I've got a function now that does collision checking, and it's got a signature that looks like this:
Code:
List<Ball> balls; //defined for the whole class
List<Layer> layers; //defined for the whole class

private void CheckForCollision(int index){}

And that function basically checks if ball[index] possibly collides with any of the layers. Everything works just dandy now.

However, in two-player mode, there's going to be two lists of balls, and two lists of layers. The way this function works, the code will be fine, so long as it knows which list of balls and which list of layers to check with.

What I'm wondering is this (and I likely already know the answer, due to how C# works):

If I pass the list of balls, as well as the list of layers into the function, I'm only passing a reference in, right? I don't have to worry about it copying everything and doing it by value, even though the List class uses an underlying array, right?

I know I'm just over-thinking this. List is a class, and it should then automatically be a reference type, so there's nothing I've got to worry about, right?
 
Ecrofirt said:
Quick C# question that I'm pretty sure I know the answer to.

I'm trying to make some of the functions in my game a little bit more generic so they can be used across multiple game modes. As it stands now, I've only been working on the 'standard' mode, but the other modes in the game will all act similarly.

I've got a function now that does collision checking, and it's got a signature that looks like this:
Code:
List<Ball> balls; //defined for the whole class
List<Layer> layers; //defined for the whole class

private void CheckForCollision(int index){}

And that function basically checks if ball[index] possibly collides with any of the layers. Everything works just dandy now.

However, in two-player mode, there's going to be two lists of balls, and two lists of layers. The way this function works, the code will be fine, so long as it knows which list of balls and which list of layers to check with.

What I'm wondering is this (and I likely already know the answer, due to how C# works):

If I pass the list of balls, as well as the list of layers into the function, I'm only passing a reference in, right? I don't have to worry about it copying everything and doing it by value, even though the List class uses an underlying array, right?

I know I'm just over-thinking this. List is a class, and it should then automatically be a reference type, so there's nothing I've got to worry about, right?
I'm a C/C++ guy, but I know how to use Google.

"c# pass by reference"

First result:

http://msdn.microsoft.com/en-us/library/0f66670z(v=vs.71).aspx

In C#, parameters can be passed either by value or by reference. Passing parameters by reference allows function members (methods, properties, indexers, operators, and constructors) to change the value of the parameters and have that change persist. To pass a parameter by reference, use the ref or out keyword.
 
So yesterday I spent three hours trying to figure out why a counter that kept track of a sliding "window" position would suddenly spaz out at precisely 52 and turn into -1100656 or so. >_<
I never did figure it out, I just rewrote the whole program to use vectors instead of arrays.
 
If it's arrays could it have been an out of bounds error?
 
Halycon said:
If it's arrays could it have been an out of bounds error?
Maybe? Here's the thing: if I was just using the counter itself, it tracked just fine, going from its initial position of 50 to the end of the array at 300. But when I implemented literally a single line for loop inside that copied the contents of the current "window" to a second array of the correct size, the counter would go
50
51
52
-1160876
-1160875
-1160874
...
 
Ecrofirt said:
Don't treat people like a dickass.
I'll make a more concerted effort not to.

How about trying it out? If it is a reference, you shouldn't be able to modify the memory location it is referring to. See if you can do this and you'll have your answer either way.
 
The_Technomancer said:
Maybe? Here's the thing: if I was just using the counter itself, it tracked just fine, going from its initial position of 50 to the end of the array at 300. But when I implemented literally a single line for loop inside that copied the contents of the current "window" to a second array of the correct size, the counter would go
50
51
52
-1160876
-1160875
-1160874
...

Peculiar! Which language is this in?
 
Ecrofirt said:
Peculiar! Which language is this in?
C++

Somehow a for loop that read
Code:
for(int i = min, i<=max, i++){
hann_window[i] = strip[i]
}
(which was called at each counter increment. picture a sliding window over a long strip of data, copying the contents at each increment) completely broke my program

I can try and recreate the program exactly from memory, if you're curious. It was incredibly straightforward, that was part of why it was so aggravating.

EDIT:Shit....just found the error by retyping it here on GAF. Yup, array over bounds error.
 
The_Technomancer said:
Maybe? Here's the thing: if I was just using the counter itself, it tracked just fine, going from its initial position of 50 to the end of the array at 300. But when I implemented literally a single line for loop inside that copied the contents of the current "window" to a second array of the correct size, the counter would go
50
51
52
-1160876
-1160875
-1160874
...

Somehow a for loop that read
Code:
for(int i = min, i<=max, i++){
hann_window[i] = strip[i]
}
completely broke my program

Looks like you overflowed the sign bit somehow. By any chance were you casting a char to an int?
 
The_Technomancer said:
EDIT:Shit....just found the error by retyping it here on GAF. Yup, array over bounds error.
Yeah, that's one of the major pitfalls of arrays. Good catch.

Just reminded me that our final Game Dev project got named "Index: Out of Bounds" due to late nights fixing errors like that.

Not. Fun.
 
I hate arrays, I use <vector> whenever possible. I blame it on doing a lot of assignments in AS3, where the Arrays expand, have built in methods for length/sort/whatever, and can contain anything and everything without explicit declarations. Totally spoiled, so learning C++ afterwards was a slap in the face.
 
Status
Not open for further replies.
Top Bottom