Author Archive

OpenClonk 2.2 released

Posted in Announcements on February 10th, 2012 by G – Be the first to comment

This is a bug fix release. Most importantly, the game should now work correctly on 64 bit Windows. There are also windows installer improvements regarding firewall and “Games Explorer” integration. A couple of cross-platform crash fixes are in there as well. A more complete list is available from our repository web interface.

Downloads are at the usual place.

Next up will probably be a 5.3 beta with some settlement scenarios. If you want to help with testing those before then, check out the development snapshots.

OpenClonk 2.0 released

Posted in Announcements on October 1st, 2011 by G – 8 Comments

It’s been 9 months since the last full release. Time for another one! The most visible changes since 1.2 are:

  • The landscape is drawn in higher resolution
  • The Macosx port has an editor like the other ports
  • A new scenario Scorched Garden, and a redesigned Overcast

But there are a lot of smaller changes and improvements as well, especially for people who want to write their own game content.

Download here

You are advised to first uninstall OC 1.2 before you install OC 2.0 as the game data of it is incompatible with the previous version.

This version shall be the foundation on which finally the mines, production lines and generally the settlement is implemented. The start signal has already been lit with this forum post from Clonkonaut. If you are interested to contribute, just talk to him or reply to this forum post.


The full list of changes


Script - general:
* Removed DefCore entries Edible, Prey, Growth, NoSell and Rebuy
* Removed OCF_Edible, OCF_Prey, OCF_Living
* Differentiate between COMD_None and COMD_Stop
* Empty function parameters default to nil instead of 0
* obj->~foo() cannot have whitespace between -> and ~ anymore
* arr[-x] returns the x-th last element of an array now, arr[i:j] ranges
* Scenario.txt: Definition1 defaults to Objects.ocd
* Added RelaunchPlayer callback which is called after last crew member died

Script - functions:
* Added function DigFreeMat
* Changed functions SetSkyParallax, BlastObjects, ScheduleCall, AddMsgBoardCmd, GetDefinition (all documented)
* Fixed functions HSLa, SetGraphics, GetTurnDirection, CreateScriptPlayer
* SetPlrExtraData and SetCrewExtraData can store strings now
* Removed unimplemented Par(n)=foo
* Removed reference parameters for functions

Script - properties:
* Replace the sorting functionality of Categories with a Plane property
* Removed trainable and permanent physicals from the DefCore, they are now (Action) properties
* Replaced Collectible and Grab DefCore value with Collectible and Touchable property
* Effects are now also proplists
* Effects can declare named variables (properties), removed EffectVar()

Engine - general:
* Changed OpenClonk file extensions to ocs, ocg, ocd, ocf, ocp, oci, ocm, ocb, ocv, ocl and ocu
* Added UTF-8 support
* Removed loading of BMP definition graphics and portraits
* Log to record file, too, when recording
* Removed portraits
* Revive the possibility for rivalry in the round evaluation dialogue
* Load additional player control defs from definition local System.ocg files
* win32: Log a stack trace on assertion failure
* win32: Remove duplicate file type association code from the engine
* TONS of code cleanup work
* Fixed various mesh loader bugs (#602,...)
* Fixed various memory leaks
* Fixed player properties dialogue
* Fixed various savegame issues
* Fixed crash when script players join the game (#571)
* Fixed wrong video mode selection
* Fixed unable to change resolution and fullscreen (#600)
* Allow resolution change with mismatching display refresh rates
* Fixed hang on exit
* Fixed solidmask zoom on zoomed graphics (#639)
* Fixed viewport drawing in fullscreen mode
* Fixed miscellanous win32 and sdl issues
* Removed unconditional infinite loop in C4GameObjects
* Fixed a possible access violation through effects
* Fixed /help notice is not correctly displayed in IRC chat and removed RWD notice
* Fixed joining network game in edit mode (#649)
* Don't complain about invalid topfaces for mesh graphics
* Fix control assignment set sortingby priority  (#641)

Game logic:
* Structures do not automatically remove snow and flyashes
* Corpses can burn
* Do not change Controller on Enter for Alive non-C4D_Livings
* Solidmasks can also move floating objects
* Material objects dug free can be forced to be collected

C4Script interpreter:
* Added a standalone C4Script interpreter
* Various improvements and optimizations to the script interpreter
* Correctly backtrace C4Script exceptions
* Optionally warn about empty function call parameters and array expression entries
* Do not print a deleted-object-warning while warning about that object
* Remove some unnecessary inspections of callers of builtin functions
* Fixed crash when parsing a function call with more than ten parameters
* Fixed crash trying to display stringtable-not-found error message (#588)

* Added Antialiasing feature
* Added high resolution shader landscape rendering
* Added possibility to animate material textures, added animated water
* Digging and blasting now produce more natural shapes
* Separate graphic for "Mouse Over" for main-menu buttons and Icons
* Zoom of GUI elements is dependent on viewport resolution
* Impoved map to landscape algorithms to create a smoother landscape

* Lots of GTK editor enhancements
* Lots of Mac cocoa editor enhancements
* File/Save creates a savegame when the original scenario was one
* File/Save Game As correctly preserves the Origin
* Fixed various crashes in editor mode
* Fixed various GTK editor issues
* Fixed various Mac cocoa issues
* Fixed property window doesn't open in editor (#635)
* Fixed a crash on reload definitions (#76)
* Fixed crash when opening a second viewport for the same player
* Fixed window creation in editor mode
* Fixed possible crash on initial window creation
* Fixed starting the engine with a scenario with a trailing slash
* Fixed infinite loop if the first scenario failed to load (#592)

Win32 Installer:
* Installer creates a startmenu shortcut that launches the editor
* Only register the uninstaller with add/remove programs
* Cut unnecessary pages from the installer

* Fixed FindNextEntry
* Removed unused -a, -m, -e, -d, -r, -o commands
* Removed Maker information.

Game Content

Game content - general:
* Added control: collect (into backpack)
* Added script-side bubble implementation (removed engine-side implementation)
* Added script implementation of the fire effect
* Finish balloon with sound and graphics
* correct the display of the rope and grapple hook and the clonk's position on it
* Fixed water jump
* Fixed friction values for the Rock
* Reset clonk action when they enter a plane
* Cannon and lorry don't fall off the sides of the map
* Parkour: Safety against creating checkpoints outside landscape bounds
* Parkour: checkpoint may now clear materials behind it
* Applied friction to ore (no more phasing for ore)
* Fixed a C4Script runtime error for unavailable hotkeys
* Usage of item is cancelled if (another) item is thrown
* Stop can now return -1 to keep that object as used object (part of #483)
* Prevent clonk from swimming in solids
* Remove unused MGranite
* Fixed cannon rotation
* Performance optimizations for the backpack and health/breath tubes
* Prevent HUDadapter from throwing runtime errors for non-crewmember clonks
* Fix grappler also shots on cancel
* Grappler: fixed division by zero (#613)
* Clonk now moves his legs while aiming with the bow (#640)

Graphics and Sound:
* Added new HUD
* New textures for ruby, ametyst, bricks, earth and snow
* Replaced a sky texture
* New clonk-head graphics
* Removed Cursor graphics in different sizes
* More detailed crosshair graphic
* Changed graphics of earth to look like earth more
* Changed Marker visuals of the flag
* Tweaked musket animations
* Fixed sword visuals a bit
* Clonk doesn't contort or moonwalk when using shield with right hand
* New graphics for the powder keg
* Changed snowflakes to be much smaller
* Added splash effects for swimming
* Added a backpack graphic on the clonk's back
* Fixed and improved some Clonk animations, added chop, dive and magic animation
* Added graphic rotation during scaling and animation for scaling top corners
* New winch graphics
* Fixed animation glitch for KneelUp animation (#328)
* Added new icons for scoreboard
* A bunch of new and/or improved frontend graphics
* Clonk doesn't stop digging automatically when he hits a wall

* Added Scorched Gardens deathmatch scenario with telekinetic gyroglove
* Hideout: Fixed warnings, removed floating edge
* MoltenMonarch: Fixed landscape (bottom lava)
* Overcast: Completely redesigned
* Tutorial 4: Fixed opponent creation
* Tutorial 4: Fixed AI movement for swordman
* Guardians of the Windmills: fixed evaluation data
* Remove some tools from shiver peak
* Removed clouds blocking the view in Shiver Peak
* FrozenFortress, Hideout: CTF goal set to fix 2

* Added Clonk can roll off
* Clonk can jump off walls (with new animation).
* Clonk cannot control his movement while tumbling anymore
* Changed maximum walking speed of the Clonk by 0.04 pixel/frame to fit jumping speed
* Jumping acceleration lowered by 0.2 pixel/frame
* Musket does 15 damage now instead of 10 (the bow does 6-12)
* No jumping facing backwards


Parallax Scrolling and Zoom

Posted in Development on October 12th, 2010 by G – Be the first to comment

Clonk has supported parallax objects and backgrounds for a while. Parallax scrolling is a method to create a faux 3d effect with only 2d methods by making objects move slower or faster when the imaginary camera moves across the landscape. This approach generally works well, but the effect this had when the zoom level changed was unfortunate. Instead of simply making parallax objects and backgrounds look the same way as the other objects when zoomed, Clonk-Karl and I figured out how they would behave if they really were before or behind the landscape. The first question we had to answer what different zoom levels represented in that virtual world: Does the distance between camera and landscape change, or do the camera optics, like a zoom lens? We eventually came to the conclusion that we needed both: the zoom lens to ensure that every player sees about the same picture independent of the pixel count of their monitor, and the distance change to represent zoom. While real-world zoom uses a zoom lens, real world unmodified humans do not, so changing the virtual distance should feel more natural.

Figuring out how the objects should display on a diagram was straightforward after that. Put a point for the camera, one line for the landscape and screen (the landscape always is on the same plane as the screen, because the screen is what keeps the sky islands from falling down), and one line for the object, and then draw lines from the edges of the object to the camera. The object should be displayed were those lines cross the screen. But we needed several iterations translating that to the formulas used in the engine because we hadn’t fully internalized what the given values meant. The position of the object is not where the object is in the virtual world, but where it is displayed on the landscape when the camera is at position 0/0, and the zoom factor is 1. And the camera is at position 0/0 when the upper left corner of the screen is there. It’s as if only the lower right quarter of the camera’s view is displayed. The reason is that the parallax math works out rather nice this way: When translating from landscape to screen coordinates, the position of the upper left corner of the screen is simply multiplied by the parallax factor and subtracted from the object’s position. But our first diagrams had the camera positions in the middle of the screen, which was confusing because it introduces the screen size into the formulas, which we knew is not there in the engine code.

We finally arrived at what we believed were the correct formulas and put them into the engine. The result was for the most part satisfactory, especially the sky behaved nicely. But objects moved around on the screen when changing the zoom factor while moving as expected when just moving around. I finally discovered why when constructing this diagram a few days later:

A diagram showing the positions of the camera, landscape and a parallax object

The diagram shows a view from the side on the camera, landscape and one object. Because the formulas for X and Y are independent and identical, only one dimension is shown.

The black distances are given, the red distances are the ones we want to calculate. The green ones are intermediate results. The dashed lines are the lines of sight between camera and object.

At the top left of the diagram is the camera that defines the internal object positions: The position of an object is where this camera would see the object in the landscape. A bit to the right is a camera at position 0/0, but with a different zoom factor (called “Zoom”). Our first version mixed this camera up with the first one. This doesn’t matter for objects at position 0/0, which explains why the sky worked correctly: We only tested in a scenario where the sky doesn’t move with the wind.

Down from the second camera is the third one, the one for which the calculations are to be done. It has a distance of “TargetX” from the origin, and a zoom factor of “Zoom” like the second camera.

At the right there’s the object to be displayed. This one is behind the landscape, but fortunately the formulas work just as well for an object before the landscape. It’s distance on the Z axis from the first camera is “1/Par”, where “Par” is the parallax factor. Consequently, the distance to the landscape is “1/Par-1”, because the first camera has a distance of “1” from the landscape. The position in the virtual world on the X axis is “VX”.

Once I had this diagram, calculating the result is a simple application of the Intercept_theorem.Those interested in the result can take a look at the C4Object::GetDrawPosition() function in the engine.