Post new topic    
Page 1, 2  »
Metal King Slime
Send private message
A little critique, and a question on scripting 
 PostMon Mar 26, 2012 4:27 pm
Send private message Reply with quote
Hiya, just have a little question on scripting, not the actual code, I can probably figure that out eventually, but rather on the way I plan on going about it. I've been throwing together tiles for a ship:



Not exactly done yet, I haven't added all the rigging, the stairs going down look terrible, I haven't even begun to work on the wake the ship leaves (I'm going to animate that later on), and the sail and crow's nest really clash with everything else.

That aside though, my question about scripting is this:

I have that big sail obscuring quite a bit of walkabout real-estate. Now, the OHRRPGCE doesn't really support alpha channels (OK, doesn't support them at all), but I was suddenly struck by a cunning plan <insert> of dithering the transparency sails so that the sprites would be visible beneath it.

I've written a script that checks if the player is in a certain zone (behind the mast and the sail) and if the player is there, I use WRITE MAP BLOCK to switch out the mast and sails with alternate graphics that are dithered to be see-throughable. As soon as the player leaves, the old graphics are WRITE MAP BLOCK'ed back in.

I've put the script in ON EACH STEP for the map, and it seems to work for the most part.

Am I going about this correctly, or is there a better, and simpler way to do this? Also, will putting this in ON EACH STEP slow things down overly much?

Cheers!
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Liquid Metal King Slime
Send private message
 
 PostMon Mar 26, 2012 4:59 pm
Send private message Reply with quote
That is a beautiful ship!

I like your dithering idea, but I think you can do it with no script at all.

Simply draw the sail with two layers. A solid layer of sail that goes underneath the hero/npc layer, and a dithered layer of sail that goes on top of the hero/npc layer.

However, if you want to stick with the plotscripting plan, you definitely seem to be doing it the right way. Don't be afraid of a slowness in the each step. The sail is only a small part of the map, and using write map block on every tile of it isn't going to be a noticeable slowdown.
King Slime
Send private message
 
 PostMon Mar 26, 2012 5:49 pm
Send private message Reply with quote
Quote:
I've been throwing together tiles for a ship:


I wish I could throw stuff together that good. You must have quite a pitch to make that.
Slime Knight
Send private message
 
 PostMon Mar 26, 2012 7:04 pm
Send private message Reply with quote
"A SHIP" is the hardest tileset I ever had to draw, and I eventually weenied out and just drew it from the side-view. So, I know what you drew there is no easy task; that ship is truly great, BMR!
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Liquid Metal Slime
Send private message
 
 PostMon Mar 26, 2012 7:29 pm
Send private message Reply with quote
Actually, instead of dithering, might I suggest you convert the mast into an outline with maybe a few curving lines coming off the edge to show the roundness of the mast? That way the hero doesn't have to look washed out when he walks behind it.

Great job with the drawing.
Place Obligatory Signature Here
Metal King Slime
Send private message
 
 PostTue Mar 27, 2012 2:39 am
Send private message Reply with quote
Thanks for the input everyone.

James Paige wrote:
Simply draw the sail with two layers. A solid layer of sail that goes underneath the hero/npc layer, and a dithered layer of sail that goes on top of the hero/npc layer.


Hadn't thought of that, hmm... But wouldn't that mean that the sail would be shown under the heroes/npcs whenever they walk through it? Then again, haven't tried it, so I don't really know what I'm talking about, hehe.

Harlock Hero wrote:
I eventually weenied out and just drew it from the side-view


Hah, funny you should mention that. I originally wanted to do the tileset from sideview, with a little angled perspective, but I thought I found it too difficult so I went with this view instead, hehe.


Pepsi Ranger wrote:
might I suggest you convert the mast into an outline with maybe a few curving lines coming off the edge to show the roundness of the mast?


That's a good idea actually, I'll see if I can make that work.

In the meantime, I've got these:

The first picture is the hero (with whose sprite I am not really too happy with) before walking under the sail. The second is the hero walking under the sprite, and the script kicking into action. Not sure about how it looks though.





Though now that I've sort of got that working, I'm tempted to do the same with any walls or buildings or whatever the hero might pass behind... Hmm...
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Slime Knight
Send private message
 
 PostTue Mar 27, 2012 3:39 am
Send private message Reply with quote
What you have looks good! I'm a fan of the read/write map block commands, myself.

I'd personally like to see how it looks with James' idea though, with the solid sail drawn under the heroes, and a dithered sail drawn on top of the heroes, so that it looks solid until such a point that they walk under it, and then appears to be translucent only where they're standing.
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Super Slime
Send private message
 
 PostTue Mar 27, 2012 3:52 am
Send private message Reply with quote
Harlock Hero wrote:
What you have looks good! I'm a fan of the read/write map block commands, myself.

I'd personally like to see how it looks with James' idea though, with the solid sail drawn under the heroes, and a dithered sail drawn on top of the heroes, so that it looks solid until such a point that they walk under it, and then appears to be translucent only where they're standing.


See also: Baldur's Gate (and similar games).
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Liquid Metal Slime
Send private message
 
 PostTue Mar 27, 2012 5:41 am
Send private message Reply with quote
Oh, NOW I see what you're going for. Interesting. I don't know very many 2D games that do this, though it's a borderline necessity in some 3D games. If it were me in your shoes, I'd just rearrange things on the ship so that everything important is in plain view and the player can just walk straight through the spaces the sails obscure. (In other words, the lazy method)

If you can get this to work well, I'd highly recommend putting it into other parts of your game, making other tall or enormous structures the player can explore behind, possibly with secrets hidden in their shadows. I think that'd be a great addition to the gameplay of a new OHR RPG.
Metal Slime
Send private message
 
 PostTue Mar 27, 2012 1:37 pm
Send private message Reply with quote
Are there script commands to activate/deactivate certain layers? If so, rather than write-map-blocking entire areas, and having different scripts for every scenario, you could always make the 'solid' obstruction the same layer on every map, and the 'dithered' obstruction another layer. Then have a master script that checks for the relevant zone and turns the 'solid' layer on/off.

I like this idea of switching to a semi-transparent view for the entire obstruction as soon as the player walks behind any part of the obstruction. The problem with my idea above would be that if the player walks behind ANY obstruction, ALL of the obstructions on screen would become semi-transparent. But this might be worth only having to write one script.
I am Srime
Metal King Slime
Send private message
 
 PostTue Mar 27, 2012 2:28 pm
Send private message Reply with quote
msw188 wrote:
Are there script commands to activate/deactivate certain layers?


Looking through the dictionary now, doesn't seem to be one. Though there is a way to switch the tileset out, so it might be possible to switch out the "solid" layer with a tileset containing nothing but blanks.

Though indeed, it would make all the obstructions become semi-transparent, but that could be worked around with clever map making.


But I am thinking of going a little overboard, and making only a small area around the player dithered to be see-throughable... That would require a very cunning plan though, perhaps beyond my current level of cunning, heh.
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Liquid Metal King Slime
Send private message
 
 PostTue Mar 27, 2012 2:36 pm
Send private message Reply with quote
msw188 wrote:
Are there script commands to activate/deactivate certain layers?


Yes indeed there are!

Code:

script, hide layer five, begin
  variable(sl)
  sl := lookup slice(sl: map layer 5)
  set slice visible(sl, false)
end
Metal King Slime
Send private message
 
 PostTue Mar 27, 2012 3:45 pm
Send private message Reply with quote
Hmm, give this new bit of code a try I shall.

Even though I'm still just barely wrapping my head around this new "slices" contraption, hehe.
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Metal Slime
Send private message
 
 PostWed Mar 28, 2012 2:31 am
Send private message Reply with quote
Just popping in again to say I've thought a bit about the 'only dither the nearby tiles' idea, and I'm pretty sure there is no way of doing this with a script of comparable simplicity to what we've been looking at so far. If someone comes up with a "cunning" method of doing something like this, I'd be kind of interested to know what it is.

All I can think to do would be to pre-arrange all of your tilesets that would be used on the 'obstructing' layer, so that a simple script could be used to 'dither' and 'undither' any set of tiles on this layer; even with that, there will need to be a constant calculation on every step for what tiles to affect. And this would only allow a "tile-based" system, which would probably look more awkward than it is worth; worse, it wouldn't appear to move smoothly. I can't think of any way of creating this effect and making it look smooth, AND move smoothly. Maybe some kind of awful NPC system...? Or is there some way to do this by attaching a slice to the screen...? I'm stumped.
I am Srime
Metal King Slime
Send private message
 
 PostThu Mar 29, 2012 1:46 am
Send private message Reply with quote
Nice ship!

I think writing a whole lot of writemapblock calls to modify bits of the map is horrible. If you can hide and show map layers, that's best, but if that's not practical, I suggest copying tiles from one (hidden) layer to another, using a zone as a mask if the section isn't rectangular:

Code:
script, copy from layer to layer in zone, source layer, dest layer, zone, begin
  variable (x, y)
  for (y, 0, map height -- 1) do (
    for (x, 0, map width -- 1) do (
      if (read zone (zone)) then (write map block (x, y, read map block (x, y, source layer), dest layer)
    )
  )
end


If your map is huge then this script will take a noticeable fraction of a second, and you may want to restrict it to searching just part of the map.

msw188 wrote:
I can't think of any way of creating this effect and making it look smooth, AND move smoothly.


Fairly sure that it currently can't be done. I've been thinking for a while about a stencil feature: the ability to specify a mask which prevents certain pixels of a slice (including map layers) from being drawn. In fact it wouldn't be hard to implement, but I'm worried that implementing it would make moving graphics rendering into the graphics backends in the future more difficult. For example, SDL supports nothing of the sort. Worse, I doubt that it would get used much -- this is the first time I've seen anyone wanting something like that. I guess its main use is for reflections.
Display posts from previous:
Page 1, 2  »