Author Topic: Very Interesting Indeed...  (Read 3118 times)

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Very Interesting Indeed...
« on: August 08, 2006, 09:43:25 AM »
Well, recently I had some time to dig deeper into the internals of OP2, and this is what I found. First, the screenshot:



I figured out how the report displays in the command pane worked, as well as the buttons on both the minimap / command pane.

With this knowledge I was able to create my own (functional) report display as you can see in the screenshot above.

And yes, the buttons work. You can see it in action:
http://hacker.outpostuniverse.net/report.dll

Launch the mission from the Run Script menu (Push 'D', click Run Script, select the mission).
Click the 'gear' icon (what is normally the Factories report). You'll get the report display as shown above. The 3 buttons do the following:
"Test Message" -- adds a simple message to the chat log.
"New Scout" -- creates a new scout at (32,32) on the map.
"No more free scouts" -- disables the New Scout button (Plymouth colony can only give you free scouts for a limited time, you know! :P)

And of course you have running counts of TethysGame.tick (the current game cycle -- 1 mark = 100 ticks), and GameMap.numUnits (the number of units on the map).

I'm continuing to work on this stuff. My plan is to find out how the lists work (such as the chat log uses) as well as other widgets. (like the vehicle control icons).

My original motivation? I got bored one day and wanted to look into how commands are issued inside Outpost 2. I ended up by starting where mouse click events get processed and eventually I began to figure out how the minimap pane, command pane, buttons, and reports worked.

Also, part of it was to learn how to create a control interface for the recording system player DLL. (Speed up / slow down, switch player, etc).

My intent is to write a library (along with other useful functions for accessing / modifying game internals) with this stuff to allow people to use these in their missions. Already a couple of people have expressed interest (for example, a way to replace the Unit selector in Mcshay's CTF).

I'll continue to post updates and new screenshots / DLLs as I learn more about the reports.

-- op2hacker

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Very Interesting Indeed...
« Reply #1 on: August 08, 2006, 09:47:43 AM »
Neato,

One of the first things i will do when the library is released is to edit the trade center pane to have the ability to trade resources and colonists.

Offline Betaray

  • Administrator
  • Hero Member
  • *****
  • Posts: 2897
Very Interesting Indeed...
« Reply #2 on: August 08, 2006, 10:50:41 AM »
now that will be sweet

"dude im starving" "its ok ill give you 2000 food and 10 scientists"
I am the nincompoop, I eat atomic bombs for breakfest, fusion bombs for lunch, and anti-matter bombs for dinner

I just hope they don't explode

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Very Interesting Indeed...
« Reply #3 on: August 08, 2006, 03:01:18 PM »
Great work mr hacker :D

thx as allways.

Offline Freeza-CII

  • Administrator
  • Hero Member
  • *****
  • Posts: 2308
Very Interesting Indeed...
« Reply #4 on: August 08, 2006, 03:56:51 PM »
Very interesting now will this give us any idea how the mini map works with colors and all that so we could add more colors or change the current ones with out gray being yellow on the minimap

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Very Interesting Indeed...
« Reply #5 on: August 08, 2006, 04:06:44 PM »
Possibly.

Because of this, I did find out how an object called a "GFXSurface" works (that's the name in the program, there is some RTTI information in the program).

The entire visible area of each of the panes has a GFXSurface (well, an object derived from GFXSurface called GFXCDSSurface -- basically it uses a DIB section to store image data) which all button/text/image drawing must be done on. (Various functions in the report and button classes are given a reference to a GFXSurface object which they can use to draw the button).

Anyway, I did run across the code that draws the mini map on the GFXSurface. I wasn't too interested in looking at how the minimap drawing actually works, however maybe I will look into it sometime.

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Very Interesting Indeed...
« Reply #6 on: August 08, 2006, 05:20:45 PM »
On the subject of mini-map drawing, it seems that the tactical view (or what ever the view is called where the ground is drawn by cell type) can be tricked into showing normal colored ground using SetTile().

In my greenworld maps, when I force tiles and cells on bridges to comply with my will, the bridges are colored normaly in both mini-map settings. There is a slight flash when you change the map setting to tactical, which is probably the time it takes for AIProc to use SetTile().
« Last Edit: August 08, 2006, 05:22:08 PM by Mcshay »

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Very Interesting Indeed...
« Reply #7 on: August 08, 2006, 05:51:33 PM »
Yeah, it might just replace the color on the minimap assuming it's in 'normal view'. Probably standard OP2 glitch. (we could fix that at some point)

They probably never picked it up since the only time SetTile() is used outside of InitProc is for volcano animation starting / stopping.

You could try using InitialSetTile() - I think that skips the minimap update. (Might skip a terrain graphics update as well).
« Last Edit: August 08, 2006, 05:51:57 PM by op2hacker »

Offline Arklon

  • Administrator
  • Hero Member
  • *****
  • Posts: 1267
Very Interesting Indeed...
« Reply #8 on: August 08, 2006, 06:40:25 PM »
Quote
Probably standard OP2 glitch. (we could fix that at some point)
Another thing you need to fix is, when meteors hit on blighted terrain, the meteor mark is drawn where the blight was on the minimap, so there's holes in the blight.

Offline Freeza-CII

  • Administrator
  • Hero Member
  • *****
  • Posts: 2308
Very Interesting Indeed...
« Reply #9 on: August 08, 2006, 09:15:09 PM »
I dont think we need to take it that far