Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Topics - Calin Leafshade

Pages: [1] 2 3 ... 11
Completed Game Announcements / Him - #AdvJam2016
« on: 21 May 2016, 01:32 »
Him - A Horror Adventure

A good old fashioned haunted house story.

Made by:
Calin Leafshade (@CalinLeafshade) - Words and code
Sookie Sock (@SookieSock) - Graphics

I'm trying to enumerate all the inventory items but I can't find any way to do it. Usually its something like character[ i ] but inventoryitem[ i ] doesnt seem to exist.

So how do I get an inventory item by its ID?

EDIT: Ha, ok so it *is* inventory[ i ], but that array is only defined when you have at least one inventory item. The same goes for the gui[] array.

All The Way Down

A horror adventure set in rural Yorkshire, England.

How to play

Left Click to Interact
Right Click to Look
Move your mouse to the top of the screen to access the inventory and save.


Programmed and Written by Steve Poulton (Calin Leafshade @CalinLeafshade)
Background Art By Hayley Griffiths (Sookiesock @Sookiesock)
Character Art By Matt Frith (Tier @MatthewJFrith)
Portraits By Victor Pflug (Pinback @modredcastleton)
Lead Voice By Drew Wellman (ddq @ddq5)
Shopkeeper By Rebecca McCarthy (Azure @azuresama)
Other Voices By Steven Poulton (Calin Leafshade @CalinLeafshade)



Advanced Technical Forum / Fatal Exception
« on: 10 Dec 2014, 20:36 »
I'm getting this error:

Illegal exception
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x004DC2AC ; program pointer is -42, ACI version, gtags (73,24)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and post the details on the AGS Technical Forum.

in "Utilties.asc", line 50
from "Utilties.asc", line 96

Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.

An error file CrashInfo.dmp has been created. You may be asked to upload this file when reporting this problem on the AGS Forums. (code 0)

Looks like it might be some scoping issue with nested for loops.

It happens in this function: (I will mark line 50)

Code: Adventure Game Studio
  1. function writeSpriteFont(int fontNum) {
  2.         String fontstring = "";
  3.     int i = 32;
  4.         for(i=32;i <= 126; i++){
  5.                 fontstring = fontstring.Append(String.Format("%c", i));
  6.         }
  7.         int w = GetTextWidth(fontstring, fontNum) + 5;
  8.         int h = GetTextHeight(fontstring, fontNum, w) + 2;
  9.         DynamicSprite *s = DynamicSprite.Create(w * 2,h);
  10.         DrawingSurface *ds = s.GetDrawingSurface();
  11.         Rectangle* rects[] = new Rectangle[127];
  12.         String metrics = "";
  13.         ds.Clear();
  14.         ds.DrawingColor = 15;
  15.         int x = 0;
  16.         for(i=32; i<=126; i++) {
  17.                 ds.DrawString(x,0,fontNum,String.Char(i));
  18.                 int ww = GetTextWidth(String.Char(i), fontNum);
  19.                 rects[i] = Rectangle.Create(x,0,ww,h);
  20.                 x += ww;
  21.         }
  23.         int top = -1;
  24.     int y = 0;
  26.         for(y = 0; y <= h - 1; y++)
  27.     {
  28.                 for(x = 0; x <= w-1; x++) {
  29.                         int p = ds.GetPixel(x,y);
  30.                         if (p != COLOR_TRANSPARENT) {
  31.                                 top = y;
  32.                                 break;
  33.             }
  34.                 }
  35.                 if(top > -1) {
  36.                         break;
  37.                 }
  38.     }
  40.         int bottom = -1;
  41.     int start = 3;
  42.     if (top > -1) {
  43.         start = top;
  44.     }
  45.         for(y = start; y < h; y++) {
  46.                 bool found = false;
  47.                 for(x = 0; x < w; x++) {
  48.                         Display("%d %d %d %d", x,  y,  ds.Width,  ds.Height); // <-- THIS LINE WILL ALSO CRASH IT.      
  49.                         int p = ds.GetPixel(x,y); // <-- THIS WAS THE OFFENDING LINE
  50.                         if(p != COLOR_TRANSPARENT) {
  51.                                 found = true;
  52.                                 break;
  53.                         }
  54.                 }
  55.                 if (!found) {
  56.                         bottom = y;
  57.                         break;
  58.                 }
  59.         }
  61.         ds.Release();
  63.         if (top > 0) {
  64.                 s.Crop(0,top,w,h);
  65.                 for(i = 0; i < 127; i++) {
  66.             if (rects[i] != null) {
  67.                 rects[i].y = top;
  68.             }
  69.                 }
  70.         }
  72.         if (bottom > 0) {
  73.                 s.Crop(0,0,w,bottom - top);
  74.                 for(i = 0; i < 127; i++) {
  75.             if (rects[i] != null) {
  76.                 rects[i].height = s.Height;
  77.             }
  78.                 }
  79.         }
  81.     s.SaveToFile("spritefont.bmp");
  83.         //now build metrics
  84.     File *f = File.Open("metrics.txt",eFileWrite);
  85.     for(i = 0; i < 127; i++) {
  86.         if (rects[i] != null) {
  87.             f.WriteRawLine(String.Format("SetGlyph(%d, %d, %d, %d, %d, %d);[", fontNum, i,  rects[i].x, rects[i].y,rects[i].width,rects[i].height));
  88.         }
  89.     }
  90.         f.Close();
  92. }

EDIT: Ok no, it's a compiler issue. If i define "p" earlier in the script then it works. Seems that the compiler allows int p to be defined twice (I thought it would be allowed because they are different scopes (in other languages))

Editor Development / .NET version
« on: 14 Sep 2014, 18:19 »
I know this has come up before but can we discuss moving the AGS Editor to a higher version of the .net framework?

.NET 2.0 was released nearly 10 years ago.

I suggest we move to .NET 3.5 mainly to take advantage of LINQ which is supported in Mono.
3.5 has very high usage and is supported right back to windows 2000

It doesn't require any source migration, just a flag change in the csproj file.


I just got this error:

Illegal exception
An exception 0xC0000094 occurred in ACWIN.EXE at EIP = 0x0046FC3C ; program pointer is +1004, ACI version CR, gtags (132,511)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and post the details on the AGS Technical Forum.

in "GlobalScript.asc", line 216

Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.

An error file CrashInfo.dmp has been created. You may be asked to upload this file when reporting this problem on the AGS Forums. (code 0)

It occurs when drawing a transparent sprite with alpha onto another 32bit sprite at very specific transparency values. 50 works fine but 58 crashes it. 80 also crashes it.

Any ideas?

I was pondering the scripting language last night and I've noticed something of a problem that should be addressed.

AGS is type safe and we're getting rid of pointer notation. Without a base object class (and type coercion) we can't have any kind of generic classes, like a stack for instance.

In C you might push pointers to a general stack.
In C# you'd use a generic or a general bass class.

We can't do either of those because there's no object class and no generics/templates.

So I propose we introduce both. I think all user structs should inherit from a base "object" class and generics should be introduced.

Both of these things seem *fairly* easy to me (although I know very little about compilation).

Requiring all classes extend object is presumably just something thats implied by the compiler.
Generics are just a type substitution thats known at compiler time.. it could almost be a find/replace.

Code example for reference:

Code: Adventure Game Studio
  1. class Stack<T> {
  2.     import T Pop();
  3.     import void Push(T item);
  4. }

Code: Adventure Game Studio
  1. class object {
  2.     import String ToString();
  3. }

Can someone, (Crimson Wizard I imagine) please run me through the best practice for adding new engine features that conflict with old ones.

In this case I'd like to add multiplicative tinting. This will change the tint function from Tint(red,green,blue,saturation,lightness) to simply Tint(red,green,blue).

What are the steps I need to do this from a compatibility perspective and can you point me to any points in the code as good exemplars for this?

Has anyone done any kind of analysis on this yet? I'm working on stripping out scintilla which is a native library and so far, so good. What else is there?

I think I remember there being named pipes for the debugger which is a windows-only solution so I suggest we replace that with a tcp socket solution which is pretty standard cross-platform.
I believe the debugger communicates in plain text so it should be a very easy swap with only the comm method being changed.

Is there anything else?

Tzachs? CW?

I've been experimenting with something a little different for my new project Latency

In AGS we usually model our game progress by simply saving the whole state of the game. We save what music is playing, where the characters are, all the internal variables, which objects are visible. It's a snapshot in time that we resume later.

In Latency I'm attempting what I call a "Limited State". Essentially we only save the progress the player has made and we rebuild the game state from that information. This has a couple of advantages as far as I can tell.

1 - Complete decoupling from AGS's save state information. This means that, as long as you have logic to handle changes, save states can persist across versions of your game because you're saving *semantic* information about the game state rather than raw data.

2 - It's easy to recreate a game state from scratch for testing purposes. Most adventure games really have very few important events. It's not usually necessary to store everything the player has done, only what advances the game state in some way which often only amounts to a few actions. The terseness of some walkthroughs is a testament to this.

3 - Data in your game can persist across saves. Ever wanted to do some kind of transitions when loading an AGS game? This is possible but its a bit unwieldy since you can't persist timers and stuff between the old state and the new state. With this method you can.

4 - I'm not sure about this one but I *think* this method should be far less buggy because the game state is very explicit to you as a designer. You are forced to distil your design down to atomic events. You have a 100% clear idea on the game state because you set down those rules yourself.

What do you guys think? Food for thought at least, right?

EDIT: maybe Semantic State is a better name...

AGS Games in Production / Latency - A Cyberpunk Adventure
« on: 31 May 2014, 09:08 »

A cyberpunk adventure by Sanctuary Interactive

The Story

Kass_Seti, a leading member of hacktivist group Analogue Dawn, wakes on the streets of New Soho with a hell of a headache.
Her advanced cybernetic implants have malfunctioned, corrupting her memory, leaving her alone and offline on the streets of a London in crisis.

The Internet is heavily censored with every major service locked behind extortionate paywalls. This has allowed a second system, the illicit Free//Net, to flourish. Rival hacker group Watchl1st have become the dominant force on the system, moving from protecting its open values online to militant action in the real world.

Watchl1st's former allies Analogue Dawn strongly oppose this change and have declared war. Kass_Seti might be able to stop the violence, but first she has to repair the damage to her memory, not easy when she's in the wrong part of town with no way to call for help.


  • An immersive, near-future adventure
  • Full voice over
  • Original soundtrack
  • Cinematic, widescreen resolution at a blistering 320x180.
  • Contextual interface
The Team

Written by Rebecca McCarthy (Azure)
Programmed and directed by Steven Poulton (me)
Background art by Hayley Griffiths (Sookiesock)
Character art by Matt Frith

Follow us on twitter @SanctuaryInter!
Visit the website!

Estimated for release on your personal computer system this summer.

Thing 1:

Dialogue *trees*.

AGS doesn't really have a true dialogue tree system in the traditional sense. Dialogues were a series of unconnected lists. So I made this:

True dialogue trees with link nodes and conditions. The code is loaded dynamically as lua scripts so any lua is valid within a dialogue script. Which brings me to...

Thing 2:

Dialogue scripting within main scripts.

There's no obvious reason why we should have to write cCharacter.Say("This is what I say"); all the time. It's a common enough thing to do and people dont write scripts like that. So what if we could do this:

Code: Lua
  1. if myValue > 1 then
  2.     Billy: Gee, I sure hope myValue was bigger than 1
  3. else
  4.     Billy: Lol, myValue.. You cad.
  5. end

Since we can preprocess lua code before running it this is pretty trivial to automatically convert to the correct code. Goodie time-saver!

Thing 3.

Rewriting the pathfinder.

AGS script is probably too slow to rewrite the pathfinder and the lack of a hashtable means looking up nodes would be perilously slow. In Lua we don't have this problem.

My new pathfinder is more accurate and has tunnel-based smoothing. Also, when walking, characters continue walking at the end of a node which avoids the nasty stopping that AGS characters have a tendency to do at sharp corners.

An added benefit of this is that the walking code is kept within the user domain which means you can dynamically edit the walking frames without that nasty 1 frame delay.

I think thats everything I've been playing with... THE POWER OF LUA! UNITE!

The Rumpus Room / Make a noise.
« on: 22 Apr 2014, 10:41 »

Adventure Related Talk & Chat / Adore - Animations
« on: 16 Apr 2014, 13:07 »
Hey ladies/gents

I've been working on Adore (my adventure game engine) and I'm currently looking at how to arrange animations.

AGS kinda works like this:

Views have Loops which have Frames which are references to Sprites.

In adore it's slightly different.
It's more memory efficient to store an animation in memory as a texture atlas like this:

So in adore we have:

AnimationSets which have Animations which have a Texture Atlas (which is taken directly from a file on the filesystem like all sprites in adore) and a list of Frames which contain the delay info.

Now, I know that some consider the whole View system of AGS to be a little archaic and unintuitive so does anyone have any suggestions as to how they would prefer animations to be handled?
What do you think of the idea of having a named texture atlas for animations instead of individual numbered sprites like in AGS?

If an adventure game is set in some environment other than plain old present day earth there is some world building to be done. Certain concepts need to be explained to the player and there's a lot of peripheral info that the player might like to be aware of but is not plot-critical.

My question is what good ways are there to give this information to the player? Long dialogue sequences (especially non-interactive ones) are rightfully frowned upon by players so how else can we explain things to the player without boring them and without requiring them to go at read some book in an in-game library or something.

Editor Development / AGS: Let's start over?
« on: 27 Feb 2014, 09:32 »
(Mod note: This discussion was split from this thread. – Snarky)

As I learnt the existing code better and about problems that were required to be fixed, I was coming to the thought that AGS is simply not suited for upgrade that everyone wanted. It appears to me that although it reached certain state with existing features and capabilities, it took more than 10 years to evolve into what you have now with the work of one man (Chris Jones), and it will take too much time to evolve further to the next "level" to keep up with the demands of the modern day game developers and game players.
Perhaps it could be better to start a new engine, back couple of years ago, built with completely different design in mind, to replace AGS, but it's too late for me to try that now, especially not alone, especially while other engines and frameworks appear - this makes me feel that my work is getting useless in the perspective.

I know my opinions on this stuff are rarely popular but I agree with CW on the matter of AGSs updateability.

I believe AGS is not suitable in it's current state to be brought into the 21st century for two main reasons.

1) the graphics stack is designed primarily to be software based. This is a consequence of it's reliance on allegro. The hardware accelerated support is very much tacked on the end and that's just not realistic for a modern engine and it's only going to get worse. It would be difficult to fix this because a lot of the API relies on direct access to the surfaces (DrawingSurface support for instance simply cannot be moved to a hardware accelerated system without breaking backwards compatibility)

2) The scripting language is slow and archaic and it would require a huge overhaul to fix. *I know, I know* I've been on and on about this for a long time so I will leave it at that.

However, I see no reason why we can't begin AGS 4. The work CW and his team did on 3.3 was outstanding and it fixes most of the trivial issues people were having like alpha support and other resolutions (in the other branch) so I think it would be perfectly reasonable to leave AGS 3 behind at this point and consider it as done as it can be in it's current incarnation.

In a lot of ways that's kinda sad but I think it's also optimistic to draw a line under something and start again as a community.

I know I speak for everyone when I say that I hope CW would consider being a part of that.

Modules & Plugins / MODULE: Floating Hotspot Label
« on: 09 Feb 2014, 10:08 »
I made a little module a while ago and lots of people have PMed me because the link went dead.

It shows a label next to the mouse cursor whenever the player hovers over an interactive space (hotspot/object/character).

I found it in Murder on the Titania so here it is:

Here's the header. It's fair self explanatory.

SetSlideIn sets whether the hotspot should do the sexy slide in animation. On by default.
SetSpring sets whether or not the hotspot label should dampen the mouse movement. On by default.
I forget exactly what SetVerticalOffset does but I assumes its how much lower than the mouse the label should display. -5 by default.

Code: Adventure Game Studio
  1. managed struct FloatingHotspot
  2. {
  3.   import static void SetMaxWidth(int width);
  4.   import static void SetFont(FontType font);
  5.   import static void SetColor(int color);
  6.   import static void SetSlideIn(bool on);
  7.   import static void SetSpring(bool on);
  8.   import static void SetVerticalOffset(int offset);
  9.   import static void UseGui(GUI *toUse);
  10.   import static void UseOverlay();
  11. };

Editor Development / Replacement for scintilla.
« on: 26 Jan 2014, 21:49 » is old, slow and not very portable.  I propose we change to this:

It's a pure .net(I think) syntax highlighted text box. It's also just a normal winforms control so we can do away with the weird scintilla wrappers.


I'm trying to come up with a decent way of modelling the surface temperature of a planet given it's distance from the sun, size, albedo and atmosphere.

Now I have the first 3 things down and can calculate the black body temperature fairly easily but I am struggling with coming up with a model for the greenhouse effect and googling it is a wearisome task.


Any ideas?

It seems to me there are 2 major components, atmopheric composition and atmospheric pressure bt I'm not sure how to model either of those.

Note that my modelling doesnt need to be accurate, it doesnt need to conform with actual data. It just needs to give a fairly accurate idea of how hot a planet would be and provide a rationale for that temp.

The Rumpus Room / A Quiz!
« on: 09 Oct 2013, 13:18 »
There is a show on british radio (the name of which I will omit to discourage cheating) and it asks a panel a series of general knowledge questions masked as a riddle. It's a great show and this week they had a great question which I will now put to you, the AGS Forum.

You are allowed to ask for confirmation that you're on the right lines and for hints but every time I help you you will lose some points!! OH NO NOT POINTS!

All the questions take the same form and its something like "guess all these things and then make a connection or do something with the answers to get the final answer"

Here is the question:

Taken in order, how can an 1864 conflagration; one of Lear’s dukes; a formidable relative of Henry Pulling or Jack Worthing; and a cinque port, produce a mythical cupbearer?

Pages: [1] 2 3 ... 11