I've been coding this game for about a week now. It will be a mass-killing-2D-tile-style-arena-type-doom-clone-multiplayer-game. It is coded in C, and uses SDL (and SDL_mixer), and UDP for the multiplayer thing. Anyway, I finished yesterday the network programming, and it works fine, and it is very fast. Just finished coding the two player local multiplayer thing. Blah blah blah. Sorry I'm tired.
Also, doing both game logic and basic drawing directly from your input handling may have been cool for shaving off some cycles in the 80's, but nowadays we like to structure our code a little better. Nice job on calling SDL_BlitSurface directly instead of setting up some abstraction functions, too, and on the massive amounts of copy-pasting between code for moving in all directions, and for almost identical objects like the players.
And you seem to have accidentally named your player direction variable (which should be a property on his sprite struct, no?) player_position.
HIBTY?
Why aren't people taught the most elementary best practices, anyway? When we learned programming in my first year, the examples we were shown all put unescaped POST data directly into SQL queries. And now we're learning to do OpenGL using fucking immediate mode. I know our instructors wouldn't write code like that, so would it have been so damn hard to teach us properly?
I read every single line of code in your terminal and enjoyed every minute of it, OP. Don't listen to these people, they only know how to program with parentheses.
Name:
Anonymous2009-03-08 17:53
>>16
Actually, >>14 has some valid criticisms. Nice job on calling SDL_BlitSurface directly instead of setting up some abstraction functions,
and
>and on the massive amounts of copy-pasting between code for moving in all directions, and for almost identical objects like the players
The second one is particularly important, if you are not going to abstract similar code away you probably shouldn't be programming at all
Another thing is the case followed by four layers of if statements, that is almost certainly not the best way to handle it. Ever heard of "&&"? It's what EXPERT PROGRAMMERS use!!!!! If you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.
Name:
Anonymous2009-03-08 18:01
Separate input processing, game logic and drawing code or this won't be the last sleepless night you'll have maintaining your code. Or rewrite everything in Lisp.
PS: As-tu lu ton ``Structure et Interprétation des Programmes Informatiques'' aujourd'hui ?
Name:
Anonymous2009-03-08 18:07
Being entirely serious here, I would rather swim around in a cess pool than manage your code.
>>22
I know I was being picky and it probably compiles down to the same thing, but it is a damn site more annoying to read a multilayered if statement than when it is all on one line.
>>26 probably
It's obviously the same thing. At the machine level it's a conditional jump whatever you use.
The function processes user input, even if there were 100 levels of "if" the (ridiculously low) delay would be completely transparent to the user. Optimizing is never about removing an if or two. Except for a password cracker, perhaps. A 2D game like this hardly needs optimization anyway.
When you reach Satori (and an understanding of cache & memory access) you'll get it.
>>32
I actually conjure the spirits of the computer with my spells. Think about why you write code.
Name:
Anonymous2009-03-09 1:10
>>21 Truth.
Anyone that actually knows how to program could easily provide useful criticisms beyond PIG DISGUSTING, SCIP, questioning >>1 sexual orientation
Interesting. I have absolutely no experience with SDL, or games programming so I won't comment on the code I can see there. But I'd be curious in knowing more about the multiplayer aspect and how you keep the players in sync, and handle any dropped UDP packets.
Name:
Anonymous2009-03-09 6:22
>>38
I'll save you the trouble. >>1 is doing it wrong
Absolutely nothing about python thread the other tables called her over There were nights that i already have a limited amount of existence the sidebar the cursor will turn into a label one character are best for cleanly coded rapid.