Jump to page: 1 2
Thread overview
Atomorun2008 Opensource
Aug 20, 2008
Matthias Thurau
Aug 21, 2008
bearophile
Aug 21, 2008
JAnderson
Aug 21, 2008
downs
Aug 21, 2008
bearophile
Aug 22, 2008
Mike Parker
Aug 22, 2008
Matthias Thurau
Aug 22, 2008
Saaa
Aug 23, 2008
Matthias Thurau
Aug 23, 2008
Saaa
Aug 22, 2008
Jesse Phillips
Aug 22, 2008
Jesse Phillips
Aug 22, 2008
Matthias Thurau
Aug 22, 2008
Nicolay Korslund
Aug 22, 2008
Matthias Thurau
August 20, 2008
Hello,

As a Reminder: Atomorun2008 is a free 3D Jump n Run Game written in D.

After a while and some feedback from some users in the last time, i decided to publish the sourcecode of Atomorun2008 under GPL. Frostwork aka Marcel Unbehaun released Linux and Mac OS X versions of the Game, too.

So if you are interested: Atomorun2008.whosme.de


August 21, 2008
Matthias Thurau:
> So if you are interested: Atomorun2008.whosme.de

struct Vertex {
public:
    Point3D position;
    Point3D normal;
};

D Structs don't need a semicolon at the end, and their fields are always public.


myLetters[currentLetter].uv[0].x = cast(float) letterstartxl / myDimension;
myLetters[currentLetter].uv[0].y = cast(float) (y  *maxlettersize)     / myDimension;
myLetters[currentLetter].uv[1].x = cast(float) letterstartxr / myDimension;
myLetters[currentLetter].uv[1].y = cast(float) (y  *maxlettersize)     / myDimension;
myLetters[currentLetter].uv[2].x = cast(float) letterstartxr / myDimension;
etc...

To shorten that code you may use:
with (myLetters[currentLetter].uv) {...}


    void clear() { //check and unload non needed resources
       ...
    };

No need for the semicolon after the last } of a method. And I suggest you to put one blank line between methods.

struct Point2D  and struct Point3D can be merged into a single templated code, that can work with N coordinates, reducing code duplication...

Generally I see many points where the code can be shortened, there's some redundancy.

Generally I suggest to specify what names you import: import foo: bar, baz, ect;

Bye,
bearophile
August 21, 2008
> struct Point2D  and struct Point3D can be merged into a single templated code, that can work with N coordinates, reducing code duplication...

They could be but normally Point2D and Point3D have pretty specific operations that don't scale well.

-Joel

August 21, 2008
JAnderson wrote:
>> struct Point2D  and struct Point3D can be merged into a single templated code, that can work with N coordinates, reducing code duplication...
> 
> They could be but normally Point2D and Point3D have pretty specific operations that don't scale well.
> 
> -Joel
> 

But since they also have lots of code in common, put them into a template and wrap the unique code into static ifs.

Look at dglut.vector for an example of templated coordinate structs.
August 21, 2008
"bearophile" <bearophileHUGS@lycos.com> wrote in message news:g8iec6$1cc7$1@digitalmars.com...

> No need for the semicolon after the last } of a method. And I suggest you to put one blank line between methods.
>
> Generally I suggest to specify what names you import: import foo: bar, baz, ect;

Uh, I'm not sure where you got the idea that you can tell other people what coding style they should use, but typically it doesn't work ;)


August 21, 2008
Jarrett Billingsley:
> Uh, I'm not sure where you got the idea that you can tell other people what coding style they should use, but typically it doesn't work ;)

I'd love people to criticize my code :-)

In the the creative literary mailing lists I follow I am used (and even supposed too) to comment/criticize everything people shows in the group. So I am trying to... improve this group encouraging people to look at each other code to suggest things, etc. A community of writers doesn't need to be too much different from a group of programmers :-)

The things I have said here aren't just "coding style", for example I have avoided suggesting things like where to put the brackets, how much indent use, etc. The things I have suggested, like to not put "private" inside structs seems more important, closer to being code bugs (despite not being bugs). Walter has written some conventions for D and I think it's positive to follow some of them (even if maybe Tango doesn't follow some of them).

Bye,
bearophile
August 22, 2008
On Thu, 21 Aug 2008 10:46:17 -0400, Jarrett Billingsley wrote:

> "bearophile" <bearophileHUGS@lycos.com> wrote in message news:g8iec6$1cc7$1@digitalmars.com...
> 
>> No need for the semicolon after the last } of a method. And I suggest you to put one blank line between methods.
>>
>> Generally I suggest to specify what names you import: import foo: bar, baz, ect;
> 
> Uh, I'm not sure where you got the idea that you can tell other people what coding style they should use, but typically it doesn't work ;)

I a agree with bearophile's reply. As long as you stay away from well known arguments, suggesting better style constructively is good, especially in a new language that may allow for some new ways.
August 22, 2008
bearophile wrote:
> Jarrett Billingsley:
>> Uh, I'm not sure where you got the idea that you can tell other people what coding style they should use, but typically it doesn't work ;)
> 
> I'd love people to criticize my code :-)
> 
> In the the creative literary mailing lists I follow I am used (and even supposed too) to comment/criticize everything people shows in the group. So I am trying to... improve this group encouraging people to look at each other code to suggest things, etc. A community of writers doesn't need to be too much different from a group of programmers :-)
> The things I have said here aren't just "coding style", for example I have avoided suggesting things like where to put the brackets, how much indent use, etc. The things I have suggested, like to not put "private" inside structs seems more important, closer to being code bugs (despite not being bugs). Walter has written some conventions for D and I think it's positive to follow some of them (even if maybe Tango doesn't follow some of them).
> 

In literature, the written word is the end product, which should be as 'polished' as possible. Software is polished in terms of functionality and presentation. Which features of the language to use in the source itself ('with' statements, templates, and so on) is a choice of personal discretion (or team coding standards). Your suggestions are nowhere near the equivalent of helping someone improve a literary work.

If your post of unsolicited suggestions had been directed at me, I'd ignore the whole thing and be rather annoyed at you for doing so. Just because you don't need to add 'public' to struct fields doesn't mean you shouldn't. Some, myself included, would argue that it improves readability. Just because Point objects share a lot of similar code doesn't mean they *have* to be implemented as templates (as suggested by downs). Personally, I avoid templates for such simple cases. You say this isn't the same as telling someone where to put the brackets, but in effect it is because there's no 'right' way.

Sure, source should be readable so that others can pick it up. But an important aspect of readability is consistency. Whether or not you use 'with' statements is less important that whether you do so or don't do so consistently.
August 22, 2008
On Wed, 20 Aug 2008 12:49:36 -0400, Matthias Thurau wrote:

> Hello,
> 
> As a Reminder: Atomorun2008 is a free 3D Jump n Run Game written in D.
> 
> After a while and some feedback from some users in the last time, i decided to publish the sourcecode of Atomorun2008 under GPL. Frostwork aka Marcel Unbehaun released Linux and Mac OS X versions of the Game, too.
> 
> So if you are interested: Atomorun2008.whosme.de

Sorry I just have to ask, you wouldn't also be the author of Dear Camy? The reason is the sound effects are a little similar.
August 22, 2008
Well, I guess if you post a game on a programmers forum, you should expect comments on code style ;-)

I thought the game was fun - I like the accelerated platform jumper idea, requiring many leaps of faith as it goes faster :) There's a lot of things you could add in of course, like obstacles / enemies, multiple platform heights, etc to get more variety. But all in all a fun and simple game.
« First   ‹ Prev
1 2