Jump to content

Dune 2:TSHA Beta download 2 now up


Recommended Posts

I just updated the download blurb to include a couple notes on the controls.  Right now, only hotkeys are used to activate the commands.  Clicking on the tiny order buttons during a game would be crazy anyway.  The controls are similar to Dune 2.  Select a unit, then hit a key for the command, and then click on a destination.  Right click to cancel anything.  If you need more info, please see the forums at http://dune2.workpad.com.  Thanks for looking!

Link to comment
Share on other sites

@Andrew, select it, press V (look at the right, the letters for actions are yellowish) and then click to move.

I played it a bit, but i got some suggestions:

- in the menu, somehow show a mouse and let it respond so that you can go further. I had to guess and press ESC in order to find out that i can move on

- in the game itself, how do i quit? I used CTRL-ALT-DEL, the ESC key did not work. Nor any ALT-Q, Q, CTRL-Q combination.

The gameplay style is different, but its quite good.

* Sandworm bug: When the sandworm eats my unit, well, it did show the animation but my unit was still there (it was just moving and the sandworm should have grabbed him).

All in all, nice clone!

Link to comment
Share on other sites

Hey there Stefan,

Thanks for checking it out!  Actually the ways to get past the menu and exit the game were posted right at the top of the page you downloaded the file from.  ;D  Control-X exits for now.

The worm thing has been a little difficult to square away...  When it erupts from the sand, the worm checks a certain distance for units to eat.  However, infantry have special modifiers to their visual locations depending on which of the three spots in a single cell they are occupying, so while graphically the unit is walking on a sandworm, in the code he's actually in the middle of his cell, too far away to be eaten.  It's a loose end I need to tie up, so thanks for bringing attention to it.

Can I ask, what did you think of the interface?  I hate the whole box-selection thing in other games, so I'm avoiding it like the plague.  I always have to re-do the box several times to get exactly the units I want.  Have you tried out the control-groups and formation movement?

Link to comment
Share on other sites

I did not look to deeply into your game yet to get groups/formation working, i guess its with CTRL-<number> ?

For a selection-box; i just do a conversion from pixel->cell and then determine which units are in these cells (and valid to select). However, when in the middle of a cell, the cell is not taken with the selection, so i have to fix that up someday.

For the worm; well, i only let the worm eat (oops, did i just spoil a new feature for demo 2?) when its 100% sure he can eat ;) So when he eats, your unit is gone!  My only 'problem' is that my worms eat until no more units are left. I don't want to make a counter so that it stops eating after 3 units, instead i want to do a timer. Everytime he eats, the longer it takes to eat another unit.

Link to comment
Share on other sites

By the way Stefan, I just checked out your latest Demo.  I like it quite a bit, although of course I prefer my control interface. ;)  The graphics your team came up with are pretty snazzy.

Yeah, the control-groups work just like other games.  Control + number to create a group, press the number to select the group, and press the number twice to select and center on the group.

For the box-selection, what I meant was that while playing a game that uses that method, I always get frustrated with the accuracy and shape of the box, and I typically have to re-drag the box more than once to get exactly the units I want to select.  I don't like that kind of inefficiency, so I'm opting not to use it in TSHA.  In terms of coding, I've done that kind of thing before so I wouldn't see a problem implementing it.  Instead of a pixel -> cell conversion based on the edges of the box, have you tried distance formulas for height and width?  Get the centroid of the rectangle, measure distance to each cell for x and y?  Or would that take too many cycles?  By the way, how do you control your cells?  Arrays? (remember I don't know much about coding in C)  Or is there another thread for questions like these?

I like your ideas for the worms, especially the timer between meals.  Since you are using the "traditional" worm style, can they be "killed" like in the old game?  I opted instead (currently at least) to use worms as spontaneous events, triggered by movement.  I wanted traveling over the desert to be really risky for heavier units, to add some strategy to the game, so I didn't want the worms to be removable, which meant they shouldn't even be attack-able, which meant they wouldn't really be units, so I made them into more of a randomly-appearing weapon firing.  The visible effect is almost the same, but I still have a lot of kinks to work out there.

Link to comment
Share on other sites

I have some suggestions too:

-Being able to select enemy units to see their health.

-Using the border to scroll instead of holding Shift.

-Being able to select a new unit without deselecting an old unit.

-Removing the 5 second delay to build a Concrete Slab.

-How do I upgrade a building?

-Faster unit movement speed.

Link to comment
Share on other sites

I don't do distance checks in my drag box, does not sound like a handy thing to do for me (also more cycles, yes).

For cells;

I have a map class; it has cells (the squares on the map). Each cell is a struct, defined like:"

struct tCell


    int credits;        // harvesting

    int type;          // refers to gfxdata

    int tile;          // * 32 (on x scale)

    int smudgetile;    // smudge tile id

    int smudgetype;    // smudge type id

    int health;        // walls

    bool passable;      // pathfinder (TRUE = default)

    int id[4];          // ID of

                        // 0 = unit

                        // 1 = structure

                        // 2 = air

                        // 3 = worm


So for each cell i access i can retrieve data. What unit is on the cell? Ie, an air unit, worm and normal unit can be on the same cell. I can easily access their data by:


from the upper code i get an index to the unit i need.

For calculating x,y into cell and vice versa i have helper functions.

Cells give me the possibility to load dune 2 scenarios easier (since it does not need a 'translation'). It also works pretty handy in some cases. Also, i think it was done like this in those times to save memory somehow (instead of 1 short int, they had 2 to make map[x][y]). Or perhaps the cell was only formed for loading/saving procedures. I have no clue.

@ DEMO 1

The graphics are superb yes, i owe a lot to the team who worked on them. The new demo will blow you away feature-wise and graphical-wise. I do intent to release an old-skool package so it looks like the real dune 2 in the old days. (and that will give you a real nice comparison how much nicer the graphics are made and what a hard work was put into that).

Link to comment
Share on other sites


-Being able to select enemy units to see their health.

That's never something I was crazy about.  You can't get detailed information, but you can see if they are smoking or not when you shoot them.  I think that's enough.

-Using the border to scroll instead of holding Shift.

I tried that, and found that with today's interface, it was just too clumsy, and could frustrate the player by moving the map when he didn't want it moved.  Using the left Shift key is based on the left-hand-hotkey thing.

-Being able to select a new unit without deselecting an old unit.

Que?  You can already do that.  You can select as many units as you want just by clicking on them.  You can't, however, select buildings and units together.

-Removing the 5 second delay to build a Concrete Slab.

Concrete versus no concrete is an element of "time vs. money" strategy.  I like the idea of building concrete taking a little while, to offset the advantages gained later on through lower upkeep.  It's a forward-looking sacrifice, and it can be avoided if the need is urgent. 

-How do I upgrade a building?

All upgrades are global, and done at the House of Ix, which can be built much earlier than in the old game.

-Faster unit movement speed.

Why?  Given that units in TSHA do not pause between cells like they do in the original game, I think units are much faster on average already.


Yeah, I imagined the cell structure was based on memory requirements and the desire to redraw so many terrain tiles without extra cycles.  It sure as hell made my job easier when I designed the randomized map system, I tell you that.

I use a simple array system instead of classes for my cells, so that I didn't have to iterate through them to find a desired one (which is a handicap of Blitz; Is it the same for C?).  I declare a 128x128 array for each characteristic a map cell can have.  I also have a lot of things that don't conform to the cell structure though, such as craters and flying units, so things seem pretty flexible.

Link to comment
Share on other sites

Basicly the cell structure = nothing more then a liniar approach of X,Y. Nothing more, nothing less.

So instead of accessing your data via:


you do it by:


So, about being extendible, there is no difference.

Writing in C means unlimited borders; since the only borders you have are the ones you created (idealy).

If you take a look at my game, you can see a lot of effects, and not all of them deal with cells at all ;)

Link to comment
Share on other sites

By the way, sorry everybody, but I messed up the latest download.  If you got it before today (2/3/06), you will want to re-download it.  In my haste to get the download out, I messed up a variable controlling when a harvester could unload, and inadvertantly made it so they would never do so.  This has been fixed, so you can harvest to your heart's content now, and go through the entire tech tree to experiment with everything.

Link to comment
Share on other sites

I am redownloading;

Funny; after i read your development blog and read your explenation what went wrong, i could not help thinking of the C compiler which would kick my ass for:

1. creating a variable which i do not use

2. trying to use a variable that does not exist

Is this language you are writing your game in, like basic? Assuming anything is a variable as int?

Link to comment
Share on other sites

It is one of the BASIC spin-offs, although as I understand it, the structure is closer to C (what with Classes and all).  I can declare local and global variables, but if it hasn't been declared, the compiler assumes it is local to the current function.  So, when my Harvie was checking to see if it had reached the spice storage limit, it checked a new local variable ini'd at 0, instead of the correct spelling of the global variable.  Annoying, I know...  But Blitz has a ton of built-in libraries for gaming, and it really couldn't be easier to put graphics on the screen, 2d or 3d.  I've only been on this project for 4 months now, so that's got to say something for ease of use (although I've been working in a fever on it).

Link to comment
Share on other sites

well, basicly writing an rts game is not hard when you know the basic steps. Blitz is apparently a language which is very easy to use. In C its also not hard to do, just reads a bit harder. Here is a snippet from my code; i bet you can understand it:

// Make shimmer
void Shimmer(int r, int x, int y)
  // r = radius
  // X, Y = position


    Each X and Y position will be taken and will be switched with a randomly choosen neighbouring

    Shimmer effect is done on BMP_SCREEN only.

  int x1,y1;
  int nx,ny;
  int gp=0;    // Get Pixel Result
  int tc=0;

  // go around 360 degrees (twice as fast now)
  for (int dr=0; dr < r; dr+=2)
    for (int d=0; d < 360; d++)
      x1 = (x + (cos(d)*(dr)));
      y1 = (y + (sin(d)*(dr)));
      if (x1 < 0) x1=0;
      if (y1 < 0) y1=0;
      if (x1 >= game.screen_x) x1 = game.screen_x-1;
      if (y1 >= game.screen_y) y1 = game.screen_y-1;

      gp = getpixel(bmp_screen, x1,y1); // use this inline function to speed up things.
      // Now choose random spot to 'switch' with.
      nx=(x1-1) + rnd(2);
      ny=(y1-1) + rnd(2);

      if (nx < 0) nx=0;
      if (ny < 0) ny=0;
      if (nx >= game.screen_x) nx=game.screen_x-1;
      if (ny >= game.screen_y) ny=game.screen_y-1;

      tc = getpixel(bmp_screen, nx,ny);

      if (gp > -1 && tc > -1)
        // Now switch colors
        putpixel(bmp_screen, nx, ny, gp);
        putpixel(bmp_screen, x1, y1, tc);



Link to comment
Share on other sites

Looks like your code for the Sonic wave effect?  Here's my stuff for same:

fvSonicstartX = (fvlx)-fvSonicRange

fvSonicstartY = (fvly)-fvSonicRange

fvSonicendX = (fvlx)+fvSonicRange

fvSonicendY = (fvly)+fvSonicRange


For sx = fvSonicStartX To fvSonicEndX

For sy = fvSonicStartY To fvSonicEndY

If Sqr((sx-(fvlx))^2 + (sy-(fvly))^2) <= fvSonicRange-1 ;alter appearance of all pixels in range

If sy+2 < 480 And sy-2 > 64 And sx+2 < 507 And sx-2 > 0 ;if within game window

fvColor = ReadPixelFast(sx,sy)

fvMixX = Rand(-2,2)

fvMixY = Rand(-2,2)

WritePixelFast sx+fvMixX,sy+fvMixY,fvColor






Basically it takes a small-as-possible array of pixels, asks if they're in range and on the board, and then moves each one's color value up to 2 pixels away in a random direction.  I'm sure it's not as fast as C in the end run, but you can see how quickly things like that can be added.

My code's up to 13000 lines now... Can I ask where yours is at?  I know I need to buckle down and just learn C at some point in the future, but it's hard to argue with the speed of game creation I get from Blitz.  Keeping up a head of steam is easier for me when the results come more quickly.

Link to comment
Share on other sites

basicly thats the same as i do; though i need to read pixel data first, in order to shift it with another pixel. So thats what i do.

My total amount of lines of code? Depends how you count that. I do not count libraries i use, since i did not write them.

Counted from latest source of upcoming DEMO 2:

AI.cpp - 599 lines

bullet.cpp - 512 lines

common.cpp - 1577 lines

game.cpp - 4216 lines

ini.cpp - 2664 lines

main.cpp - 938 lines

map.cpp - 2172 lines

math.cpp - 416 lines

particle.cpp - 609 lines

player.cpp - 133 lines

regions.cpp - 453 lines

structures.cpp - 1484 lines

unit.cpp - 3065 lines

total amount project: 18838 lines

and growing....

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.

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.