Author Topic: A replacement for Danmakufu?  (Read 245530 times)

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: A replacement for Danmakufu?
« Reply #240 on: October 16, 2009, 04:23:29 AM »
EDIT: Page (9) YEAH! :toot:

Frankly, while an easier collision detection mechanism would be better, I'd much prefer a freer graphical system, especially regarding the sidebar. Danmakufu requires too many workarounds to get at that.

As far as the collision model is concerned - is there anything in particular you think should be improved?  The way it is here, you basically define "When we collide with <type of object>, run <script>".  I think it's a rather simple design, myself.

Hmm ... now I'm wondering - do you people think it'd be useful to have a function to check for collisions between two objects, given their IDs?


As far as the graphics - I plan to add in support to draw graphics wherever the hell you want, even outside the game frame, in addition to the current model which draws an image for each object in the game.  I do intend to keep the current model as well, though, since it simplifies a lot of the simpler graphics tasks.



Anything new to report, NC?

It is the weekend for me*, so yes.  See below. :3



A custom GUI system would be awesome, with changeable fonts and all because the font Danmakufu uses isn't SUPERFLASHY.

I need to get font support in there first to begin with. :V

I still need to evaluate options, although the worst-case is that we'll have to create an image file with the graphics for each text character.  I think I can get around that, though, if I hook into SDL's font structures to build up text images.



Nice to know this is more affordable. Danmakufu lags even without any script being run here.

Well, at the moment we can't say too much about the performance, since nobody has hit it with crazy-intense scripts yet.  But, suffice to say, I do plan to make things more efficient, overall, than Danmakufu.

What's your system spec, by the way?  It might be good to get a baseline of what people are using, at least in a general sense.



You are aware that you're not actually supposed to plug a monitor in to the back of a microwave, aren't you?


But it's cool

:cool:

... ... ... what the hell did I miss here? o_O





Today's progress report:

  • Added support for function calls (new mdBase command, call), which support an arbitrary number of arguments.
  • Added some more default scripts.  Also moved all default scripts into their own functions, so that they can be called from other scripts if, for example, you want to create a new item that works like a point item, but also increases some script-specific variable to do something when the player collects a certain number of these items.
    Currently, though, there isn't any syntax defined in mdBase to define your own functions.  This should be addressed at some point.
  • Created default object types: Basic_Enemy_Shot and Point_Item.  They're pretty much exactly what they say they are, although the point item is rather simple at the moment (no POC collection, value doesn't prorate based on screen position) - this can be fixed in the point item scripts.
  • Added a global variable for the value of point values - #point_value, which is automatically defined at the start of the game with a default value of 10000.  This is used by the point item scripts to determine how many points to give the player, and can be adjusted freely with simple mdBase commands.



I really need to get into ANTLR more and figure out how exactly to get it to do what I want it to, so that we can get a real scripting language in here already.  That would really kick ass.

... unless someone else wants to take up that end of things?  Any volunteers?  If we could at least get a grammar in place for the script language (mdScript?), it'd make things easier.  DoublyTriply so if it outputs mdBase, since that would trivialize the part of then getting it into the engine itself.



* 9/80 work week kicks ass.
to quote Naut:
"I can see the background, there are too many safespots."
:V

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: A replacement for Danmakufu?
« Reply #241 on: October 16, 2009, 01:44:14 PM »
Nuclear Cheese,

Can you put on the same hat as Remilia, same outfit and some wings?











So I can love you just like the ojousama for your work.



Aside the ass licking:
Forgive me for following this thread at a bad pace ( I should be ashamed for being one of the danmakufu scripters who pushes their work till the limits ).

I will try to catch up from page 6 (where I was last left) and see if I got anything useful to add. ( Imo you should also have some kind of blog/webpage where you can write progress easier and faster ) but I guess a forum is more personal and nice.

Re: A replacement for Danmakufu?
« Reply #242 on: October 16, 2009, 03:59:58 PM »
Hmm. I don't mean to push you back a few steps, but wouldn't it be better to have a general "item" class and determine what each type of item does by scripts? Or am I taking the name too literally?

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: A replacement for Danmakufu?
« Reply #243 on: October 17, 2009, 01:27:27 AM »
Nuclear Cheese,

Can you put on the same hat as Remilia, same outfit and some wings ...

HELEPOLIS, STOP.

... er, sorry, I'm not really into that sort of thing. :-\



Aside the ass licking:
Forgive me for following this thread at a bad pace ( I should be ashamed for being one of the danmakufu scripters who pushes their work till the limits ).

I will try to catch up from page 6 (where I was last left) and see if I got anything useful to add. ( Imo you should also have some kind of blog/webpage where you can write progress easier and faster ) but I guess a forum is more personal and nice.

I could put up a dev blog of sorts on my website, although I don't know if there's really any need at this point ... this place works well enough, and we can discuss things without jumping back and forth between two places.

One things get to the "omg release etc" phase, I'm sure there'll be a site for this project anyways - especially since (due to popular demand, at least) the source code is most likely gonna be put out there for people to mess with at some point.



Hmm. I don't mean to push you back a few steps, but wouldn't it be better to have a general "item" class and determine what each type of item does by scripts? Or am I taking the name too literally?

Not sure if I explained this one yet or not, but each object type is given a base type, including Enemy, Player, etc., which decided what default scripts to give it.

In the case of the Item base type, it'll give the object a tick script which will handle movement; right now the initialize and collide Player scripts are point-item specific (init sets point item image, collision gives points).







EDIT of Magic, Progress and Awesome

Okay, so remember this?
I really need to get into ANTLR more and figure out how exactly to get it to do what I want it to, so that we can get a real scripting language in here already.  That would really kick ass.

... unless someone else wants to take up that end of things?  Any volunteers?  If we could at least get a grammar in place for the script language (mdScript?), it'd make things easier.  DoublyTriply so if it outputs mdBase, since that would trivialize the part of then getting it into the engine itself.

... forget about that whole "unless someone else wants to do it part".  I just figured the thing out.  Behold the magic, as I transform a sample script:

Code: [Select]
global stuff;

enemy "A thing"
{
   define my_stuff;

   initialize
   {
      my_stuff = 5 + Get_ID();
      Set_Stuff(my_stuff, 1);
   }

   tick
   {
      my_stuff = my_stuff * 2 + 1;
      New_Stuff(my_stuff, 2+1/3, More_Stuff(my_stuff + 1));
   }

   collide "Super Shot"
   {
      Obj_Destroy(Get_Collided_ID());
   }

   collide_2 "A thing"
   {
      my_stuff = my_stuff + 1;
   }
}

enemy_shot "Super Shot"
{
   define lol;

   tick
   {
      Obj_Set_Angle(Get_My_ID(), Get_Angle_To_Player());
   }
}

... into its mdBase equivalent:

Code: [Select]
Object_Type enemy A thing
Script initialize
callret "Get_ID", !0
add !1, 5, !0
set @my_stuff, !1
call "Set_Stuff", @my_stuff, 1
Script tick
mul !0, @my_stuff, 2
add !1, !0, 1
set @my_stuff, !1
div !0, 1, 3
add !1, 2, !0
add !2, @my_stuff, 1
callret "More_Stuff", !3, !2
call "New_Stuff", @my_stuff, !1, !3
Script collide Super Shot
callret "Get_Collided_ID", !0
call "Obj_Destroy", !0
Script collide_2 A thing
add !0, @my_stuff, 1
set @my_stuff, !0
Object_Type enemy_shot Super Shot
Script tick
callret "Get_My_ID", !0
callret "Get_Angle_To_Player", !1
call "Obj_Set_Angle", !0, !1

(note - the global, stuff, isn't referenced anywhere in the mdBase because it was never referenced outside the initial declaration)

It's still a bit basic, with a bunch more progress to go through:
  • Almost none of the functions called here are actually defined yet - either they'll be predefined functions in the engine, or they'll be remapped to mdBase commands.
  • No support for loops yet.  That's something that'll be added to the grammar at some point (while loops, at the very least).  Same goes for if statements.
  • Also no support for several operations (modulus, for instance) and booleans; string support should work but I haven't tested it yet.
  • Right now it doesn't interface with the program itself, and doesn't factor in the scriptfile headers at all.
  • Probably some other minor issues
  • I haven't touched error handling yet, so I'm not sure what it'd do.

But, still, it's a pretty awesome piece of progress, I think.


Also, some quick updates to the program itself:
  • implemented callret and ret commands.
    callret is just like call, except it expects the function to return a value.
    ret sets the value that a function will return.  Right now, this won't immediately break out of the function (subject to change).  Also, if a function does not ever set a return value, it returns the number zero (also subject to change).
  • Defined the built-in function Get_My_ID to test the above commands. It's really simple:
    get_my_id !id
    ret !id
  • Added labels to mdBase.
    A label line is simply a label identifier, followed by a colon.
    Labels can later be referenced by jmp commands by putting the label name in quotes, instead of a number, like below
Code: [Select]
Loop_Start:
/ some loop stuff
/ .
/ .
/ .
/ If !continue_looping is true, we'll jump back to the label above.
jmp !continue_looping, "Loop_Start"

When reading in the script, the program translates the label into the correct script index to jump to.

These labels will be necessary when higher structures, like if and while are implemented in mdScript, because otherwise it would be a disaster and a half trying to get it to calculate the correct indices to jump to for each of them.




;D
« Last Edit: October 17, 2009, 05:13:43 AM by Nuclear Cheese »
to quote Naut:
"I can see the background, there are too many safespots."
:V

Stuffman

  • *
  • We're having a ball!
Re: A replacement for Danmakufu?
« Reply #244 on: October 17, 2009, 05:30:56 AM »
So very exciting!

Drake

  • *
Re: A replacement for Danmakufu?
« Reply #245 on: October 17, 2009, 05:58:56 AM »
Holy yes.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: A replacement for Danmakufu?
« Reply #246 on: October 17, 2009, 06:06:02 AM »
Yes, while-loop is good. Also for-loop. And for-each would be splendid, too, I spose ...

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: A replacement for Danmakufu?
« Reply #247 on: October 18, 2009, 02:58:27 AM »
Yes, while-loop is good. Also for-loop. And for-each would be splendid, too, I spose ...

for loop is basically a different syntax for a while loop of sorts, so it's kinda low-priority in my mind right now.  As for foreach ... I'm assuming you want an easy way to iterate over an array?  That could be useful, once I actually put support for arrays in.



New progress tonight:

  • mdScript:
    • while loops
    • boolean and comparative logic
    • if statements
    • single-line comments using //
    • added string literals (I thought they were in before, but they actually weren't)
  • Musuu no Danmaku (the program itself):
    • new functions:
      • Create_Object - parameters: type, x, y
      • Fire_Shot_01 - parameters: x, y, angle, speed, image ... currently assumes a certain size for the shot; will, of course, be updated.
      • Set_Size - parameters: size, size2
      • Set_Image - parameters: image, rotate, layer
        rotate is a boolean that determines if the image will rotate with the object's angle or not.
        layer is the graphic layer to draw the image on.
      • Set_Player_Movement - parameters: unfocused, focused


Also, I rewrote the current test script in mdScript (save for file headers), and successfully used the parser to translate it into working mdBase.

Code: (mdScript) [Select]
// Starter object
// Temporary object used to spawn the boss and the player
// Will be unnecessary once the program can figure out what to spawn on its own.
Effect "Starter"
{
   initialize
   {
      Create_Object("ThePlayer", 213, 400);
      Create_Object("TheEnemy", 213, 100);
      my_id = Get_My_ID();
      Destroy_Object(my_id);
   }
}

// ThePlayer
// Player object
Player "ThePlayer"
{
   initialize
   {
      Set_Image("test1.png", false, 20);
      Set_Player_Movement(5.4, 3.2);
      Set_Size (3.2, 16);
   }
}

// TheEnemy
// Enemy boss that makes some fucking danmaku.
Boss "TheEnemy"
{
   define count;

   initialize
   {
      Set_Image("reimu1.png", false, 30);
      Set_Size(24, 30);
      count = 60;
   }

   tick
   {
      count = count - 1;

      // When count reaches zero, we fire a spread of bullets, and spawn a point item.
      if (count <= 0)
      {
         // Adjust the "20" here to change the frequency of firing spreads.
         count = count + 20;

         // Adjust the "20" here to change the density of spreads.
         increment = 1.5707963267948966192313216916398 / 20;
         angle = 3.9269908169872415480783042290994;
         while (angle > 2.3)
         {
            Fire_Shot_01(213, 100, angle, 2.5, "shot1.png");
            angle = angle - increment;
         };
         Create_Object("Point_Item", 213, 100);
      };
   }
}

Code: (mdBase) [Select]
Musuu
Script[mdBase]

Object_Type Effect Starter
Script initialize
call "Create_Object", "ThePlayer", 213, 400
call "Create_Object", "TheEnemy", 213, 100
callret "Get_My_ID", !0
set !my_id, !0
call "Destroy_Object", !my_id
Object_Type Player ThePlayer
Script initialize
call "Set_Image", "test1.png", false, 20
call "Set_Player_Movement", 5.4, 3.2
call "Set_Size", 3.2, 16
Object_Type Boss TheEnemy
Script initialize
call "Set_Image", "reimu1.png", false, 30
call "Set_Size", 24, 30
set @count, 60
Script tick
sub !0, @count, 1
set @count, !0
less !0, @count, 0
equ !1, @count, 0
add !2, !0, !1
not !3, !2
jmp !3, "Label0"
add !0, @count, 20
set @count, !0
div !0, 1.5707963267948966192313216916398, 20
set !increment, !0
set !angle, 3.9269908169872415480783042290994
Label1:
less !0, 2.3, !angle
not !1, !0
jmp !1, "Label2"
call "Fire_Shot_01", 213, 100, !angle, 2.5, "shot1.png"
sub !0, !angle, !increment
set !angle, !0
jmp true, "Label1"
Label2:
call "Create_Object", "Point_Item", 213, 100
Label0:

(I copied the mdBase into a file and added the headers manually, but other than that it all works)

What do you guys think of the mdScript syntax?  Any suggestions so far?

(EDIT: just realized that I could skip the local var my_id in Starter.initialize entirely ... could instead just say Destroy_Object(Get_My_ID()); :V )



Also, memo to self:
Add to the list of functions a count of how many args they take, and fail a call or callret if the wrong number of args are given.
« Last Edit: October 18, 2009, 03:00:56 AM by Nuclear Cheese »
to quote Naut:
"I can see the background, there are too many safespots."
:V

Re: A replacement for Danmakufu?
« Reply #248 on: October 18, 2009, 04:50:22 PM »
I'm assuming you want an easy way to iterate over an array?  That could be useful, once I actually put support for arrays in.
Just so!

Also, I have a bad feeling about trying to make focus hardcoded, since not all games would necessarily use Focus. (Or they might do it differently -- just look at StB. And in Suguri, instead of "focus", it has dashing, which makes you invincible to bullets (but not collisions or missiles).) Not saying you shouldn't do something like that (we've already had this discussion with Power), but just throwing out comments. Can you tell I'm prejudiced in favor of making it more flexible as opposed to true-to-Touhou?

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: A replacement for Danmakufu?
« Reply #249 on: October 18, 2009, 05:23:33 PM »
I have something I would LOVE for you to add!

The ability to convert a pile of scripts into a .exe for everyone to play regardless of having danmakufu.

Oh and those floaty things around the boss are annoying IMO
I had a teacher who used to play radiohead during class once.

ONCE.

Re: A replacement for Danmakufu?
« Reply #250 on: October 18, 2009, 05:38:19 PM »
I have something I would LOVE for you to add!

The ability to convert a pile of scripts into a .exe for everyone to play regardless of having danmakufu.

Oh and those floaty things around the boss are annoying IMO
Yes.
And it may even help stop ripping, avoiding the "HELEPOLIS, STOP"


I'll be honest and say that if I were to make my own original characters, I don't want people to steal them without permission or until I make them open-source.
« Last Edit: October 18, 2009, 05:40:01 PM by Lishy »

Re: A replacement for Danmakufu?
« Reply #251 on: October 18, 2009, 10:01:17 PM »
Oh and those floaty things around the boss are annoying IMO
Maybe give enemies an "effects surrounding sprite" part of their script, and the default-scripts for the boss would have an "effects surrounding boss" which you could turn off, maybe ...

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: A replacement for Danmakufu?
« Reply #252 on: October 19, 2009, 02:34:13 AM »
Just so!

Also, I have a bad feeling about trying to make focus hardcoded, since not all games would necessarily use Focus. (Or they might do it differently -- just look at StB. And in Suguri, instead of "focus", it has dashing, which makes you invincible to bullets (but not collisions or missiles).) Not saying you shouldn't do something like that (we've already had this discussion with Power), but just throwing out comments. Can you tell I'm prejudiced in favor of making it more flexible as opposed to true-to-Touhou?

Perhaps a function for the game script that will disallow holding the focus key from slowing the player down?

AllowFocusedMovement(false);



I have something I would LOVE for you to add!

The ability to convert a pile of scripts into a .exe for everyone to play regardless of having danmakufu.

While converting things into a standalone .exe would be a real bitch (and that's if it's "easy"), there is a plan to have a "compiled" script format, whereby you could just distribute the one big file with everything in it, along side the Musuu no Danmaku executable (possibly with other files that it needs and can't be packed easily).

No guarentees on it being unbreakable or anything, but it would at least curb stealing/modifying/etc (I'm looking at you, Suikama >:() and provide a single, condensed file to package everything in.





Just a quick bit of progress tonight, I made the main program able to read in mdScript files.  You can take the mdScript code I posted previously, add the header lines to it, and throw it at Musuu no Danmaku directly, rather than what I had to do yesterday (run a program to convert to mdBase, manually save it and add headers, then run it).  Wheee.



Also, a heads up, I might get as much as usual done next week, due to being busy getting hype at ACT XII.
to quote Naut:
"I can see the background, there are too many safespots."
:V

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: A replacement for Danmakufu?
« Reply #253 on: October 19, 2009, 02:35:41 AM »
  • Set_Image - parameters: image, rotate, layer
    rotate is a boolean that determines if the image will rotate with the object's angle or not.
    layer is the graphic layer to draw the image on.

object
rotate

Is that object rotation I'm hearing?  How splendid!  Now I won't have to make and delete objects in a loop while auto-setting a new Z parameter for a rotation angle.  I also had to manually set the new X and Y positions for movement, and a direction angle, and speed, just to get the object to move from one point to another at an angle I want while rotating.  Because SetSpeed doesn't work if the object will be deleted a frame after it's fired.

Keep doing whatever you're doing. I love the sound of this.

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: A replacement for Danmakufu?
« Reply #254 on: October 19, 2009, 02:40:53 AM »
Is that object rotation I'm hearing?  How splendid!  Now I won't have to make and delete objects in a loop while auto-setting a new Z parameter for a rotation angle.  I also had to manually set the new X and Y positions for movement, and a direction angle, and speed, just to get the object to move from one point to another at an angle I want while rotating.  Because SetSpeed doesn't work if the object will be deleted a frame after it's fired.

Keep doing whatever you're doing. I love the sound of this.

Umm ... right now, this rotation is the same as the object's facing angle, which is the direction it will move when its speed is greater than zero.  Just like in Danmakufu.

I'm pretty sure there's a way to make rotating shots in Danmakufu, though, and it'll get added into Musuu no Danmaku as well at some point.



... and please tell me you aren't really deleting and recreating objects every frame.  That's rediculous! :vbang:
to quote Naut:
"I can see the background, there are too many safespots."
:V

Stuffman

  • *
  • We're having a ball!
Re: A replacement for Danmakufu?
« Reply #255 on: October 19, 2009, 02:58:24 AM »
Quote
Now I won't have to make and delete objects in a loop

Holy inefficient code, Batman!

We'll have to take a look at this later.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: A replacement for Danmakufu?
« Reply #256 on: October 19, 2009, 02:59:32 AM »
Umm ... right now, this rotation is the same as the object's facing angle, which is the direction it will move when its speed is greater than zero.  Just like in Danmakufu.

I'm pretty sure there's a way to make rotating shots in Danmakufu, though, and it'll get added into Musuu no Danmaku as well at some point.



... and please tell me you aren't really deleting and recreating objects every frame.  That's rediculous! :vbang:







Indeed I have.  Like so.  I'm sure you can guess what I use it for.
Code: [Select]
#TouhouDanmakufu[Stage]
 #Title[Object loop]
 #Text[rotation&movement]
 #Player[FREE]
 #ScriptVersion[2]
 
 script_stage_main{
   
    let imagefile = GetCurrentScriptDirectory ~ "leaf.png";
    let resurrectionframe=0;
    @Initialize{

       LoadGraphic(imagefile);
       blowingup;

    }
 
    @MainLoop{

     yield;


    }
 
    @DrawLoop{
    }
 
    @BackGround{
    }
 
    @Finalize{

       // clear the loaded image file from memory

    }


         task blowingup{  yield;

                  fireshot(80,60);
                      }



          task fireshot(shots,time){   yield;

        let total=0; let angleused=0; let angle=0;

         loop(time){       
                                total+=(shots/time);
                                while(total>=1){firstobjecteffect(angleused);  angleused+=500/70; total--;}
                                yield;
                       }
                                 

       }














 task firstobjecteffect(angle){
                            ///first and second row, rotation, movement, speed, and angle
                            ///third for, scaling
                            ///fourth row, colors and alpha value
                            let rotatez=0;    let X=rand(-1,1);  let Y=rand(-1,1); let AddX=0;   let AddY=0;
                            let speed=rand(1,5);  let Z=rand(0,360);  let rotate=0;   let rotation=rand(-2,2);
                            let addtoscale=0;  let AddWhatToScale=-0.04; let Spawnscale=rand(2.5,5);
                            let red=rand(100,255);  let blue=rand(100,255);  let green=rand(100,255); let alpha=255;



         loop{      let totalscale=Spawnscale+addtoscale; if(totalscale<0){totalscale=0;}

          let objid = Obj_Create(OBJ_EFFECT);
          Obj_SetPosition(objid,GetCenterX+X,GetCenterY+Y);


          ObjEffect_SetRenderState(objid,ADD);
          ObjEffect_SetTexture(objid, imagefile);

          ObjEffect_SetAngle(objid,0,0,Z+rotate);
          ObjEffect_SetScale(objid,totalscale,totalscale);

 
          ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
 
          ObjEffect_CreateVertex(objid, 4);
 

          ObjEffect_SetVertexXY(objid, 0, -17, 17);
          ObjEffect_SetVertexUV(objid, 0, 0, 34);
          ObjEffect_SetVertexColor(objid, 0, alpha, red, blue, green);



          ObjEffect_SetVertexXY(objid, 1, -17, -17);
          ObjEffect_SetVertexUV(objid, 1, 0, 0);     
          ObjEffect_SetVertexColor(objid, 1, alpha, red, blue, green);


          ObjEffect_SetVertexXY(objid, 2, 17, 17);
          ObjEffect_SetVertexUV(objid, 2, 32, 34);
          ObjEffect_SetVertexColor(objid, 2, alpha, red, blue, green);


          ObjEffect_SetVertexXY(objid, 3, 17, -17);
          ObjEffect_SetVertexUV(objid, 3, 32, 0);
          ObjEffect_SetVertexColor(objid, 3, alpha, red, blue, green);


          yield; Obj_Delete(objid);
          X+=cos(angle)*speed;  Y+=sin(angle)*speed;

          rotate+=rotation;

          addtoscale+=AddWhatToScale;
          if(totalscale<Spawnscale/3.5){alpha+=-17;}
                       }
             




     }


 }
« Last Edit: October 19, 2009, 10:08:58 PM by Fujiwara no Mokou »

Re: A replacement for Danmakufu?
« Reply #257 on: October 19, 2009, 03:34:49 PM »
Take out all underscores in all functions, they are completely unnecessary. In addition to that, I'm still pretty sure it's completely unnecessary to add opening and closing bracks to functions that have no parameters (GetCenterX();, Main();, etc. versus GetCenterX;, Main;, etc.).

How do you plan to handle micro-threads? Helepolis is teaching all the new recruits to program everything in tasks, so something similar would be preferred, if possible. Especially given the reason people have to learn using Helepolis' videos instead of the tutorials. I know you hate tasks, but I feel this will at least get rid of a lot of bitching in the near future.
« Last Edit: October 19, 2009, 03:37:01 PM by Naut »

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: A replacement for Danmakufu?
« Reply #258 on: October 19, 2009, 09:49:57 PM »
While converting things into a standalone .exe would be a real bitch (and that's if it's "easy"), there is a plan to have a "compiled" script format, whereby you could just distribute the one big file with everything in it, along side the Musuu no Danmaku executable (possibly with other files that it needs and can't be packed easily).
Well at least where you don't have to go through a menu screen like danmakufu, doesn't need AppLocale, and actually looks like a touhou game when you run it(Low priority IMO)
I had a teacher who used to play radiohead during class once.

ONCE.

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: A replacement for Danmakufu?
« Reply #259 on: October 20, 2009, 01:32:10 AM »
Take out all underscores in all functions, they are completely unnecessary. In addition to that, I'm still pretty sure it's completely unnecessary to add opening and closing bracks to functions that have no parameters (GetCenterX();, Main();, etc. versus GetCenterX;, Main;, etc.).

The underscores are the way I usually type identifiers; if people would prefer underscoreless function names that can be arranged with ease.

As far as pulling the parentheses (brackets are {} ;) ) off of argumentless function calls, I don't like that, honestly - it makes the syntax ambiguous.  There's nothing stopping you from defining a variable named GetSpeed (well, aside from good programming practice, but you don't design something like this assuming the user will never do something stupid ...), so if you write code such as:

Code: [Select]
Enemy_Shot "Lol I'm a Bullet"
{
   define GetSpeed;

   initialize
   {
      GetSpeed = 5.0;
      SetSpeed(3.0);
   }

   tick
   {
      temp = GetSpeed; // now what?
   }
}

By requiring the parentheses, we guarantee a lack of syntactic ambiguity in the script - that is, the parser can immediately be sure how something should be interpreted.

Besides, C/C++/C#/Java(if I remember correctly) all have it like this. :V



How do you plan to handle micro-threads? Helepolis is teaching all the new recruits to program everything in tasks, so something similar would be preferred, if possible. Especially given the reason people have to learn using Helepolis' videos instead of the tutorials. I know you hate tasks, but I feel this will at least get rid of a lot of bitching in the near future.

Well, correct me if I'm wrong, but isn't the usual way of using tasks is to create a separate task to control, say, an object bullet as it moves about the screen?  This would instead be done using code for such a bullet directly, by defining a custom bullet object type.  The structure would, by my understanding, be quite similar:

Code: [Select]
// ... other stuff ...

Enemy_Shot "LolShot"
{
   define count;

   initialize
   {
      count = 0;

      // Call the original shot init script, since
      // it's overridden here.
      EnemyShotInit();
   }

   tick
   {
      count = count + 1;
      if (count = 60)
      {
         count = count - 120;
         SetAngle(GetAngleToPlayer());
      }
   }
}

(Note - I may add support to, by default, call the default initialize/etc scripts automatically even when they're overridden like this, with an option to turn this off when desired.)

Correct me if I'm mistaken, but isn't this much like the typical use of tasks to handle object bullets?


Also - aren't tasks a more advanced topic to begin with?  Shouldn't the new recruits be taught simple stuff first, like "how I shot bullet?" and such ???



Well at least where you don't have to go through a menu screen like danmakufu, doesn't need AppLocale, and actually looks like a touhou game when you run it(Low priority IMO)

The program can be designed to skip the menu screen in such cases.  Applocale shouldn't even be an issue, since .NET is completely Unicode by default.  Actually looking like a Touhou game will be up to people with actual art skills (read: not me :/).
to quote Naut:
"I can see the background, there are too many safespots."
:V

Re: A replacement for Danmakufu?
« Reply #260 on: October 20, 2009, 02:09:50 AM »
The underscores are the way I usually type identifiers; if people would prefer underscoreless function names that can be arranged with ease.

The underscore is completely unnecessary to type considering you're capitolizing the next word in the function anyway. Just seems like a needless use of two hands when typing, as well as affecting overall typing speed. I hate typing underscores, it's the slowest thing on the keyboard. Oh God.


As far as pulling the parentheses (brackets are {} ;) ) off of argumentless function calls, I don't like that, honestly - it makes the syntax ambiguous.  There's nothing stopping you from defining a variable named GetSpeed (well, aside from good programming practice, but you don't design something like this assuming the user will never do something stupid ...), so if you write code such as:

Code: [Select]
...
By requiring the parentheses, we guarantee a lack of syntactic ambiguity in the script - that is, the parser can immediately be sure how something should be interpreted.

Most programming languages do not allow you to name variables the same as built-in functions.


Besides, C/C++/C#/Java(if I remember correctly) all have it like this. :V

Danmakufu doesn't require you to do that, isn't it C-based (dipping in to territory I do not understand)?


Well, correct me if I'm wrong, but isn't the usual way of using tasks is to create a separate task to control, say, an object bullet as it moves about the screen?
...
Correct me if I'm mistaken, but isn't this much like the typical use of tasks to handle object bullets?

That is a way to use tasks, yes. It is nowhere near the only way and is now not even the usual way to use tasks. I was referring to the ambigiuty between jumping between tasks using yield; (you once said something like "not knowing which task is run before another," or something similar, forgive me if I incorrectly paraphrase considering we actually know which tasks are prioritized before others), as well as them running alongside the @MainLoop as their own thread. Are you going to follow the same idea or what?


Also - aren't tasks a more advanced topic to begin with?  Shouldn't the new recruits be taught simple stuff first, like "how I shot bullet?" and such ???

Take a gander.

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: A replacement for Danmakufu?
« Reply #261 on: October 20, 2009, 04:54:32 PM »
Since it apparently wasn't addressed, object-object collision is absolutely ESSENTIAL. Some of the most creative danmaku of ever used object-object collision. Also, I don't mean to nag, but don't forget about common data files.

I'll stop bugging you now. =\ You're the strongest, NC.

Drake

  • *
Re: A replacement for Danmakufu?
« Reply #262 on: October 20, 2009, 05:10:05 PM »
Since it apparently wasn't addressed, object-object collision is absolutely ESSENTIAL. Some of the most creative danmaku of ever used object-object collision.
Not addressed? It's already been implemented.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: A replacement for Danmakufu?
« Reply #263 on: October 20, 2009, 10:12:50 PM »
Random question time!

Can individual scripts be made into standalone .exe files? Saves the trouble of "you must download this, then this, then put this in lib, then uncomment line 9, then..."

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: A replacement for Danmakufu?
« Reply #264 on: October 21, 2009, 02:28:59 AM »
The underscore is completely unnecessary to type considering you're capitolizing the next word in the function anyway. Just seems like a needless use of two hands when typing, as well as affecting overall typing speed. I hate typing underscores, it's the slowest thing on the keyboard. Oh God.

Well, I can take them out - it's just a naming issue.  Does anyone else here have an opinion?
I find it a bit easier to read the names when they're spaced out more, but I do agree that it's a bit slower to type the underscores. I dunno about that being the slowest thing to type on the keyboard, though.  Depends on the keyboard, too.



Most programming languages do not allow you to name variables the same as built-in functions.

Right now, the main problem is scope.  Unlike actual programming languages, the scripts we're making here can be broken up quite a bit, and the program may not have a full list of all functions that are defined by the time it hits a possible reference - the function could be defined later in the script file, or even in another file entirely (this is once we get custom-definable functions in place) - hell, it might be written in a different scripting language even!  The way it works with the parser currently is that it needs to make a decision when it hits the reference, either determining it's a variable or a function call, so we need a way to unambiguously determine this without necessarily knowing all of the available functions at that point.

In my opinion, the parenthesis is the simplest solution.  It clearly marks that it's a function call (consistently with calls that do have arguments), while variable references will be obvious from their lack of parenthesis.

An alternative would be to, instead, require all local variables to be explicitly declared.  This would remove the ambiguity in a different way, although I feel it's not as clean of a solution.  On average, you probably wouldn't save any typing by omitting the parentheses, since you'd have to type out variable declarations and you'd still need parentheses on functions calls with args.  Also, I think it makes the script a bit less clear to read, since you'll need to determine whether something is a variable reference or a arg-less function call, rather than the parentheses making it instantly clear.
Finally, while I might be able to work around this, if you forget to declare a local var under this system, it might start throwing "unknown function" errors at you, which might make it more confusing to debug.

To summarize, we can't take out the parens without adding in explicit local var declaration because a global function could be defined in another file, and the parser wouldn't know if you want a local var or a function call.

I'm not trying to force my way here, but I think we need to consider the pros and cons before switching things like this.


What do people think about this?  Thoughts and suggestions?



Danmakufu doesn't require you to do that, isn't it C-based (dipping in to territory I do not understand)?

C-based programming languages all require parentheses on all function calls.  Omitting the parens gets you a reference to the function itself (useful for some tricky things).

Danmakufu isn't really "C-based", it's more of a "C-look-alike".  It imitates many of the syntax features of C, but there are several discrepancies.

mdScript isn't much different in that regard, really.



That is a way to use tasks, yes. It is nowhere near the only way and is now not even the usual way to use tasks. I was referring to the ambigiuty between jumping between tasks using yield; (you once said something like "not knowing which task is run before another," or something similar, forgive me if I incorrectly paraphrase considering we actually know which tasks are prioritized before others), as well as them running alongside the @MainLoop as their own thread. Are you going to follow the same idea or what?

By the nature of multitasking, you generally aren't ever given a specific order that tasks/threads are run.  This can lead to ambiguity of order, but this usually isn't a problem as long as each thread keeps to itself.

My main gripe with Danmakufu's task setup is that it is, in my opinion, horribly designed.  Using tasks changes the semantics of @MainLoop from a "run this once per frame" script to a "loop here, and don't forget to yield" script, for instance.

I have been considering adding a command similar to yield into Musuu no Danmaku.  The main difference here being that it would only affect the script using it - other scripts will continue on as normal, while the yielding script will resume execution next frame.
The biggest obstacle there is saving off the call stack (which right now is done intrinsically by using recursive calls to Script.Run()*) and other necessary information so that it can be resumed later, while still allowing other scripts as well as other instances of the same script to run without interference.

* Script class, in Script.cs - contains necessary information for a script.  Gets instantiated for each script of each object type, as well as for each function defined.  Run runs the script defined in the object.



Take a gander.

Internet is being a pain right now, so I'll have to look at this another time.



Since it apparently wasn't addressed, object-object collision is absolutely ESSENTIAL. Some of the most creative danmaku of ever used object-object collision. Also, I don't mean to nag, but don't forget about common data files.

I'll stop bugging you now. =\ You're the strongest, NC.

Not addressed? It's already been implemented.

This.  ;D

For any object type, you can define a collision script for a collision with an object of any other object type or base type, and can also define a script for collisions with any object that isn't covered by the more specific collision scripts.

If there is demand, I can also add in a function to check if a particular pair of objects is colliding at the moment.


Important performance note for people planning ahead: collision-checking lots of things takes lots of processor.  The "collide with anything" script should be wielded very carefully, and definitely shouldn't be used for types that you'll be spawning several objects of at once.  It will be much better to narrow down what your object will need to check for collision with, and specify that.
For instance, an Enemy_Shot will collide with the base type Player (to determine when the player is hit or when a shot is grazed), and, for fancy patterns, may also collide with another specific type of enemy shot.  But chances are you'll have no need to collision check an Enemy_Shot with a Boss or Item (you can, but in most cases you'd have no need to).



Random question time!

Can individual scripts be made into standalone .exe files? Saves the trouble of "you must download this, then this, then put this in lib, then uncomment line 9, then..."

This has been covered before, but the current plan is that, while there will not be a "build into .exe file" option, there will be the option to "compile" a set of scripts into a single, condensed file to simplify distribution.  Also, I plan on having a way of setting up the program to automatically run a script, to allow people to distribute a finished game/scriptpack/brofist extravaganza with the program together in a directory, and have it auto-run the packed script when launched.  Details on this are TBD at the moment.



Oh, and I had this crazy idea that would be for way, way, waaaay~ down the line -
An integrated content distribution system that would allow people to upload and download scripts from the program itself to a server.  Add in things like rantings, sorting by author/genre/etc, automated checking for updates, etc., and it could become some crazy-awesome setup.

Of course, this would be at the bottom of the feature list. :V
to quote Naut:
"I can see the background, there are too many safespots."
:V

Re: A replacement for Danmakufu?
« Reply #265 on: October 21, 2009, 02:37:56 AM »
Oh, and I had this crazy idea that would be for way, way, waaaay~ down the line -
An integrated content distribution system that would allow people to upload and download scripts from the program itself to a server.  Add in things like rantings, sorting by author/genre/etc, automated checking for updates, etc., and it could become some crazy-awesome setup.

Of course, this would be at the bottom of the feature list. :V
Please don't. It really isn't needed and will be nothing but trouble.

Y'know, I think the EXE thing is starting to get popular enough that you should at least consider it. If nothing else, just an "EXE which has its own specified icon and automatically loads a given compiled script/set of scripts, possibly with no other functionality for selecting other scripts" ...
« Last Edit: October 21, 2009, 02:39:33 AM by KimikoMuffin »

Re: A replacement for Danmakufu?
« Reply #266 on: October 21, 2009, 06:09:58 AM »
Well, I can take them [underscores] out - it's just a naming issue.  Does anyone else here have an opinion?[/size]
Underscore naming has been out of fashion since the mid-nineties.

Most programming languages do not allow you to name variables the same as built-in functions.
Actually, most languages -do- allow you to name variables the same as functions. The only exception I can think of right now is some functional languages.

By the nature of multitasking, you generally aren't ever given a specific order that tasks/threads are run.
Depends on your thread scheduler. It's certainly possible to activate each task once a frame in the same order.

The biggest obstacle there is saving off the call stack (which right now is done intrinsically by using recursive calls to Script.Run()*) and other necessary information so that it can be resumed later, while still allowing other scripts as well as other instances of the same script to run without interference
Implement tasks scheduling as iterating over a list of generators and implementing the script yield using C# yield?

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: A replacement for Danmakufu?
« Reply #267 on: October 21, 2009, 04:24:10 PM »
Not addressed? It's already been implemented.

This is why I tend not to post in this thread, lol. The water level is more than a couple inches above my head, so to speak. One last thing: will we ever see a song looping function or two? =\

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: A replacement for Danmakufu?
« Reply #268 on: October 22, 2009, 02:16:15 AM »
Please don't. It really isn't needed and will be nothing but trouble.

I was just throwing the idea out there; no plans to do anything with it currently.
Not sure why you say it'd be "nothing but trouble", though - it's a fairly straightforward thing to implement, in my opinion.



Y'know, I think the EXE thing is starting to get popular enough that you should at least consider it.

Of course I'll consider it at some point.  I honestly don't know what it'll take, though.



If nothing else, just an "EXE which has its own specified icon and automatically loads a given compiled script/set of scripts, possibly with no other functionality for selecting other scripts" ...

This is basically what I was talking about before, save for possibly not being able to customize the icon.



Underscore naming has been out of fashion since the mid-nineties.

I disagree.  It's the standard where I work.

But whatever you people want can be arranged for this.  Well, within reason; I refuse to name all of the built in functions a, b, etc. ;)



Depends on your thread scheduler. It's certainly possible to activate each task once a frame in the same order.

Point.  Since we'd have our own scheduling here, the issue of tasks having ambiguously interleaved processing is mitigated.  So scratch that concern.



Implement tasks scheduling as iterating over a list of generators and implementing the script yield using C# yield?

Oh wow.  I've never seen this before.

I can see how you could use it to solve the issue of saving off the stack and such, although I'd need a bit of planning to get it implemented in a way that doesn't look and run like total crap.

This still leaves the issue of tracking what objects have scripts running and such.  Entirely feasible to deal with, but again requires some planning to implement well.


To be honest, I think that, while thinking about it and starting to plan things out is a good idea, I think implementation of threads/tasks should be delayed until we have the main (single-thread) execution engine proven to work solidly, since such an addition will surely complicate things.


As far as syntax is concerned, I think a simple yield statement would work.  Or, perhaps, we could even extend it to take an (optional?) argument, indicating the number of frames to delay.
Thinking about it, having separate tasks that can delay, while retaining the "once-per-frame" semantics of the tick and such script, would simplify the above complications a bit.  In other words, it would be easier, in my opinion, to disallow yield in the main scripts, instead requiring a separate task to be launched.

As far as syntax, how's this for a quick design sample?

Code: [Select]
Musuu
Script[mdScript]

Enemy "ImaBoss"
{
   // A task to control movement
   task movement_task
   {
      while (true)
      {
         yield 31;
         MoveToSomeOtherRandomPosition();
      }
   }

   // A task to control shots
   task shot_task
   {
      while (true)
      {
         yield 23;
         FireSomeFuckingDanmaku();
      }
   }

   initialize
   {
      // Run the two tasks
      movement_task();
      shot_task();

      // Other initialization stuff
      SetLife(100);
      SetScore(9);
   }
}

(of course, this could just as easily be implemented without tasks, but I wanted to give a simple example for syntax.)

This is much like Danmakufu's task syntax, right?  (serious question - I honestly don't remember at the moment.)

As you can probably figure out, both tasks each run their own stuff independently, resulting in the boss firing every 23 frames and moving every 31 frames.  The function-call-like syntax in the initialize script initiates an instance of each task (Perhaps it may be beneficial to have some different marker here, to clarify that we're launching a task instead of calling a function?).

Running multiple instances of a single task shouldn't be a problem, although we may want to define some sort of upper limit so that we don't get some joker breaking things with something stupid like:

task lol
{
   while (true)
   {
      lol();
      yield;
   }
}


Another related question would be scope of tasks - should we have tasks both definable per object type and globally, or would just one of the two suffice?



One last thing: will we ever see a song looping function or two? =\

Once I implement music, there will be some sort of music looping.  I'm not sure if I can get true music looping to work well - that is, defining a loop start and end point within a single music file, something like this:

PlayMusic("omgbestsongevar.ogg", 40.2, 92); // Loop from 40.2 sec to 92 sec

Failing that, I have a backup plan which will require a small bit of work on the scripter's side - split the song into two files: one for the intro (before the loop) and one for the loop.  What will then happen is the intro file will be played once, and when that finishes the loop file will start playing and loop repeatedly.  Syntax would be something like this:

PlayMusic("omgbestsongevar_intro.ogg", "omgbestsongevar_loop.ogg");

Of course, a simple version will also be available, which just loops a single audio file in its entirety.  Something like ...

PlayMusicSimple("omgbestsongevar.ogg");


Also, FYI - pulled straight from the SDL.NET wiki, audio formats that are supported:
  • WAVE files (.wav)
  • VOC files (.voc, I believe)
  • MIDI files (.mid, .midi)
  • MikMod (.mod, .s3m, .it, .xm)
  • Ogg Vorbis (.ogg)

No MP3 support, unfortunately.  That's a proprietary format, so the code to read it needs to be licensed (wouldn't be on our end, but rather the library that actually reads and decodes the file).
Fortunately, though, it is pretty easy to convert from MP3 to Ogg Vorbis - I'd recommend using Audacity.
to quote Naut:
"I can see the background, there are too many safespots."
:V

Re: A replacement for Danmakufu?
« Reply #269 on: October 22, 2009, 03:48:31 AM »
I think you'd do well to deal with infinite-loops by having it somehow check for them in a check-for-problems stage that it does before actually executing the script.