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

Topics - lafouine88

#1
Advanced Technical Forum / RAM limitations
Fri 28/03/2025 19:58:36
Hi guys

I'm currently facing a problem with my game that displays this message of error
error" border="0

I discussed it a bit with @Crimson Wizard and this seems to be due to a RAM overflow, the current limit of the engine is 3GB.

My game is not really adapted to the AGS engine,it's not really a point and click but more of a RPG. This entails a very greedy use of graphics :
-My maps are 2800*5000px ,oO
-the enemies get created cutting a big spritesheet into dynamic sprites that create 5 views of 8 directions and 8-16 sprites per loop(on average that's 480 sprites per enemy)
-The player's pieces of armor get created similarly creating views for each one, this time:7 views of 8 directions and 816 sprites per loop (670 sprites per piece of armor).

At first I planned to create all the views at startup and then just use them but this definitely asks too much memory. So I tried to divide the needed memory by just loading what's necessary and then deleting the sprites.

For example :
-At game start, the game loads the first map and the 5 first pieces of armor. It also loads the NPC on that map(by creating the necessary views through dynamic sprites).
-When the player changes room, the pieces of armor are kept because the player still wears them, but all the dynamic sprites for NPC get erased to create the new ones : the ennemies from this zone.
-If I get back to the first one, those same dynamic sprites are erased again and replaces by the NPC's.
-and so on...it's a bit longer to load maps because the game creates and recreates over again each time but this saves RAM.

The problem is, even with this method the game still crashes, it actually seems that the 3GB limit is reached very quickly.
According to my calculations, each enemy should use around 125mB, and armor is 175mB. Which means that if I carry 6 pieces of armor (helmet,shoulder,weapon1 and 2, torso and trousers), I already reach 1/3 of my allowed space. Each map loads around 8 different enemies so that's 1/3 more. My map takes around 120mB so that doesn't leave much room, but still it should work.

Do you know how much RAM loaded arrays take(because I use a lot of those for spells, capacities,ennemy stats etc.), and do you think this should also be reduced to a strict minimum? Same for sprites, I use 256*256 because it's more convenient but I guess I could crop the sprites to the minimum necessary, should I ? Or do you have other suggestions to keep my RAM alive ?

Thanks a lot  :-D
#2
Hi guys

I've recently changed a lot in my view system, so I had to delete them to start back on a clean basis. I used like 250+ views and I deleted them all to just have around 30 left. And start again.
Something weird happens though when I create my new views.Instead of adding normally : view 31,32,33... sometimes one or more Id numbers are skipped. It goes 31,32,35,36,37,39 for instance. Which is annoying because I really need the view order for legacy coding. And it doesn't make sense because I ve checked many times, views 33,34 or 38 in this example don't exist anymore.

Any ideas why this would happen?

Thanks
#3
Hi guys
I'm working on a RPG game, and to allow multiple item skins to be show, I used a function with dynamic sprites. Each item has 10 views (walk, idle atk,death...) and the maximum number of pieces of equipment is 6(torso,legs,head,Right hand,left hand and shoulders).
So if you equip an item, it's associated with a number that corresponds to the first view(walk), the rest are logically found with+1,+2...
As so :
Code: ags
///loading function at start up, defines all the items
butin[5].name=sword;
//...items characteristics
 butin[5].viewskin=100;---->the run sword view. 101 is idle, 102 is atk...always in the same order for each item


There is also an array to store the item number for each piece of equipment.
Code: ags
int Skin_stuffed[6];

So when you equip a new item, it changes the Skin_stuffed
  • number and then redraws the wholes views(10 views of 8-15 sprites :/) with all different parts of equipment like this :

Code: ags
 DynamicSprite *MySprite[80];///idle 10*8
 DynamicSprite *MySprite2[64];///run 9*8
 DynamicSprite *MySprite3[128];///atk 16*8
 DynamicSprite *MySprite4[104];///kick 13*8
 DynamicSprite *MySprite5[104];///LH 13*8
 DynamicSprite *MySprite6[112];///sweep 14*8
 DynamicSprite *MySprite7[80];///aoe 10*8
 DynamicSprite *MySprite8[120];///cry 15*8
 DynamicSprite *MySprite9[240];///die 30*8
 ViewFrame *Runviewframe[6]; 
 ViewFrame *Idleviewframe[6]; 
 ViewFrame *Atkviewframe[6];
 ViewFrame *Kickviewframe[6];
 ViewFrame *LHviewframe[6];
 ViewFrame *Sweepviewframe[6];
 ViewFrame *Jumpviewframe[6];
 ViewFrame *Cryviewframe[6];
 ViewFrame *Dieviewframe[6];


function skin_limbs(int currentloop,  int currentframe, int move, int limb){
  if(Skin_stuffed[limb]!=0){
    if(move==0){//run
        Runviewframe[limb]= Game.GetViewFrame(Skin_stuffed[limb], currentloop, currentframe);
        }
    else if(move==1){ ///idle
        Idleviewframe[limb]= Game.GetViewFrame(Skin_stuffed[limb]+1, currentloop, currentframe); 
      }
    else if(move==2){ ///atk
        Atkviewframe[limb]= Game.GetViewFrame(Skin_stuffed[limb]+2, currentloop, currentframe); 
        }
    else if(move==3){ ///kick
        Kickviewframe[limb]= Game.GetViewFrame(Skin_stuffed[limb]+3, currentloop, currentframe); 
        }
    else if(move==4){ ///Latk
        LHviewframe[limb]= Game.GetViewFrame(Skin_stuffed[limb]+4, currentloop, currentframe); 
        }
    else if(move==5){ ///sweep
        Sweepviewframe[limb]= Game.GetViewFrame(Skin_stuffed[limb]+5, currentloop, currentframe); 
        }
    else if(move==6){ ///jump
        Jumpviewframe[limb]= Game.GetViewFrame(Skin_stuffed[limb]+6, currentloop, currentframe); 
        }
    else if(move==7){ ///cry
        Cryviewframe[limb]= Game.GetViewFrame(Skin_stuffed[limb]+7, currentloop, currentframe); 
        }
    else if(move==8){ ///die
        Dieviewframe[limb]= Game.GetViewFrame(Skin_stuffed[limb]+8, currentloop, currentframe); 
        }
  }
else{///empty slots,view 55 is blank frames

  Idleviewframe[limb]=Game.GetViewFrame(55, currentloop, currentframe); 
  Runviewframe[limb]=Game.GetViewFrame(55, currentloop, currentframe); 
  Atkviewframe[limb]=Game.GetViewFrame(55, currentloop, currentframe); 
  Kickviewframe[limb]=Game.GetViewFrame(55, currentloop, currentframe);
  LHviewframe[limb]=Game.GetViewFrame(55, currentloop, currentframe);
  Sweepviewframe[limb]=Game.GetViewFrame(55, currentloop, currentframe);
  Jumpviewframe[limb]=Game.GetViewFrame(55, currentloop, currentframe);
  Cryviewframe[limb]=Game.GetViewFrame(55, currentloop, currentframe);
  Dieviewframe[limb]=Game.GetViewFrame(55, currentloop, currentframe);
}
}

function AlterEgoNormalView() 
{
  int MySpriteNo=0;
  int currentloop=0; 
  int currentframe;


  while (currentloop <= 7)//7 views
  {
    currentframe = 0;
    while (currentframe < 8) ///run view number of sprites
    {
      MySprite2[MySpriteNo] = DynamicSprite.Create(256, 256, true);
      DrawingSurface *MySurface = MySprite2[MySpriteNo].GetDrawingSurface();
      
      
      skin_limbs(currentloop, currentframe, 0,0);
      MySurface.DrawImage(0, 0, Runviewframe[0].Graphic); 
      skin_limbs(currentloop, currentframe, 0,1);
      MySurface.DrawImage(0, 0, Runviewframe[1].Graphic); 
      skin_limbs(currentloop, currentframe, 0,5);
      MySurface.DrawImage(0, 0, Runviewframe[5].Graphic); 
      skin_limbs(currentloop, currentframe, 0, 2); ///r arm
      MySurface.DrawImage(0, 0, Runviewframe[2].Graphic); 
      skin_limbs(currentloop, currentframe, 0, 3); ///L arm
      MySurface.DrawImage(0, 0, Runviewframe[3].Graphic);
      skin_limbs(currentloop, currentframe, 0, 4); shoulder
      MySurface.DrawImage(0, 0, Runviewframe[4].Graphic);
      }

       MySurface.Release();

      ViewFrame *MyViewFrame = Game.GetViewFrame(8, currentloop, currentframe);
      MyViewFrame.Graphic = MySprite2[MySpriteNo].Graphic;
      MySpriteNo ++;
      currentframe ++;
    }
    currentloop ++;
  }
player.ChangeView(8);///view 8 is the run combined view, 9 is idle,10 atk...
}

///then pretty much the same for
//function AlterEgoIdleView();
//AlterEgoaoeView();
//AlterEgoatkView();
//AlterEgocryView();
//AlterEgodeathView();
//AlterEgokickView();
//AlterEgosweepView();
//AlterEgoLHView();


//and this function is called when the item is equipped :

function reloadskin(int base, int slot){ 

Skin_stuffed[slot]=base;
  
AlterEgoNormalView();
AlterEgoIdleView();
AlterEgoaoeView();
AlterEgoatkView();
AlterEgocryView();
AlterEgodeathView();
AlterEgokickView();
AlterEgosweepView();
AlterEgoLHView();
}

I know that s a lot of information. basically each time you equip a new item it redraws 80+64+128+104+104+112+80+120+240 dynamic sprites...it's too much for the engine and it entails a small freeze (around 1-2 seconds depending on the computer's performance).
So there's two questions :
1/I suppose the code is far from optimal, maybe there s things I could change to make it less greedy.
2/If not, do you have ideas of a clever way to smooth the calculating time, something like : When you change equipment it just changes idle and run(which you need straight away) but the atk death views will be calculated at loading screen. Which does'nt create this unpleasant slow in game.

Any ideas to lower the calculation time would be great :)

Thanks and enjoy your week


#4
Hi guys!

I'm using dynamic sprites for my rpg to be able to create differents pieces of stuff.
Thus, I have for each piece of equipment one view for legs, one for body and one for head. I then combine then( code below, but I guess not in cause here).

Problem is, when I combine the 3 views (that look fine on their own) it creates a pink edging around the character and on the shadow.
I found this old thread that might explain the problem, but not really how to solve it :s
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/solved-quick-import-sprites-transparency-issue/msg636525850/#msg636525850

Here are a few pictures :

When I use only legs view for my normal view



When the leg view is combined with body and head-->pink trouble


Thanks in advance :)
#5
Hi guys

I'm facing a room problem on my rpg game. I had planned to design large rooms, like in DIABLO, in which the player can feel the universe IS big. I initially thought this wouldn't be a problem for the AGS engine but after a few tries and discussions on the forum, I realized I was going to be limited by the room size.
I read in a very old post here that the max room size for a 640*400px game ( my resolution) is 2800px height and pretty much unlimited in width. I tried a few things and it is great for 2800*10000(it also works with 2800 width and 10000px height btw).
Thing is, I really had planned a 5600px high map, so I'm missing half of it with this limitation. I tried creating two different maps and setting an edge between them that teleports to the next map with eNextscreentransitioninstant, but there is a tiny pause that also breaks the character walk. The last part can be corrected with a load function I guess, but I couldn't remove the small loading pause, even with a blank room and nothing to load in it.

I guess I could go with it, it breaks a little the dynamic and maniability (which is important in this kind of game) but it's not a huge problem. But before I resort to that I would like to know if any of you already encoutered this kind of issue and if you found a trick :)

Thanks <3
#6
Hi guys

Just a quick question about the repeatedly execute function. I'm not sure how it actually works and I'm a bit concerned about wasting memory because of lazy coding.

I'm using quite a lot of this technique :

Code: ags
function cd_countdown(int i){
//this function aims at displaying the cooldown of a spell once you've played it. (When you cast the spell,it sets Spell[i].cd to a positive value, which triggers the following codes)

 if(Spell[i].cd>0){
   Spell[i].cd--;
   gSpellbar.Controls[i].AsLabel.Text=String.Format("%d", 1+(Spell[i].cd/40)); //a label from the gui that appears on top,
 }
 else{
   Spell[i].cd=-1;
   gSpellbar.Controls[i].AsLabel.Visible=false;  
 } 
}

//but since there are 10 buttons in my spell bar I want it to be checked for every button and spell so I use this :

function repeatedly_execute(){

for(int j=0;j<10;j++){
cd_countdown(j);
}

}

It works fine, but it looks like a huge waste of memory. I feel like the system is checking every second for every Spell.cd to be positive while I would like it to only activate when it's necessary. Do you know if this is the correct way to put it, or if I should add some more conditions to make it less memory consuming?

Thanks a lot :)
#7
Hi guys

So here is my new situation...I swear I'm almost done with my game settings so soon there shouldn't be more questions^^hopefully "^^

I'm working on a rpg game. To make things more cumfortable for me I stored all my struct data in one single script. I set a function that I call on game start so all my spells,inventory items etc. are loaded at the beginning.
As so :

Code: ags
#loadscript.asc

function dataload(){
////loads the data for items...
  loot[0].sprite=2184;
  loot[0].Name="Casque rare de la Chouette";
  loot[0].bonus_agi=10;
loot[1].sprite=2185;
//.....

///and also for skills. Like a template that evolves through a skilltree

  skill[1].Nom="Hard skin"; 
  skill[1].Description=String.Format("Increases armor by %d%",(skill[1].lvlcurrent+1)*2);
  skill[1].sprite=403;
//skill[1].lvlcurrent=0;
skill[2].Name="Advanced strenght";
//.....


}


function game_start(){
dataload();
}

It's great for items and spells because there are 'frozen', they don't change with time. But the skilltree part evolves. When you grow to the next level you get a skill point that you can spend in any of those skills.

Then the corresponding int evolves : skill.lvlcurrent++;

And here is the problem. I use a repeatedly execute function to display the current level of progression of the selected spell. As so:

Code: ags

function mouse_over(){
   GUIControl*lab=GUIControl.GetAtScreenXY(mouse.x, mouse.y);
   GUI*gi=GUI.GetAtScreenXY(mouse.x, mouse.y);

 if(lab!=null){ ////there are a bunch of other conditions here but I removed them to stay focused on the issue

  Lblinfotitre.Text=String.Format("%s",skill[u].Nom ); ///this first label gives the skill name. Works perfectly
  Lblinfo.Text=String.Format("%s",skill[u].Description); ////this one calls for the description given before. Here is the problem
}

function repeatedly_execute(){
mouse_over();
}

I hope I'm making things clear enough "^^ basically when you pass the mouse over the buttons that represent each skill, a gui with two labels appears, and the labels change to give the right names and description of each spell. I link a video to show better. What should happen is the description should change from 2% to 4%,6%,8% and 10% with each click.

https://streamable.com/t0k82d

The problem is skill.description stays 'frozen'. I guess it loads at the start but 'prints' the current data to the string, and then doesn't evolve anymore. So if I add points to this skill, the description doesn't change as I would like it to.
I guess one of the solution would be to hard code every description in my mouse_over function but I find this way too heavy, and if there is a clever way to do that I would gladly take it.

Thanks in advance :)



#8
Hi guys

I'm currently working on a minimap for my RPG game. It was much easier than, I expected. Though, I'm having a display issue.

Basically, I created a gui, in it I put a button with the map picture as background image and another button on top, in the middle with an arrow skin (in 8 directions).
And it goes :

Code: ags
function room_RepExec()
{
 Btnfondminimap.X=64-(player.x/10);   ///map size in 10 times smaller than the original one
 Btnfondminimap.Y=40-(player.y/10);
 Btnarrowminimap.NormalGraphic=3220+player.Loop;  ///3220 is the arrow facing down, then the 7 others follow the standard directions
}

Everything is very promising. Still, I wanted my minimap to be round :s, like in Titan quest or WOW. And I don't know how to "crop" the map button so that it would be a round shape instead of a square one. I'm pretty sure that is not possible like this, but I thought maybe there was a clever way to limit the size of my button to a round 50px radius image.

Any ideas or shall I just go with a square standard minimap?^^

Thanks :)
#9
Hi guys
I am a bit concerned about something..
I ve been working for the past months on creating a rpg interface in ags. It s not so easy but so far it seems to work.
Thought, I use a lot of what I call a "scanning function" to look for information in my struct of arrays. As so:
(Disregard the syntax errors, I m writing on my phone so it s much more difficult"^^
Code: ags

//Declared as a struct arrays in a script
Item[0].name=hammer;
Item[0].sprite"40;
//...more item stats
Item[1].name=Sword;
Item[1].sprite=41;
//And so on for all the items

//And for instance
Function mouse_over(){
Inventoryitem*selected=inventoryitem.GetatscreenXY(mouse.x,mouse.y);
//Here is the important part:
for int(i=0;i<itemlimit;i++){ 
if (selected.name==item[i].name){
///Do things using the database, like display the stats, etc.
}
}
}

So if it's not clear,I used a previous suggestion from Khris and eeri0 and scan my database for infos. It s a great and easy way to program stuff, and it works perfectly with 10 items.
 Question is, when the system is built and I finally add all the items, Say 200,300,500?(Creating many different items is not the hardest part so there could be many^^) Will this still work as fast or could there be freezes for non gaming computers?
I Guess I m underestimating the performances of a computer, but I would prefer to be sure before I ve spent a year building my system.

Thanks :)


#10
Hi guys
So I m having trouble with my fonts AND french keyboard... :~(

Font first, I m using one of the fonts I found here,
https://www.adventuregamestudio.co.uk/site/ags/sci_fonts/
but since it is (I Guess) an english font it doesn t have all our weird letters that we love so much ^^(à,é,ê...).
So I read (many Times) that you Can modify the fonts but I did not fond the right software. There should be something easy like, you Can directly draw accents,or add extra letters but I did not find yet. Do you have suggestions?

Second thing is about the ASCII code or how to call a keyboard button. My #2 keyboard button is an AZERTY, so the visual sign is é. Problem is this sign Can t be called in ags with ekeycode. I found the ASCII alternative, but it seemed the system changed with 3.6.1 and now the number I found doesnt work anymore. Any ideas?

Thanks🙂
#11
Hi guys

I'm newb in using textboxes, but it seemed quite intuitive and very handy. Though it seems there is something I didn't get, or maybe I just coded wrong something else. Anyway it got me so crazy for the last couple of days that I decided to ask for help.

The textbox is basically a list of spells that you can buy. To be able to know which spell to display (the data is in a struct array), I use the textbox index. But since this index changes when you remove an item of the list, I used an extra variable in my spell Array named sorts.index. This variable goes up when you buy a spell above it in the list. This way, using i+sorts.index it always show the right icon.

This is the code (it was much more complete initially but I reduced it to the basics) :

Code: ags
function btntrainwar_OnClick(GUIControl *control, MouseButton button)
{
 int i=Sortswar.SelectedIndex;  //sortswar is the textbox name

   for(int j=i;j<6;j++){////6 max spells
   sorts[j].index+=1;
   }
Sortswar.RemoveItem(i);

 }

and
 
Code: ags
if(Sortswar.SelectedIndex==i){Icontrainer.NormalGraphic=sorts[i+sorts[i].index].icone30;//to display the right icon(and price etc)

I knew it was not going to be clear with words so I made a little video.

https://streamable.com/ylkoa3

As you can see in the video. It works perfectly most of the time. When you buy a spell, the spells below get indexed+1 while their textbox index goes down automatically. The sum stays the same and so the display is good.
But there is one specific combination, the one I recorded than ends up not working well. On the last spell purchase of the video (the 4th one) the index of the spell bellow don't increase and it ends with a display bug.

I really don't get why this would do this, the code seems easy and logical. Do you have any ideas???

Thanks a lot
#12
Hi guys
I'm working on a rpg game, diablo-like, if you want to consider the amount of functions and GUIs involved :)

I'm still working on my basic functions : interface,combat,loot etc. and I'm not halfway through what I hope to achieve. But I'm starting to worry a bit since for a little while now, I have small freezes every now and then. It lasts between 1 and 3 seconds and happens every now and then. It doesn't seem to be related to any particular action since it sometimes happens just when I'm walking around alone(though it seems more frequent when I'm fighting ennemies).
I'm working with 30 characters on the map, and the map is quite large (~7000*5000, actually almost as big as the game allows because I reduced it after having an error message like "memory out" or something), but even when I reduce the size I still have the freezes.
Of course there's a lot of functions running all the time, but I guess for PCs as powerfull as we have nowadays it should be a piece of cake and irrelevant compared to what new games require.

So maybe I missed something, either in my scripting architecture, or game settings? Or maybe (and I hope not) the game engine is not designed for this kind of game and I'm running into a wall here ...-_-

If you have any elements I would really appreciate here since I've worked a lot already on it and if it's bound to fail, I might as well know it now :undecided:

Thanks a lot  :wink:
#13
Hi guys, some more RPG issues here :) This is more of a logical/structural question than coding I guess.

I've been struggling dor the past two weeks with a good looting system, meaning something flexible and not to greedy in ressource (I don't want to create 300 Invitems).
So basically this was my idea (I'll try not make it simple but can be more accurate if needed):

30 inventoryitems with no sprites or anyhting else, kind of the matter that would embody the different items (in the example lets say it correponds to 5 max equipped item+15 max items in the bag+5 max loot items+5 extras)

1 struct of arrays
Code: ags
Struct loot{
int sprite;
String Nameitem;
int bonus;
...
}
describing the icon,name etc of all the items. This one on the other hand could be big since I guess it doesn't take too much memory, say 200 different items (this is ambitious "^^).
so we have for instance :
loot[1].sprite=1;              loot[2].sprite=2;
loot[1].Nameitem=Blade;        loot[2].Nameitem=Shield;
loot[1].bonus=5;               loot[2].bonus=3;
....

So far I guess it's quite clear. Now this is where it becomes confused, and not so good :
Ennemies are defined with the same method
Code: ags
  ennemis[k].HP=200;
//...
and I added these lines
Code: ags
    ennemis[k].loot1=0;
  ennemis[k].loot2=0;
  ennemis[k].loot3=0;
  ennemis[k].loot4=0;
  ennemis[k].loot5=0;
  ennemis[k].baseloot=0;

Then,at map load, I attribute the loot to the different mobs with a function randomingly giving them the items with given probabilities.
Code: ags
attribuloot(k, 40,60, 100, 20, 20); //-->so 40% to have item1, 60% to have item 2...

So when the map is loaded, each munster has something like this :
ennemi[0].loot1=0;          ennemi[1].loot1=0;    ... 
ennemi[0].loot2=1;          ennemi[1].loot1=0;
ennemi[0].loot3=0;          ennemi[1].loot1=1;    ...
ennemi[0].loot4=0;          ennemi[1].loot1=1;
ennemi[0].loot5=1;          ennemi[1].loot1=0;

Anf finally when I loot the monster another function gives the image and attributes to the invitem based on the loot struct:(this becomes really messy :s)

Code: ags
  function Loot_attribution(Character*corps, int l){
    //l number of first loot item
//inventaireused is a global int to keep track of the number of inventory items I've used.
    nmobjets=ennemis[corps.ID].loot1+ennemis[corps.ID].loot2+ennemis[corps.ID].loot3+ennemis[corps.ID].loot4+ennemis[corps.ID].loot5;//how many more inv items are we using
   if(ennemis[corps.ID].loot1==1){
  corps.AddInventory(inventory[inventaireused]);//adds the next unused item inventory to the mob
   inventaireused++;
   inventory[inventaireused].Graphic=butin[l].sprite;    //gives the attributes
   inventory[inventaireused].CursorGraphic=butin[l].sprite;
   Lblloot1.Text= String.Format("%s",butin[l].Nomobjet);    //this label is next to the item to display its name
   Lblloot1.TextColor=butin[l].couleur;
   Lblloot1.Visible=true;
   }
      if(ennemis[corps.ID].loot2==1){
        corps.AddInventory(inventory[inventaireused]);
   inventaireused++;
//and same fo the 4 other items

In clear, each type of monster could carry a maximum of 5 items, and for each monster all 5 items must be defined each time, this is what the 'l' variable is here for-->monster type1 can loot loot[0],loot[1],loot[2],loot[3],loot[4] (l==0).monster2 can loot loot[5]...loot[9](l==5) etc. This is particularly bad because if i want monster1 to be able to carry loot[6] I must define this item twice, more if I want this item to be carried by more monsters. It seems like a huge waste of space...

Besides the whole thing is actually extremely heavy to manipulate and I start to get lost when I want to add items descriptions or some kind of icon overlay when the mouse is over it. When I started to make the items pickable this became nuts and I realized there might be some easier way to do this. problem is that now my mind is stuck on this idea and I can't find anything else X3

Would some of you have some suggestions I could use? I can give more details if needed but I feel like I've already given too many and lost most of you "^^

Thanks

#14
Hey guys

I would like to create a targeting function, like when I left click on the character (on any map) he gets selected (and thus appropriate lifebars etc. can appear). Sounds easy, yet I can't find the right way.

I came up with something like that ('Target' is a Character GlobalVar to identify the right character), it sounded promising.
Code: ags
function on_mouse_click(MouseButton button)
{

    if(button==eMouseLeft){
      
            if (GetLocationType(mouse.x, mouse.y) == eLocationCharacter)
      {
        Room.ProcessClick(mouse.x,mouse.y, eModeLookat);//----------and in character1.lookAt it goes "Target=Character1"
       LblEnnemyname.Text=String.Format("%s", ennemis[Target.ID-3].Nameennemy);//---so the lifebar displays the right name of the target contained in the struct 'ennemis'

      }
//...

but this does'nt work, for some reason the function seems to skip the 'room.process' which creates the Target variable, and goes straight to the next lines (which creates a problem because the target is'nt identified)

Any ideas? I can be more specific if needed.
Thanks a lot :)

EDIT : Writing it gave me the answer, I just needed to put the function in the lookat section rather than in the global script, this way it doesn't skip the interaction and it works fine now :)
#15
Hey guys!

Like so many before me, I want to push my ags creations a bit further and I am thinking of adding some diablo2-like hack and slash actions in it(why teleport from one place to the other when you can walk killing monsters😅?)

I ve read many things about rpg games but this question still isn t clear so far: how to organize things so that switching equipment can be visible? Meaning that if you equip an axe instead of a sword this shows on screen?

Creating views for every combination is out of the question since that makes the possibilities exponential.

 I found on the rpg topic something about singling out every limb (head,arms etc.) By using different characters using follow(0) the body. I haven t tried it yet since I don t have ags with me at the moment but it seems a bit weird.

Since the conversation was outdated I m mainly looking for an update on this, do you think this is the best option? Any ideas what else could be done?

One last thing, say this is the way, how would you arrange priority for limbs(the arm gets in front of the head...? Maybe there is no priority,just "holes" in the sprites?

Thanks a lot and sorry I ve been a bit long😅
#16
Hey guys
I'm facing problems with my intro and ending cinematic. Both of them are pretty heavy since I used good video quality (made with adobe suite).

The first one was around 150Mb in mpeg, then converted to 45Mb in OGV (using Xmediarecode)
Second one 720Mb converted to 120 Mb

Problem is, even with the ogv compression it still seems to be to much for the engine to display it properly. It actually works fine on my computer (which is a recent one) but on an older one it freezes and slows down a lot. Which is a problem because my 320*200 game is supposed to be working on any lousy computer.

Any hints? I tried to use ffmpeg2theora but it doesn't seem to work anymore(unless I didn't understand how it's supposed to work). Are there CODECS that need to be installed that I don't know about ?Any other idea?
Or do I have to reduce the quality of the video ? In which case, what would be an acceptable size for the video to play without problems ?

Thanks in advance for your help, my deadline is friday night and I'm a bit worried about this cinematic ruining the whole first impression :s
#17
Hey guys

I'm having trouble with the RPG phase of my game. Basically you can shoot the monsters using the mouse, left click is immediate shooting, right click is a long channelled shot.
And this is where I have difficulties...

So my system is probably veeeery unclean but so far it worked, here goes the system.

Code: ags
function on_mouse_click(MouseButton button)
{ 

     if (button == eMouseLeft)
{
    Room.ProcessClick(mouse.x,mouse.y, eModePickup);
  player.LockView(110);
  player.Animate(7, 1, eOnce, eBlock);        ///////////shooting animation
 player.UnlockView();   
}
else if(button==eMouseRight){
      Room.ProcessClick(mouse.x,mouse.y, eModePickup);
      oCast.Visible=true;
      oCast.SetView(117);
      oCast.Animate(1, 1, eOnce, eNoBlock);     ///////////////a castbar animation that fills itself (wow style)
    player.LockView(15);
  player.Animate(12, 20, eOnce, eNoBlock); //////////////the charged shooting animation    
}  
}


Then on the monster, I put an "anyclick" function :

Code: ags
function oMonster_AnyClick()             
{
if(mouse.IsButtonDown(eMouseLeft)){
  shoot(damageplayer, armorMonster);            ////////////goes to a shooting function that calculates the damage dealt according to armor...named "finaldamage"
 Monsterdamagedisplay(IntToFloat(finaldamage));          ///////////display function of the damage
 
}
else if(mouse.IsButtonDown(eMouseRight)){    ///////////pretty much the same but damage is 3* higher   [RIGHTCLICKLINE]
  shoot(3.0*damageplayer, armorMonster);
 Monsterdamagedisplay(IntToFloat(finaldamage));
}
 
}


That is all is needed I guess. I added a bunch of repetedly execute conditions to remove the castbar and unlock the player's view when he's done channeling. That's no problem and I don't think it's necessary to add the codes here.

So the problem is : How to add the condition to wait for the channel bar to be full before applying the damage?

I thought of adding a bool when the channel bar is full and added the condition (&&bool==true)in [RIGHTCLICKLINE], that would turn off when right clicking, but it does'nt work as planned. It applies the damage before waiting for the bar to be filled.

I don't know if all of this is very clear so I'm not going to add too many details. Maybe one of you already used this system and can help out ? I'm running out of ideas here.

Thanks a lot :)
#18
Hey guys
I'm facing 2 small issues about dialogs, does'nt seem so hard, maybe someone could help me :)

1) For one cutscene, I'm using a fade out. Then I want something to be said during the black screen, and then it comes back to normal with fade in. Problem is, when it's faded out, dialogs don't show. Any trick to handle this?
->I want to avoid moving the character to a blank room because I have a lot of roomloads/room first loads etc. that could create potential bigger issues since I didn't have this in mind when I created them. If it's possible I would reaaly prefer to stick to the room I'm in,"turn the lights out" with a fade, say the line(with audio speech) and then turn the light back on.

2)I'm playing 2 characters with an icon to switch from one another (DOTT style). Sometimes, they still talk to each other(even though they never are in the same room). But the lines of the charcater that is not being played (he's on a different map) appear above his current position on the map, which is pretty random. I would like to have the lines of the "absent" character always being displayed on top of the screen, and centered. Again, it's a detail but would add some accuracy to my game.

Thanks a lot again :)
#19
Hey guys.
Do you know if there is a way to wait for an animation to end without blocking the game?
For instance:
Code: ags

Player.LockView(2);
Player.Animate(1,5,eOnce,eNoBlock);
"Someway to wait for it to end"
Player.UnlockView();


It's been bugging me for a while now and I kept avoiding the problem but there is maybe an easier way:)

Thanks in advance
#20
Hey Guys!
I ll try to make this simple...

I have 10 different buttons and I want to create a single function that could change their sprite NormalGraphic, with a variable.
My buttons are called button1,button2...button10

Is there a way to select those buttons with just one line of code, instead of detailing all the possibilities.

So instead of :
Code: ags

{
var=Random(9);
if(var==1){button1.NormalGraphic++;}
else if(var==2){button2.NormalGraphic++;}
...
else if(var==9){button9.NormalGraphic++;}
else {button10.NormalGraphic++;}
}



I m looking for the correct spelling (if one) to do something like this :

Code: ags

{
var=Random(9);
button[var].NormalGraphic++;
}



In other words, how to apply an int number to a button number ?
Do you see what I mean? And is that possible ? I guess so because it would be so heavy otherwise

Thanks a lot :)
SMF spam blocked by CleanTalk