Jump to content

D2TM : Technical Topic


stefanhendriks

Recommended Posts

Introducing a technical topic where one can discuss (portions) of code, or even design patterns and such about the game.

I have learned a lot the past months about coding, coding styles, sollutions, design patterns, uml , object oriented programming and so forth. Looking at the d2tm source now, makes me think of completely rewriting it from scratch with some good thinking before-hand.

I could summerize the previous rewrites as "well, x or y did not go well, i could probably integrate it better with sollution z.". And that went fine, but i did not change the other essential things, only those things i found later in the process of writing.

A lot of things are lacking in the source, there is no sollution for actual creating items/things in the game. The so called "Factories". The pain with rewriting mentats was enormous, and the result was, i had to rewrite more and more and more.

I think it would be better to start from the ground up, but WITH some thinking before-hand. If you have any ideas, suggestions or would like to discuss about this techincal side. Feel free!

Link to comment
Share on other sites

The RTS engine I'm creating for Nintendo DS has most information/code really abstract, as all needs to be read in from FAT (SD-card). What structures there are, what units, their properties, techtrees, graphics, everything basicly. And it all works right so far.

If you'd like to see pictures taken of the engine running Dune2's graphics on the DS, check this interview:

http://www.ds-scene.net/forum/pforum.php?act=4&publicforum=19&topic=132

This kind of abstraction makes the code more generalized and (in my eyes) quite nice. The best code I've ever generated for a large project.

It's all C though, no C++. So although I use structs as a sort of replacement for objects, one can argue it's not object-based (enough). If you would like to look into my current code though, I'd be more than willing to share it with you, of course.

Your approach with having different code files for different structures is understandable, but is it needed? I am unsure about that. If it makes reasoning about the structures a lot easier, and if you do not want to create (drastic?) changes like mods for your remake, then yes you should keep it this way. Otherwise, I'd suggest a higher abstraction of structures: making them all uniform with only (known) variables which indicate it to have special purposes (such as radar capabilities).

Link to comment
Share on other sites

  • 2 weeks later...

the Nintendo DS pics look very nice (about dune).

I am always interested in a source code btw.

The reason for different files is easy. It compiles faster, and its easier to maintain your code. You can find specific pieces of code faster (ie, you always know some bug in the ConstYard will be in ConstYard.cpp).

Link to comment
Share on other sites

Point taken.

I sent you a mail with my current source code.

edit:

Is CREATE_PATH function being worked on still, or is the one in the repository the revised version you talked about?

(I also PMed Spekkio as to not stray further offtopic in here.)

Also, if you're really going to rewrite all (huge task), it might be wise to really choose for either C or C++. Current source reminds me of C with C++ function naming just for looks. I think that could've been done by giving the functions proper naming. Correct me if I'm wrong on this though, I only skimmed through your code.

Link to comment
Share on other sites

@stefan:

first of all, i apologize for the lack of contribution :-[

anyway, on to the topic. i very much agree with you on that one (about rewriting the source) :) right now im currently skimming through the sources of `battle for wesnoth' (its a turn-based strategy just to let you know) and trying to `learn' from it. as for suggestions, [edited it out] ill write something up...

@Dark Knight ez:

[edited off topic] thanks for the heads up anyway! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...