AGS 3.3.0 Release Candidate

Started by Crimson Wizard, Thu 04/04/2013 19:16:28

Previous topic - Next topic

Calin Leafshade

"struct cannot be passed as a parameter"

Story of my AGS life right there.

Snarky

Yeah, I was coding last night, went to bed, and in my sleep came up with this great idea for how to refactor my code to save a ton of space/effort. Tried it out this morning, and of course...  :~(

monkey0506

Serialization techniques are not uncommon in computer programming, and if properly implemented can still be quite fast (although there's always a loss of speed in comparison to direct memory access). Or depending on your needs you may be able to use managed instances and then provide a "Load" function that copies the managed instance into a local variable (and "Save" to write it back). There's dozens of techniques you can use to circumnavigate the globe while the drill to dig straight through to China is being built.

Crimson Wizard

Quote from: monkey_05_06 on Wed 17/07/2013 21:00:08There's dozens of techniques you can use to circumnavigate the globe while the drill to dig straight through to China is being built.
I already know what Calin's answer will be 
Spoiler
use Lua
[close]
:=

Snarky

Quote from: monkey_05_06 on Wed 17/07/2013 21:00:08
Serialization techniques are not uncommon in computer programming, and if properly implemented can still be quite fast (although there's always a loss of speed in comparison to direct memory access). Or depending on your needs you may be able to use managed instances and then provide a "Load" function that copies the managed instance into a local variable (and "Save" to write it back). There's dozens of techniques you can use to circumnavigate the globe while the drill to dig straight through to China is being built.

All of which takes time to write, bloats the code with workarounds that have little to do with what you're actually trying to achieve, is hard to maintain if you need to make changes to the data structure, and can lead to hard-to-track-down bugs (e.g. if you add another field to your struct but forget to update the Save/Load routines).

It's doable, sure, but it's a fucking pain in the ass.

Having to work around the lack of pointers to custom structs has made the battle system I'm working on take probably twice as much code and four times as much work as it otherwise would have. It's led to monstrosities like:

Code: AGS
String spellName = AtbSpellList[CombatUnitList[actionArray[action].actor].spellInventory[actionArray[action].toolUsed]].name;


For something that would otherwise probably have looked something like this:

Code: AGS
String spellName = action.spellUsed.name;


If we could all agree on what standard language to replace it with, I'd be all for ripping out AGS Script.

Snarky

Another bug. This one crashes the editor (well, it keeps running, but I can't save the project, it just makes it crash again):



QuoteError: Index was outside the bounds of the array.
Version: AGS 3.3.0.1140

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AGS.CScript.Compiler.FastString.get_Item(Int32 index)
   at AGS.Editor.AutoComplete.AdjustFunctionListForExtenderFunction(List`1 structs, List`1& functionList, FastString& script)
   at AGS.Editor.AutoComplete.ConstructCache(Script scriptToCache, Boolean isBackgroundThread)
   at AGS.Editor.ScriptEditor.scintilla_OnBeforeShowingAutoComplete(Object sender, EventArgs e)
   at AGS.Editor.ScintillaWrapper.ShowAutoComplete(Int32 charsTyped, String autoCompleteList)
   at AGS.Editor.ScintillaWrapper.ShowAutoCompleteIfAppropriate(Int32 minimumLength)
   at AGS.Editor.ScintillaWrapper.OnUpdateUI(Object sender, EventArgs e)
   at Scintilla.ScintillaControl.DispatchScintillaEvent(SCNotification notification)
   at Scintilla.ScintillaControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Happens as I'm trying to type "(this Dialog*)" after entering the first three letters "Dia" (though in the screenshot I had time to add a typo). Even if I close the editor, restart, and try again, it still crashes. Perhaps the project is corrupted? Here it is in case it's needed for examination: https://www.dropbox.com/s/2uy1xb3u5bn0z8q/testcursor-crash.rar

tzachs

#186
Quote from: Snarky on Thu 18/07/2013 10:45:25
Another bug. This one crashes the editor (well, it keeps running, but I can't save the project, it just makes it crash again):

Fixed.
Quite funny actually, I wrote the exact script like you and it didn't reproduce. Then I loaded your project, added the extender and still it didn't reproduce.
But then I tried it again, only without pressing 'Enter', then it reproduced... The bug was when the extender function is at the very end of the file.

Edit: Also added a possible fix for the weird docking issue (possible since I can't actually reproduce it).

Snarky

Thanks for the fix(es) tzachs!

cat

I wanted to import an old demo I downloaded (http://www.adventuregamestudio.co.uk/forums/index.php?topic=26922.0). It was not possible to import it directly, so I downloaded AGS 2.72 and opened and saved the game there. When opening the game now in AGS 3.3.0 and performing the conversion, I got this error (sorry text was not selectable, had to take screenshot)

Crimson Wizard

#189
Ok, I am going to look into this.

Quote from: cat on Sat 20/07/2013 12:17:52sorry text was not selectable, had to take screenshot
Something I learnt only couple of years ago, - and probably this is not quite obvious and therefore not well known - you still can copy text from standard message boxes in Windows by simply pressing Ctrl+C (without selecting text). It will go to clipboard as a whole.

AGA

Quote from: Crimson Wizard on Mon 22/07/2013 08:13:06
Something I learnt only couple of years ago, - and probably this is not quite obvious and therefore not well known - you still can copy text from standard message boxes in Windows by simply pressing Ctrl+C (without selecting text). It will go to clipboard as a whole.

Usually.  For some reason it doesn't always seem to work.  Perhaps there's a way of disabling it if the programmer really wants to?

cat

Ah, didn't know that. I'll do that next time.

Btw, I managed to copy the module code from the old project and paste it in a new one, so for me this issue is not important anymore. I'll release the converted and enhanced module soon.
However, it might be a good idea to check if this issue happens with other projects as well.

Crimson Wizard

Quote from: AGA on Mon 22/07/2013 08:28:33
Usually.  For some reason it doesn't always seem to work.  Perhaps there's a way of disabling it if the programmer really wants to?
I think it is a default behavior for the message boxes, displayed by default WinAPI implementation. If the program has its own message box implementation, it may work totally different of course.

Crimson Wizard

Ok, I found what's wrong with that import. Things are pretty bad, actually, the whole old game import feature is broken, since 3.2.2 beta :( (about a year ago). I will talk with tzachs about this.

tzachs

Ok, I fixed it, I just hope I didn't screw up anything else in the process..  :-\

Crimson Wizard

I will test this more on the incoming weekends and make a new Beta.

cat

I had the exception again when starting my game with the "Run" button:

Error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Version: AGS 3.3.0.1136

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at load_room_file(SByte* )
   at load_crm_file(UnloadedRoom roomToLoad)
   at AGS.Native.NativeMethods.LoadRoomFile(UnloadedRoom roomToLoad)
   at AGS.Editor.Components.RoomsComponent.LoadNewRoomIntoMemory(UnloadedRoom newRoom, CompileMessages errors)
   at AGS.Editor.Components.RoomsComponent.RecompileAnyRoomsWhereTheScriptHasChanged(CompileMessages errors, Boolean rebuildAll)
   at AGS.Editor.Components.RoomsComponent.AGSEditor_PreCompileGame(PreCompileGameEventArgs evArgs)
   at AGS.Editor.AGSEditor.PreCompileGameHandler.Invoke(PreCompileGameEventArgs evArgs)
   at AGS.Editor.AGSEditor.CompileGame(Boolean forceRebuild, Boolean createMiniExeForDebug)
   at AGS.Editor.Components.BuildCommandsComponent.TestGame(Boolean withDebugger)
   at AGS.Editor.Components.BuildCommandsComponent.CommandClick(String controlID)
   at AGS.Editor.ToolBarManager.ToolbarEventHandler(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at AGS.Editor.ToolStripExtended.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Is some pointer playing crazy?

Crimson Wizard

...maybe data was accessed beyond buffer.
Problem is this may be related to certain features or combination of features you use.
Was there any crash dump created in project folder (or AGS program folder)?
If not, can I have your game project to do some tests?

cat

No crash dump. I'll prepare a package for you.

Since this is open source, where can I find the code for
Code: AGS

at load_room_file(SByte* )
at load_crm_file(UnloadedRoom roomToLoad)
at AGS.Native.NativeMethods.LoadRoomFile(UnloadedRoom roomToLoad)


I'm in no way a C++ developer, but I could try to do a small code review so see if I find something...

Crimson Wizard

load_room_file is in Editor/AGS.Native/agsnative.cpp.

The code there is generally unrefactored, and pretty messed up (in the sense of style), so beware.
The call stack indicates that this happened when room was recompiling due the change in global script or custom module. Don't know if that may give any hint though.



UPD: tzachs, I noticied that from Beta 6 the Project Explorer panel is missing when the editor starts for the first time (Layout.xml was not yet saved).

SMF spam blocked by CleanTalk