Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - SpacePirateCaine

#21
Wasn't Rorik also meant to be in attendance?
#22
Hi Monsieur OUXX,

Actually, in my search to find a solution to my issue I did try Easy Mirrors before posting here - unfortunately, considering the sheer size of my reflected surfaces (The whole floor of a number of rooms), the slowdown was unmanageable. To your credit, however, the module was very easy to set up and I had it working in-game fairly quickly.

It did a great job in only reflecting onto the surfaces that I specified, however, so that's a big plus for it.
#23
Don't know if I'd ever have noticed anyway - I tend to go overboard on my animations so the 5-frame limit means I always use objects for my animating BG elements anyways. Perfect still for my needs at least.
#24
It works like a charm, Khris - amazing, and in such short time as well.

I'd also like to note for others that want to get a little greedy with their reflections that it does indeed work with multiple characters at once (without any noticeable framerate drop), though you need to duplicate a lot of the script and I also needed to nest a few if statements that reference Global Variables to ensure that the game didn't crash when a character wasn't in the room - I named them as booleans "Character_InRoom", so "if (Character_InRoom = true)" and set those on room_Load() and room_Leave(), respectively.

For those interested in duplicating, I was able to copy lines 20~39, roughly - the following:

Code: ags

  ViewFrame *vf = Game.GetViewFrame(player.View, player.Loop, player.Frame);
  int slot = vf.Graphic;
  reflection = DynamicSprite.CreateFromExistingSprite(slot);
  if (vf.Flipped) reflection.Flip(eFlipBoth);
  else reflection.Flip(eFlipUpsideDown);
  int sc = player.Scaling;
  int w = Game.SpriteWidth[slot];
  int h = Game.SpriteHeight[slot];
  if (sc != 100) {
    w = (w * sc) / 100;
    h = (h * sc) / 100;
    reflection.Resize(w, h);
  }
  int x = player.x - w/2;
  int y = player.y;
  int y_offset = player.z;
  if (player.Loop == 0 || player.Loop == 3) y_offset += offset_front;
  else y_offset += offset_side;
  y += (y_offset * sc)/100;


then create dupes of all of the defined integers and their references within the script (vf, slot, reflection, sc, w, h, x, y and y_offset become vf2, slot2, reflection2, sc2, w2, h2, x2, y2 and y_offset2, respectively), then place the copies of those lines after the following lines:

Code: ags

  DrawingSurface *ds = Room.GetDrawingSurfaceForBackground();
  if (background != null) ds.DrawImage(0, 0, background.Graphic);


being sure to nest the ds.DrawImage calls within the if statements, and doing the final ds.DrawImage and ds.Release() after the close bracket of the "if (Character_InRoom = true)" statements.

My thanks once again to you, Khris, for this amazing module - I will put it to good use!
#25
I didn't notice any significant framerate drop but I am running at 320x200 with 75-pixel tall characters, so not really taxing in the first place - especially with a moderately fast gaming rig.. I suppose I should do a little testing with a framerate monitor just in case but with the average adventure game, you aren't exactly doing precision twitch gaming anyway, so some potential framerate drop probably wouldn't be too tragic.
#26
If I might interject, I think Slasher is thinking shadows, as opposed to reflections, and getting the terminology wrong.

Slasher - in this case, Khris' awesome module (Which works like a charm, by the way - thank you so much!) only really deals with flat reflective surfaces below the character - mirrors/polished floors/water/etc. The reason I needed a solution like this is because I have a room (and now will probably make a few rooms) that have reflective floors and also used scaling walkable areas, like so:


The player-character is the guy standing in the middle with blonde hair.

What you seem to be thinking of is a shadow as it's cast from your feet, which would definitely be contingent on the location of the light source - in this case from behind the player character? I agree that with extra tweaking that I'm by no means capable of at my level you could also use something like this to generate more realistic shadows. Considering how shadows work, though, it's probably more work than it's worth as the minute you hit a surface parallel to the player character, the illusion is broken.

That said, thank you Khris for this module! I'll study the script inside and see if I can learn something from it.

Also, thanks to Gilbot for the pushes in the right direction!

One thing that others using this module might want to keep in mind - the reflection doesn't seem to be affected by walk-behinds, so at present you will need to use objects with a high-value baseline to block the reflection, if you have foreground elements.
#27
Ahoy Iceboty!

Thank you very much - the positioning trick works like a charm: I managed to get it working using the character, though I'm still having issues with scaling. If I can use dynamic sprites to mirror the current sprite of the player per frame as displayed due to scaling, that would make the whole process much, much easier since I won't have to manually create and import additional sprites for the "reflection" character.

I'm trying to figure out how this works: I see in your demo video there that your sprite is animating and updating correctly, but I'm brand new to the whole concept of dynamic sprites. I am able to create a dynamic sprite using
Code: ags

  DynamicSprite* tmpspr1 = DynamicSprite.CreateFromExistingSprite(object[1].Graphic);

Where object1 is oRef (Is that even the right way to do this?), but i'm not sure how I should be updating the sprite to be a copy of the player. Object.Frame and Object.Loop are read-only values so I can't use the same method that I had with updating the character frames.

I assume i will also need to make use of
Code: ags

  tmpspr1.Flip(eFlipUpsideDown);

to display the image upside-down when all is said and done, but I'm more of an designer/artist than scripter, so it takes a long time for me to wrap my head around a lot of this.
#28
It may very well come down to that, though my tool of choice for pixel art is GraphicsGale and I'd like not to have to resort to exporting my finished files and editing in a second program if at all possible. If I can work out how to paint an image with an in-built alpha channel, that should helpfully cut out the step of adding one in later altogether, which would be the ideal situation. But yes, I will take that under advisement.

Edit: Figured it out! Yay - I don't have to shoehorn in another program. As promised, the solution below.

Okay, a quick tutorial for anyone interested on how to properly export images using GraphicsGale with semitransparency:

For those who are unfamiliar with a lot of GraphicsGale's functionality, I will include the steps I use to create my images and fine-tune opacity. For those who don't care about that, please skip to step 3.


  • Create your image normally in GraphicsGale - mock up however you want until you're satisfied.
I usually create images with separate layers of  transparency, so that I can fine-tune until I have the opacity that I want in my final piece. Layer transparency can be controlled by clicking the ellipsis in the "Layers" window and using the opacity slider or inputting values directly.
Make note of the opacity value you have chosen, as it will come in handy later.


  • Isolate your object and export as a flat image
After finishing the mockup, I like to get my individual objects by hiding all layers except those that will eventually become part of my final image. After hiding superfluous layers and cropping to the size that I want, I also return the sections that I want to have transparent to full opacity (I know this sounds counterintuitive, just bear with me) -- just reverse the step above so that the object is 100% opaque. After you've done that, you should see the α icon on the Layers screen disappear. Once that is done, export the image as a flat PNG file or series of files. You are now ready to set opacity on your PNG images.


  • Create an alpha channel for your image using the Image menu.
With your flat PNG image, go to the Image menu and find the option that says "Add alpha channel". Adding this alpha channel will allow you to make individual pixels transparent. You will notice that after doing this, even at 100% opacity, the layer still registers as having an alpha channel.


  • Switch to Opacity Mode.
This was a function that I wasn't even aware of until today. In the toolbar, you will find an icon that looks like a downward-pointing pencil: This indicates you are in Draw mode. We want to change to "Opacity" mode, which looks like a checkerboard. Click to Opacity mode and you will now be able to edit actual opacities, as opposed to layer opacity.


  • Use the Opacity slider on your palette menu to select the opacity of the pixels you will paint.
On your palette toolbar, you will see a white-to-black slider above your RGB color pickers that represents Opacity. Normally, this doesn't do much at all until you are painting in Opacity mode. In opacity mode, however, it represents how opaque the pixels you paint over become. Using this you can select individual pixels, or flood-fill regions that you want semi-transparent. When you click on them, they should become semi-transparent. You can move items behind them to make absolutely sure. Note that the layer opacity will still remain at 100%.


  • Double-check that your background is transparent.
You can be sure that your background color is transparent by going to the Frames window and clicking on the ellipsis there, and making sure to set the Transparent Color to your image's background color. This is always important, of course. You could also, theoretically, do this by flood-filling your background color with opacity 0 in Opacity Mode.


  • Save as a PNG with an Alpha Channel
Once you have successfully set up your opacity in Opacity draw mode, it's time to export your image. Go to Save As, or if you are using multiple frames, Export and make sure that you have the option "With Alpha Channel" checked, so that the PNG will export and alpha transparency will be saved.


  • Import your finished Sprite into AGS
Once your sprite is exported correctly, all that's left to do is import the sprite and test it in-game. Be sure to import the sprite using its alpha channel when prompted, and I find that it's fine to import using the "Leave As-Is" option for transparency.


And that's all! Hopefully this tutorial will help people who only have GraphicsGale or only want to use one program to much more easily streamline their development process.
Now, it's likely that there are much more elegant ways of doing this even in GraphicsGale - perhaps even a way to paint on the fly with lowered opacity, but I still need to test. But at the very least, for retroactively setting opacity this works like a charm.
#29
Hi selmiak,

It appears that GraphicsGale will deal with semi-transparency without any major issues while you are still using its proprietary .gal format, but it doesn't export the alpha of individual layers when exporting to an image file - it generally just flattens the image unless you have set up an alpha channel and then painted to it with alpha set in the palette frame at time of painting: As above, I'm still unsure of the exact method - I was eager to get back to actually making my game instead of tweaking transparency that I just opened up the offending frames in photoshop and hit the pixels of the overlay with a semi-opaque eraser and called it a day.

I will have to do similar things soon, however, so I do plan to update this thread in the next few days with information on my findings.
#30
Hi all once again (Hopefully two in one day isn't too much),

I'm currently working on a room in my game that has a "reflective floor", where I would like the main character to have a reflection walking with him, purely for aesthetics.

I've managed to set up a separate mirrored character that has all of the same animations, flipped vertically, and have the character following the character's movements without much issue, but the problem crops up when I use Continuous Scaling in my background as the player walks further back into the room - as the character's movements are tied to the coordinates of the player, the sprite gets "smaller" correctly, but appears further and further away from the character's feet. I've attempted to tweak the reflected character's z coordinates based on the player's y in the room's script with iffy results ranging from appearing to remain connected but no longer scaling to disappearing altogether.

The code I have is as follows:

Code: ags

function room_FirstLoad()
{
  cTytanReflect.z = player.y-75;
  cTytanReflect.Transparency = 70;
}

function room_RepExec()
{
  cTytanReflect.x = player.x;
  cTytanReflect.y = player.y+130;
  cTytanReflect.Frame = player.Frame;
  int l = player.Loop;
  if (l == 0 || l == 3) l = 3 - l;
  cTytanReflect.Loop = l;
}


(Code largely poached from Khris' code in another mirror thread and re-purposed to my own needs)
The current code has the reflective character staying more or less at the feet of my Player sprite, but is not scaling properly. Is there some easy way to set the main hotspot to the top of a character's sprite which would allow the sprite to scale correctly from that point, or am I grasping at straws?
#31
Thanks Calin - as usual, you are immensely helpful.

So, apparently GraphicsGale lies when it says that you are exporting with an alpha channel, or at least doesn't tell the whole truth. It does indeed export Alpha channels, but they either fully opaque or fully transparent, on standard settings. Apparently there is a way to paint with semi-transparent colors, but that has to be done at time of drawing. In the case of this set of sprites, I'm just touching them up with photoshop (I could've set object opacity, yes, but that would've meant that the actual solid 'terminal' section would've been partially transparent as well, which wouldn't have worked for my purposes.

I will update this thread if I work out exactly how to do alpha channel painting in GG, as I still am a strong advocate of using it for your pixel needs.
#32
Hi folks,

I'm certain I'm just missing something very simple, but I've run into a bit of a brick wall, and although I am sure this question has been asked a zillion times already, I'd like to get some information on how to have objects in-game with semi-transparency (PNGs with an alpha channel that isn't completely black/white).

Allow me to explain exactly the issue I'm having:

I have a room in my game that has a holographic display that the main character can interact with, which is supposed to be semi-transparent. My intent is that the main character will be able to walk behind the object and still be visible "behind it" - in addition to the background that it is displayed over. At the moment, although I have imported everything as PNGs with alpha channels (tested with both top-left pixel and "as-is" import), including making sure that the background has an alpha channel (though I don't know for sure if this is important or not). I have upgraded to AGS 3.3.0 beta 12 and set alpha rendering style to "Proper Alpha Blending," but as yet I can't seem to get it to work.

I'm under the impression that this should work, and I believe I've seen a lot of information about semi-transparency in GUIs, but not much about sprites rendered as part of the scenery. Again, not entirely sure if this is even feasable. I've mocked up what the final image should look like and below compare how it appears in-game:


Mockup


In-Game

I have re-confirmed that my game is set to 32-bit color, though GraphicsGale only works with a maximum of 24bpp color depth (is this, perhaps, the problem?). I am certain it's doable, as I'm convinced I've seen similar things done in AGS games before, but I'm at a loss. Is there anything I can do? I've been searching the forums for a few hours already and just can't see to find the solution, so I would be greatly appreciative if someone could explain the whole process of importing and using sprites with semi-transparency in detail to me, ideally including any settings that I may have overlooked.

Edit: It appears I may have missed a problem with my alpha channels. I will do a little testing and see if I can resolve the issue
#33
It should also be noted that splitting into various pieces may not even be necessary - though it will allow for independently animating elements. If you have already animated your background as a single animated background, similar to the image you posted above, that could easily be translated into a single object and used as your background.
#34
Hi RyosFace,

It's been mentioned already, but you can accomplish a lot with objects - most of the background from my game, Kuma Story, was done as animated objects - they were very minimalist, but ultimately you could even do your entire animated background as an object that is the entire size of your background. Walk-behinds and walkable areas are easily set up and you can even use a static frame as reference, since the background object will be overlaid on top of your other background frame.

Also, Shenmue fan game, eh? Sounds interesting.
#35
Man, it's been so long since I've used LinkedIn that I forgot how to add someone from their profile.

I don't personally put my AGS stuff on my profile, though it's not a terrible idea. Just mostly been keeping it to long-term paid positions on my profile. I rarely check it, but for what it's worth my profile is here. Managed to add WHAM, but I'll have to guess at m0ds' e-mail address.

I guess I should update this thing.
#36
I was hoping you'd be coming, Dave - I never got to catch you when you were here in East Asia, so it'll be a great chance to finally meet. Also, I'd love to pick your brain a bit about some publishing-related stuff and how things have been going for you and Wadjet Eye lately. If you've got an extra chair, I'd love to attend the party! Just let me know when and where.
#37
Hi there, boys and girls. I haven't been too active around here for the last couple of months, but I'm still working on some AGS stuff on the sly, and hopefully will have something to show everyone (Especially the KI team) very soon.

I just realized that GDC is getting really, really close and I'm happy to say that thanks to being one of the only english-speakers in my office, I'll actually be attending this year. Anyone else from the AGS community going to be in San Fran around the time of the event that feels like getting together for a drink or two?

If I can drum up some interest, I'm sure I can wrangle up some reservations at a restaurant where we can all meet up, or something along those lines. I've been a member of the community for years and years, but never had the chance to get all the way to Europe for the various Mittens and related shindigs, so I'd be thrilled if I could finally get to meet up with some of y'all, shake your hands and so on and so forth.

Any takers?
#38
Hey AnasAbdin - I never heard back from you after that first conversation we had. If you're still interested, just PM me again, and I'll be happy to get on top of recording ASAP. If you've already found some other good talent, good luck on getting the game out! Really looking forward to playing it.
#39
I don't think this is a joke, actually - Google translate just sucks when translating from East Asian languages. He's speaking in Korean, and though I have to translate from Korean to Japanese, the text isn't as weird as it seems.

@PC1.ZE & PC2.TL:

안녕하십니까 게임은 매우 재미있게 보이는 노력 말야 계속해서 만들어 주십시오.
연유하러, 여기는 한국어가 통하는 사람은 적으므로, 지극히 심플에서도 영어로 열심히 해 주십시오.
포럼에 잘 오셨습니다!
일본어로부터 번역했으므로, 잘못된 한국어라면 죄송합니다.

(Hello! Your game looks very interesting, and I hope that you continue to work hard on it. Please note that there are very few people that understand Korean on the forums, so please try to communicate in English, even if it's very simple. Welcome to the forums! I translated this text from Japanese, so I apologize if the Korean has mistakes.)
#40
Quote from: Corby on Mon 31/10/2011 23:01:08
I have to mention that my favorite voice was the Ginger Scientist.  :)

"Get back you mean thing!"

Aww, thanks! It was a lot of fun recording the lines, but honestly, it's all about the writing: Everything I was given was easy to record. To be honest, I preferred my other reading of the character, but in the end, it seems to have gone over quite well, so cheers Baron for having better taste in voice acting than me!
SMF spam blocked by CleanTalk