July 31, 2010, 06:35:59 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Member Map Members Login Register  
Pages: [1]
  Print  
Author Topic: Dune 2 SDK  (Read 883 times)
Minniatian
Sandwalker

Offline Offline

Posts: 76



View Profile WWW
« on: November 11, 2009, 09:19:05 »

Hi! Today I copied all Dune 2 database from my Amiga hard disk to PC and examined it. There is many interesting stuff worth publishing. I'm working on the WWW page which will contain the informations gathered about Dune 2 sources, but here I would like to publish very interesting thing: Dune 2 main loop! It describes how the things are done during the initiation and gameplay:

Dune2 Main Procedure:

  • Allocate memory for data
  • Show game Intro
  • Show Menu and process menu events
Main Loop:

  • If House is not specified Ask For House
  • Clear data buffers - clear various data buffers
  • Read Icons
  • Init Color Convertion table
  • I called it Buffer Manager - it works on Graphics Buffers
  • If scenario is not loaded Load New Scenario
  • Setup Boolean Maps (used for map Shroud)
  • Set Graphics Buffer to 0
  • Process Buttons of graphics user interface
  • Show Unit Description at text panel
  • Redraw Side Bar - redraws all side-bar related graphics
  • Process Mouse Events - processes selection and map scrolling
  • Print amount of Credits
  • Get Key Event
  • Process All Units on map
  • Process All Structures on map
  • Redraw Map
  • Init Text Panel
  • Check Win / Lose Conditions. If mission completed exit loop
Done! Do you have any questions related to this?
« Last Edit: November 11, 2009, 09:20:53 by Minniatian » Logged

Author of EMC patch, scenario converter for Amiga and map generator for Dune 2.
Nyerguds
Swordmaster

Belgium
Offline Offline

Posts: 850



View Profile WWW
« Reply #1 on: November 11, 2009, 09:33:09 »

looks pretty much the same as C&C Smiley
Though a lot of the checking for keyboard commands, redrawing the sidebar, playing the music, and stuff like that, are all separate threads.
« Last Edit: November 11, 2009, 09:43:13 by Nyerguds » Logged

Minniatian
Sandwalker

Offline Offline

Posts: 76



View Profile WWW
« Reply #2 on: November 12, 2009, 01:03:45 »

Here is a Structure Handling - it's very easy:

  • Get First Structure
  • Handle Palace - beacuse it's special building
  • Update Side Bar
  • Do trivial damage
  • Upgrade Progress
  • Repair Progress
  • Construction / Repair Unit progress
  • Execute EMC script for that building
  • Get Next Structure

DID YOU KNOW that Palace is repaired for free because its HP is very high so the repair costs evaluated by the division is zero! Smiley

Unit Handling is easy too:

  • Timing Stuff - so the handling is performed every period of time
  • Get First Unit
  • Turret angle stuff
  • Movement / attack stuff
  • Rotation stuff
  • Deviated unit stuff
  • Execute EMC script for that unit
  • Get Next Unit

Global display refreshing is as follows:

  • Display iconmap in current view
  • Display sandworms
  • Display cursor
  • Display all ground units in display
  • Display extra animations (this is for example explosions)
  • Display air units

Greets! I hope it will be of any help for people which write Dune 2 clone projects Smiley

Logged

Author of EMC patch, scenario converter for Amiga and map generator for Dune 2.
Xaroth
Sandwalker

Offline Offline

Posts: 63



View Profile WWW
« Reply #3 on: November 12, 2009, 01:15:16 »

Nice work on the list, hopefully OpenDUNE will be able to expand on that list with more detail where it applies, like in this bit:

DID YOU KNOW that Palace is repaired for free because its HP is very high so the repair costs evaluated by the division is zero! Smiley

TrueBrain made a post regarding this, to explain it in a bit more detail:
http://forum.dune2k.com/index.php?topic=20212.msg348627#msg348627

also, one small 'wtf' moment I got.. is the cursor actually being drawn before the rest of the units?
Logged

Lead Manager OpenDune
Minniatian
Sandwalker

Offline Offline

Posts: 76



View Profile WWW
« Reply #4 on: November 12, 2009, 01:50:24 »

Thanks for the link.

Your question: Yeah, the cursor actually is being redrawn in Unit Drawing part of the routine if the unit is current! So the cursor appears over the current unit.
Logged

Author of EMC patch, scenario converter for Amiga and map generator for Dune 2.
Minniatian
Sandwalker

Offline Offline

Posts: 76



View Profile WWW
« Reply #5 on: November 12, 2009, 03:38:55 »

Here I attach as a ZIP file Side Bar redrawing procedure translated to C. It contains also many functions and structures that appears in Dune 2. So this is second function (besides seed map generator) which I wrote based on the ASM source. Notice that this function is based on Amiga version of the game thus it refers to some Amiga structures and functions like for example RastPort - this is structure used in rendering into display. Later I will gather all the info into WWW page.

All functions in this source are based on original, and this code can be compiled on Amiga to working one (I tested it and it generates SideBar exactly like Dune 2 does). Note that I didn't touch this code for a couple of years, it's copied from my database.

Note that the Side Bar rendering function only renders things that were changed since last call to this function.

Besides this function I translated to C also the Shape Color Convertion function, Flip Shape function, basic drawing functions like Draw Line and Rect Fill and it's probably all. But I still have much stuff that is incomplete and needs description before I can publish it.
Logged

Author of EMC patch, scenario converter for Amiga and map generator for Dune 2.
Minniatian
Sandwalker

Offline Offline

Posts: 76



View Profile WWW
« Reply #6 on: June 24, 2010, 08:44:50 »

Hey, here's a link to Function List of Amiga version of Dune 2. The list contains only brief description of functions but more detailed description will be placed further on my homepage. The functions are sorted by addresses. Of course it's incomplete list and still needs much work.

The begin/end are the addresses in memory where the code was relocated.
The type is the CODE, JUMP (jump addresses) or DATA

I hope my work will help in OD2 and OpenDune projects. If you have any questions please feel free to write.

Here's an example:
68167236 68167338 CODE  Reveal_Terrain( Pos, Sight )

This function reveals terrain at position Pos and within Sight radius.

Here's a description of some terms I use:
Interface Region - this is just button!
Screen Region - this is a part of the screen (map, mini-map, sidebar, topbar etc.)
Carrier - this is the container that can be a cell, unit or structure.
Logged

Author of EMC patch, scenario converter for Amiga and map generator for Dune 2.
MrFlibble
Moderator
Shai Hulud

Russian Federation
Offline Offline

Posts: 2838



View Profile
« Reply #7 on: June 25, 2010, 02:02:23 »

Nice, thanks for input! BTW, I it seems that the guys from the OpenDUNE don't frequent our forums here, so maybe you'd also post this at their forum too?
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.349 seconds with 17 queries.