Page 2 of 2

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Tue May 08, 2012 10:45 pm
by Lunever
What about my suggestion - to have the classical CSB magic map and have a larger automap that records, what that item has detected - including false pits revealed by OhGorRos etc.?

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Wed May 09, 2012 4:32 pm
by Zaidyer
The map works now, and it is quite lovely! There are three more things I want to do with it:
Set it up as a permanent GUI button
Bind it to the TAB key for quick access
Change the centering feature so the full level can be drawn without cutoff (assuming a default level size) or, failing that, just adding the ability to scroll it around

So... how would I do this?

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Wed May 09, 2012 9:06 pm
by Gambit37
I'm investigating those very issues, but it'll take me some time. You'll probably get a quicker and more accurate reply from Sophia ;-)
And yes, the map is indeed a cool piece of work. Very nice indeed, thank you Joramun :-)

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Wed May 09, 2012 10:25 pm
by Sophia
For the record, Parallax made the map, not Joramun.

Anyway:
Zaidyer wrote:Set it up as a permanent GUI button
You'll need to set up a msgzone. Take a look at base/render.lua which should point you in the right direction. The documentation on dsb_msgzone on the wiki will also be useful, although the wiki is a little out of date.
Zaidyer wrote:Bind it to the TAB key for quick access
Right now, the DSB engine doesn't support this.
I'll look into making this doable for DSB 0.53, though.
Zaidyer wrote:Change the centering feature so the full level can be drawn without cutoff (assuming a default level size) or, failing that, just adding the ability to scroll it around
I assume this could be done by mucking about in the internals of the automap itself, which, I must admit, I'm not that familiar with.
So, I guess the only advice I can offer is to start digging around in the code and learning how it works. :mrgreen:

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Thu May 10, 2012 7:46 pm
by Zaidyer
I'm trying to figure out weapon methods now.

For example, I want to create a sword that when used will instantly do a physical attack, without even bothering to display the methods menu. This is as far as I've gotten...

Code: Select all

obj.greatsword_trouble = {
    name="GREAT SWORD TROUBLE",
    type="THING",
    class="WEAPON",
    mass=32,
    icon=gfx.icons[34],
    dungeon=gfx.sword,
	flying_away=gfx.sword_flying_away,
	flying_toward=gfx.sword_flying_toward,
	flying_side=gfx.sword_flying_side,
	methods = {nil
	},
	base_range=10,
	base_tpower=34,
	impact=10,
	fit_sheath=true,
	hit_sound=snd.dink
}
Right now it does absolutely nothing. Just changing the methods to "physical_attack" has no effect, and giving it a basic Slash attack like any other weapon will still bring up the Methods menu. I need a more in-depth explanation to figure this out.

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Thu May 10, 2012 9:18 pm
by Gambit37
I haven't done this yet, but my understanding is you need to write a custom function which you assign to methods=. In that new function, you do all your clever stuff and it bypasses the normal menu. I could be wrong though.... :D

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Thu May 10, 2012 10:40 pm
by Sophia
In thinking about it, there's a quicker hack if you just want to totally override how DSB handles attack methods.

Use this function:

Code: Select all

function sys_render_attack_method(bmp, frozen, ppos, slot, inst, num, names)
   if (not frozen) then
      local n_inst = inst
      if (not n_inst) then n_inst = 0 end
      dsb_msg(0, SYSTEM, SYS_METHOD_SEL, n_inst, 1)
   end
end
Instead of rendering a choice of attack methods, it will always just automatically "click" the first one before anything else happens.
Naturally, if you want some items to present a choice and others to work automatically, we'll need to revise this approach, but this requires minimal changes. For example, all standard objects will "just work," although some will do weird things depending on what their first method is.

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Wed Nov 21, 2012 7:11 am
by Zaidyer
With the recent engine updates, I'm wondering now if smooth scrolling is possible.

I'm also considering a contest to create a group-authored dungeon on another forum. How would that work?

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Wed Nov 21, 2012 8:36 pm
by Sophia
Zaidyer wrote:With the recent engine updates, I'm wondering now if smooth scrolling is possible.
No. It's just not the kind of thing that will be very easy to do given the way DSB is designed.
Anything that wouldn't be quite difficult to do would probably be ugly. :(

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Thu Nov 22, 2012 2:17 am
by Zaidyer
My idea of smooth scrolling in this case is to fake it as hard as possible.

It can be done with the following tools:
  • Temporary screenshot of an arbitrary portion of the screen (in this case, the viewport)
  • Recalling the temporary screenshot as a bitmap to be drawn
  • Drawing a bitmap at a specified scale and horizontal/vertical offset within an arbitrary rectangle (in this case covering up the viewport and only the viewport)
When the player takes a step, two screenshots are taken: One at keypress, and one after the step is completed.
Time stops while the animation is taking place, and resumes again when the animation is finished. This is important to make sure things don't get too complicated.
If the player sidesteps or turns, the two screenshots are drawn side-by-side in rapid succession (probably about eight times) at progressive offsets, simulating a panning motion from one to another.
If the player moves forward, the "at keypress" screenshot is drawn atop the viewport and then redrawn (again, about eight times) with progressively larger scaling.
If the player moves backward, the "step completed" screenshot is drawn atop the viewport with a large scale, and progressively redrawn smaller until it's at 100%.
When the animation is complete, the temporary screenshots are erased and time resumes as normal.

To preserve the illusion and keep the constant pausing from getting annoying, each frame of the smooth scroll event would probably only last for a 60th of a second.

Now, what's so hard about this?

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Sat Nov 24, 2012 7:23 pm
by Sophia
Zaidyer wrote:Now, what's so hard about this?
Nothing about that is terribly difficult, although, of course, it would still have to be coded and tested and such, and that takes time.

However, like I said, it's either difficult or it's ugly. That approach wouldn't look at all convincing.

Re: Looking for some tricks and scripts to make gameplay eas

Posted: Wed Dec 05, 2012 5:47 am
by Zaidyer
This gif will show you how it works.
The slow speed is for demonstration only. It happens much faster in-game.
Notice also that when turning, the two viewport images stretch to give the illusion of the walls changing angle.