Porting game to MonoAGS

Started by cat, Sun 13/05/2018 21:12:08

Previous topic - Next topic

cat

Quote from: tzachs on Mon 21/05/2018 16:03:26
I pushed fixes to master for both the camera panning issue and the character speaking.
Nice! It's working now :)

Quote
Note that I removed Character.Say, SayAsync should be used instead, that's because the blocking say can't work in all scenarios
Right, better remove it than having a half-broken version.

Quote
Also, I saw that there's a bug with how the fade transition works in your loading screen (instead of fading in the new room, it's fading in the splash screen). Not yet sure what's going on there, it seems more complicated, I will look at it after I finish my current work.
For the mean time, if it bothers you as it bothers me, you can remove the fade transition from the game load event, and move it to after your first (non splash screen) room fades in. Note that this will also reduce the time of the splash screen (by default the fade transition is 1 second fade in and 1 second fade out).
Wow, it's really much quicker that way.

Quote
You can also create a private repository. It costs money on github, but it's free on both VSTS and BitBucket.
Thanks, I'll think about it.

Quote
This is because ICharacter doesn't really contain ChangeRoomAsync, it's composed out of components (like IHasRoomComponent) which contain the actual behaviors.
I understand that, but the whole interface composition will be too complicated for the regular game developer. The documentation needs to have an article where everything you can do with a character is explained in the style of the old AGS doc.

Quote
Quote
Right, I checked again and I see a null reference exception in output. However, the program doesn't crash but nothing else happens and the game is stuck.
Can you describe what changes I need to make to reproduce this? Also, if possible can you share the stacktrace of the null reference exception?
Thanks.
For example, during character creation, I assign an outfit only for left:
IOutfit outfit = await game.Factory.Outfit.LoadOutfitFromFoldersAsync(_baseFolder, walkLeftFolder: "Walk", speakLeftFolder: "Walk", idleLeftFolder: "Walk");
and then I start the idle animation for down (because I didn't pay attention):
_character.StartAnimation(_character.Outfit[AGSOutfit.Idle].Down);
The problem is, the game gets stuck on the loading screen and the exception is only visible in output.

Quote
An outfit is a collection of directional animations (idle/walk/etc)...
Thanks! It would be great to have a shortcut, like factory.LoadSpriteFromFile or similar. Especially when doing multiple animations manually, it creates lots of code atm. Can I safely reuse a sprite for different frames or should I create/clone a new one?
Oh well :(. I tried creating the animation manually but didn't get it to work, yet. The viewport jumps weirdly and I just have flickering and no proper animation. I need to investigate further.


One more (not exactly MonoAGS) issue I have: I installed the VS Community Edition, which I thought was free? But now VS says that my 30 days trial license will expire in a few days ???

Monsieur OUXX

#21
Quote from: cat on Mon 21/05/2018 20:45:47
One more (not exactly MonoAGS) issue I have: I installed the VS Community Edition, which I thought was free? But now VS says that my 30 days trial license will expire in a few days ???

Sometimes the installer is the same but it's the license that matters. Check in google if there isn't a thing like "get your VS community key" which might lead you to a page where all you have to do is to provide your (any) email address to get the key.
Nowadays most of the time you can even generate a key directly from within VS. Chek ou the "help" or "tools" menu.
 

tzachs

Quote from: cat on Mon 21/05/2018 20:45:47
I understand that, but the whole interface composition will be too complicated for the regular game developer. The documentation needs to have an article where everything you can do with a character is explained in the style of the old AGS doc.
The character page has everything you can do with the character in link format, so it's similar to the AGS doc except for the link itself does not to point to the same page. I'm not sure there's an easy way to copy the link contents to the character page, I'll need to get a deeper understanding of how the documentation is auto generated. Hopefully I'll get to that at some point.
I reported the new scenario for the broken search, and they're investigating it, so hopefully it will improve the situation (and interestingly if you search for "*ChangeRoomAsync*" it does work).
Also note that I plan to have the documentation for the interactions available from within the (yet to be written) interaction editor (so each interaction will have a "?" button next to it or something like that).


Quote
Thanks! It would be great to have a shortcut, like factory.LoadSpriteFromFile or similar.
Done ("LoadSprite" and "LoadSpriteAsync").

Quote
Can I safely reuse a sprite for different frames or should I create/clone a new one?
It depends. If you share the sprite it means you also share the sprite's configuration (rotation, scaling, translation offset, pivot, tinting, brightness). In other words, if you use the same sprite on 2 animation frames, and you rotate the sprite in one of the frames it will also rotate it for the other animation frame. If that's what you want, or, if you don't intend to change configurations for individual sprites (and if you intend to port the game from AGS as is without changes, then you don't) you can safely share the sprites. But if you want independent configurations, then use different sprites (but they can still share the same image, which is safe).

Quote
One more (not exactly MonoAGS) issue I have: I installed the VS Community Edition, which I thought was free? But now VS says that my 30 days trial license will expire in a few days ???
It is free, but you need to sign in, see here: https://www.visualstudio.com/vs/support/community-edition-expired-buy-license/

cat

Quote from: tzachs on Tue 22/05/2018 15:00:43
Done ("LoadSprite" and "LoadSpriteAsync").
Already saw it this afternoon and used it in my code - thanks :)

Quote
Quote
One more (not exactly MonoAGS) issue I have: I installed the VS Community Edition, which I thought was free? But now VS says that my 30 days trial license will expire in a few days ???
It is free, but you need to sign in, see here: https://www.visualstudio.com/vs/support/community-edition-expired-buy-license/
Ah, I thought it might be something like that :-\ Well, can't complain too much about a free product. I assume when the MonoAGS editor is finished, people will not need VS installed, right?

tzachs

Quote from: cat on Tue 22/05/2018 17:19:59
Ah, I thought it might be something like that :-\ Well, can't complain too much about a free product. I assume when the MonoAGS editor is finished, people will not need VS installed, right?
Technically, you don't need VS even now. Any IDE/text editor which can compile c# code can be used (in theory, at least).
Once the first version of the MonoAGS editor will be released, you should be able to use any text editor even if it can't compile c# yourself as the editor will be able to compile the code. However, you'll probably still want to use an IDE for debugging purposes.
Then I'll look into the option of bundling the editor with an existing IDE (we previously talked about either MonoDevelop or VS Code as potential candidates), and also of having the editor as an add-in to VS itself (so 3 flavors: standalone, standalone bundled with text editor and debugger, add-in to VS -> hoping it wouldn't be too big a burden, otherwise we'll need to make a choice and cut).

cat

I think an editor without the need to register an account somewhere is a must.

tzachs

Quote from: cat on Mon 21/05/2018 20:45:47
For example, during character creation, I assign an outfit only for left:
IOutfit outfit = await game.Factory.Outfit.LoadOutfitFromFoldersAsync(_baseFolder, walkLeftFolder: "Walk", speakLeftFolder: "Walk", idleLeftFolder: "Walk");
and then I start the idle animation for down (because I didn't pay attention):
_character.StartAnimation(_character.Outfit[AGSOutfit.Idle].Down);
The problem is, the game gets stuck on the loading screen and the exception is only visible in output.
This should be fixed now (the game will properly crash with an error message).

Quote
Also, I saw that there's a bug with how the fade transition works in your loading screen (instead of fading in the new room, it's fading in the splash screen). Not yet sure what's going on there, it seems more complicated, I will look at it after I finish my current work.
This should also be fixed now.

Monsieur OUXX

For the record I've completely given up on this. I lost steam while writing Readers in C# for .xml files for rooms, characters, objects, etc.
Not MonoAGS' fault, though. I still think it has great potential. Just not mature enough for the use I want to make of it. If some sort of easy resources loader appeared, mirroring AGS' game.agf file (with sections split into several files) I'd give it another try.
 

tzachs

I figured, but thanks for the heads up.
My efforts are currently still targeted at having a functional working editor, and I'll update when I have something to show (going to take a while).

cat

For the record I've NOT given up on this, it's just a matter of time. I hope I'll find some time soon for setting up an account and getting my VS running again. I know it's not difficult, but I hate having to bother with this kind of stuff.

tzachs

Cool!
Depending on how desperate you are to avoid setting up an account (and how adventurous you are), you can try using another IDE.
MonoDevelop is free and open source and no registration is needed.
VSCode is another free and open source and no registration is needed, but you might need to work harder to make it work there (as it's general purpose, not c# specific like MonoDevelop, so you'll need to install a bunch of plugins and configure stuff).

Eventually I'll get to try those out myself (I have used MonoDevelop on Linux, actually, but did not try on Windows) and probably add a small tutorial for setting those up (if needed).

cat

Quoting the MonoDevelop homepage
QuoteMonoDevelop for Windows is available from source only
Please refer to the building guide for more information about how to install and configure your MonoDevelop.
The Prerequisites for building under Windows require Visual Studio with F# enabled :P

Why on earth can't they just provide a Windows installer?

tzachs

8-0
Facepalm.
Sorry, they had packages for linux and I assumed they would have an installer/downloadable for windows.

Quote from: cat on Thu 13/09/2018 19:06:37
Why on earth can't they just provide a Windows installer?
Yeah, this is bizarre ???. I'm guessing everybody just uses VS on Windows and their main audience is mac & linux, but still...
I opened an issue on their repo: https://github.com/mono/monodevelop/issues/5961

cat

Yeah, I mean building it myself is cumbersome enough but then also requiring VS is just weird. Since I don't do C# any more, I think I don't even have VS on my work PC.
Let's see if someone reacts to your issue. But I guess I'll get VS to run sooner or (more likely) later anyway.

Crimson Wizard

Quote from: tzachs on Thu 13/09/2018 19:30:32
Sorry, they had packages for linux and I assumed they would have an installer/downloadable for windows.

Quote from: cat on Thu 13/09/2018 19:06:37
Why on earth can't they just provide a Windows installer?
Yeah, this is bizarre ???. I'm guessing everybody just uses VS on Windows and their main audience is mac & linux, but still...
I opened an issue on their repo: https://github.com/mono/monodevelop/issues/5961

Lol, this looks like Linux users are trolling Windows users by not requiring to build from source on Linux and requiring to do so on Windows on contrary. Maybe they are angry on Microsoft for some reason?

cat

In the meantime, I tried SharpDevelop, but this seems to be too old, it can't even load the projects.

cat

I've set up an account and can run VS again now.
When I now pull the latest master, I get a few error messages:
Code: ags

Error	CS0535	'GameStarter' does not implement interface member 'IGameStarter.Settings
Error	CS0117	'AGSGame' does not contain a definition for 'CreateEmpty'
Error	CS0117	'AGSGameSettings' does not contain a definition for 'DefaultSpeechFont'
Error	CS0117	'AGSGameSettings' does not contain a definition for 'DefaultTextFont'	
Error	CS0117	'AGSGameSettings' does not contain a definition for 'DefaultSpeechFont'	
Error	CS0117	'AGSGameSettings' does not contain a definition for 'CurrentSkin'	


What do I have to change? Are there release notes or something?

tzachs

There are no official release notes, yet, I'm afraid (I haven't technically released anything yet). My current plan is to have a functional editor (which like I said, gonna take a while) and then release a v0.1 and start making organized releases and release notes from there on (I'm guessing that's the point the project will start looking more interesting to people).

You can however look at the list of the merged pull requests (I make sure to create pull requests for everything, so it should have all of the changes): https://github.com/tzachshabtay/MonoAGS/pulls?q=is%3Apr+is%3Aclosed
Each PR in itself has a list of commits which you can browse (some are more detailed than others...).
Though currently I haven't (unfortunately) made any efforts in listing breaking changes.

The errors you get are because of 2 breaking changes:
1. Made changes to how a game is started, this is to allow having 2 games that live side by side (as the editor is in itself a game which hosts your game).
2. Moved some defaults into their own class, which you can access from game.Settings.Defaults.

You can follow the structure in the demo game to make this changes: https://github.com/tzachshabtay/MonoAGS/blob/master/Source/Demo/DemoQuest/Program.cs

The relevant lines with changes are: 10, 17, 28-30, 44-51.

And if you're interesting in examining the commits that made these changes:
https://github.com/tzachshabtay/MonoAGS/commit/f58e4bfc633a225b26b77e50601ecc4af8d2a8cf
https://github.com/tzachshabtay/MonoAGS/commit/84050bcb7d49e6a0a8d9b14f22fe7f5a266959ca#diff-f3b30bc060275a41bac549848c305912

Let me know if you're having problems, I can make the changes for you.



cat

#38
Right, I got the program and the usage of dependency injection fixed. I can start the game and as a nice surprise, the custom font is now working (that didn't work before).

There are still other issues (that already were there before), but now that I can compile again, I'll have a look at them one after each other.

Oh, and I like the new point syntax and deconstruction. Gotta get used to the new language features :)

cat

Whoops, looks like I have the slot-machine version of adventure gaming. When I run the game from VS, I get randomly one of the following results:

  • The game runs just fine
  • It is stuck on loading screen
  • I get a "System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'" in OpenGLBackend line 30 (public void ClearScreen() => GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);)
    Spoiler
    System.AccessViolationException
      HResult=0x80004003
      Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
      Source=<Cannot evaluate the exception source>
      StackTrace:
    <Cannot evaluate the exception stack trace>
    [close]

SMF spam blocked by CleanTalk