Jump to content

Dune 2 - Windows version (my Dune 2 clone/project) getting shape!


stefanhendriks

Recommended Posts

afaik it does not have any networking functions built in. However, there are some people giving advice about good libraries which are pretty good. I did not really search for any networking library yet, as i am not experienced in network programming i won't be worrying about it till i finish the actual game.

Link to comment
Share on other sites

true. I might even try to use the same engine to get a new arrakis version done, or just for fun as a demo to show how easy it is to modify stuff in the engine and such.

I still don't know how to acces the http server of dune2k as a matter of fact. I am sure we can solve these things so i can update the page when needed. If you could mail me to s.hendriks2@chello.nl with some details or whatever then we can settle these things. My current dune2k mail still awaits over 500 mails to be recieved which 90% are virusses. Is there a way to delete them on the server before i even recieve them? (aka, is there a virus scanner on the server?).

Link to comment
Share on other sites

on-topic: I cant wait to finish it either, but i dont that much time. However, i take it easy and it will be released 'when its done'.

Converting ASM is well,a lot of work! I know some people who wrote/write programs in ASM (mostly library functions) and its amazing how they get stuff done.

Don't expect super advanced code from my Dune 2 clone, i always to it the easy way and probably the first release will be so easy to optimize it probably requires a few releases after that to be 'fully' completed. Anyhow,it would be cool if someone could implement networking for instance, that would be so cool :)

But this function isn't a lot of work. It's only 24 assembly commands but... in Amiga assembler and I can only convert it to plain C to make it useful to PC users.

If the second part is directed to me then... what's the point?

I do not require advanced code in any way. Sincerely I couldn't write

something like you do. I'm publishing things that I've been looking for during the analyzing of the code and consider them useful.

Link to comment
Share on other sites

it was not really directed to you personally Minniatian, more in general.

I prefer writing clean code and easy understandable instead of super fast optimized code which is hard to read. Thats all i meant ;)

I am considering releasing a demo when you can build bases, nothing more , nothing less. Maybe i release the source with it, but i am thinking of it not to do so because it is not finished. Maybe i will send it to just a few people who would really like to see it (if you want, i can send you the current status if you want to read the code so far, but don't expect a reall clean code as i want it to be).

Anyhow, my code is mostly commented. Actually, sometimes it looks more like a commented part then real code. ;)

snippet:


// Give correct facing angle, used in MAIN.H
// note: Not to be used with drawing yet, use convert_angle() with this result first then
int face_angle(double angle)
{
int a = (int)angle;

// chop 360 degrees in 8 pieces
int chop = 45; // 45 degrees is one chop

// 360 degrees is UP, 270 = RIGHT, 180 = DOWN, 90 = LEFT, 0 is also UP
// when deviding 360 / 45 you will get results like:
// 360 = down
// 0 = up, etc

// Because 360 is UP, we need to reverse it now
a = (abs)(a-360);

// we now can return the correct facing, but do note that this value is not how the
// picture is stored in our 8bit pictures. The drawing routine will fix this up for us
// its a pain in the ass but i hate the unlogical order which Westwood used to put their
// units in and i dont want to recode stuff here now.

return (a/chop);
}

and if you wonder about the convert angle routine:


// Converts the face_angle produced with the function above, into a correct number for drawing
// correctly.
int convert_angle(int face_angle)
{
// Drawing works like this:
// The unit looks at the RIGHT at the 1st picture. So you start at position 0,0 and copy the
// correct part of that unit (using the properties given by the unit structure database). When
// a unit looks a different way, you use this number to multiply by the width of a frame in
// order to start at the correct positions.

// Due the fact that we use 0 as UP , and since WW uses 0 as RIGHT, we have to convert.
// another problem is that we go clockwise and WW does NOT.

// I am gonna be robust in this, i wont think of any fancy formula, but just hardcode this
// shit and do something usefull. Grmbl



// How the real facing is................ and what it should be for drawing... (multiplier!)
if (face_angle == FACE_RIGHT) return 0;
if (face_angle == FACE_UPRIGHT) return 1;
if (face_angle == FACE_UP) return 2;
if (face_angle == FACE_UPLEFT) return 3;
if (face_angle == FACE_LEFT) return 4;
if (face_angle == FACE_DOWNLEFT) return 5;
if (face_angle == FACE_DOWN) return 6;
if (face_angle == FACE_DOWNRIGHT) return 7;

return 0; // just to make the compiler stop whining ;)
}

see? :D

Link to comment
Share on other sites

yeah, i could use switch, true.

32 bit code easier then 16 bit? I dont know what you mean exactly.

About the offsets, i don't know actually. I extracted the units from the Dune 2 pack files, and the first one was pointing to the right (if i am correct). I use the Dune Legacy bmp files (because i dont need to assemble them myself then) and they follow the Dune pack file order if i am not mistaken.

Link to comment
Share on other sites

i won't release anything 'alpha'. I will probably release a version where you can harvest stuff, build a huge base and such. Maybe even kill something (though the AI will be ZERO).

I am not experienced in Network coding. But i do include an empty source file with some comments in it to give general ideas and thoughts. The engine is capable of handling 'clients' i think, because you can set flags to specific 'think' functions for each player.

Example:

- you have a REAL player (you)

- you have a CPU player (computer opponent)

- you have a CLIENT player (not you, nor computer, it only recieves data and acts as the 'other side' does).

the 3rd is on paper, its a sketch, its an idea. it is not really coded. It does have some flags here and there built in, but i don't know how to do networking so anybody who does know could try to implement that.

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...