Menu

Show posts

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

Show posts Menu

Messages - lafouine88

#61
@eri0o Thanks for bitfontmaker, that's basically what I had in mind.
One small question though, do you know if there is a trick to import one of the sci-fonts(link in my first post)? I don't know what format it is but certainly not TTf and I only found this option to be able to import.
Ok for text input, I did'nt really understand it when I read the 3.6.1 improvements but if this is going to be the way I need to get into it. Hopefully I won't come back with more questions^^

@WHAM Thanks, I know this is certainly the easiest way but I could'nt yet find the perfect font (small enough and easily readable) so I thought I would just create one that adapts to my needs. I really hate fonts...^^

 
#62
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🙂
#63
Quote from: Khris on Tue 16/04/2024 17:14:29The problem becomes obvious if you look at this part:
Code: ags
  sorts[i+sorts[i].index].icone30
Now you mention it, yes it does^^

Thanks a lot for your help guys  :wink:
#64
Quote from: Khris on Tue 16/04/2024 12:15:08The curious thing here isn't that it breaks in the end, it's rather that it appears to work in the beginning :-D
You start to think you understand coding and then this happens...XD

Thanks for the reply khris. I think I understand now what goes wrong, through I still don t get why :confused:
Thé way I see it,the sorts[].index is independant of the textbox. The function changes the amounts once(it s single action,not repeatedly), and once it is donne, it removes the selected item. This makes the textbox array move up,sure, but why would it change again the sorts[].index value?

I will go for the changes you suggested and I m sure it s gonna work, but for future use I would like to understand.

@eri0o . I use an invisible characters for the inventory, and After Reading some posts here I thought I would do it again for crafting and training, but for some reason I forgot and went for a textbox, it seemed adapted, maybe it s not that much "^^
#65
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
#66
Hi guys
It seems I found something. The problem was too many characters were doing the idle/patrolling function :

Code: ags
  for (int i = 0; i < 30; i++) ///30 character ennemies
  {
    if (Region.GetAtRoomXY(character[i].x, character[i].y - ennemis[i].base) == Region.GetAtRoomXY(player.x, player.y - blancplayer)) ////to not waste memory on distant ennemies
    {
      Patrol(i);
      Agro(i);
//...

i reduced a bit my regions but more important the amount of ennemies on it to around 10,and set them all to note solide(which I forgot to do on some of them) and it is now very fluid.
I Guess I underestimated the accumulation of fonctions and should not be too greedy with the memory in the future. I will try to keep it to the minimum.
Thanks again to everybody:)
#67
Quote from: eri0o on Mon 01/04/2024 22:07:37If you want to share the sources I could read and maybe try to suggest something

Hi. I tried to reduce the script to the module that seems to be problematic. I marked it so it is easier for you to understand but don't struggle too much on it. Just by looking at the structure of your games I can tell that I'm far from being clean on my architecture and I guess it's going to be a hell to understand :/

Thanks again for all your help and thanks for sharing your games, it's really very helpful oO

Here is the wetransfer link (just a notepad from the selected module) :

https://we.tl/t-S1AI22B5hu
#68
Quote from: eri0o on Mon 01/04/2024 13:41:44I've done a few non-adventure stuff in AGS and the challenge is always in organizing your code and naming things. Most my stuff is open source of you want to check it out.
You're god damn right... XD my thing starts to be a huge mess. Though it's much better than my previous games, so there is always margin for improvement^^

One thing is sure, I do use a lot of rep_exe, but way less than  1000.
So far I have things like buff/debuff/dot display, character's stats,a few display things(aggro),information about items you pick up/stats/spells when mouse gets over the button,a following character to display visual effects,targeting and damage display system,patroling,agro,autoattack,death and repop functions and animations unlocking(which I should remove soon because it's not really a good idea after all). I could give you the whole script but it would be a nightmare to read XD.
At some point I did create modules, just to free some space in my global script which became hard to manage. But I don't know how to use update/update_always. this is something else I should take a look at then^^I thought I would just turn them all my rep_exe functions down and bring them back one after the other until it starts lagging. It pretty much defines the way I'm making my games, not at all the best or the fastest,but eventually it should work "^^

QuoteI've done a few non-adventure stuff in AGS and the challenge is always in organizing your code and naming things. Most my stuff is open source of you want to check it out

Definitely yes!! This should be extremely interesting <3 Could you give me a link or something like that please?

Once again thanks to all for the investment, it's always surprisingly constructive and...patient "^^
#69
Quote from: eri0o on Sun 31/03/2024 22:32:21One thing, in AGS 3.6.1 there is an additional Debug Log panel in AGS Editor and you can log things to it by using the System.Log() functionality! I think it should be useful for your testing of your game.

I have dl 3.6.1 thanks for thé tips and I will have to look into this log functionnality. it looked a little complicated but it s going to be the easiest way because my aggro function is not the one After all😑,it s something in repeatedly execute I Guess.

One small technical question about repeatedly execute (since I have the creators here), if I go sthing like this:
Code: ags
Repeatedly execute{

If(globalint1<10){
gui1.x=0;
}
else{
gui1.x=10;
}
}
:
Does that kind of code take unnecessary ressources? Like, Does it continuously set the gui1.x? Or does it do it once and then gets triggered again once globalint1 gets to 10?
Because I sure did a lot of this,and this could be the kind of suboptimal coding crimson spoke about. In which case this would be preferable :
Code: ags
Repeatedly execute{

If(globalint1>=10&&gui.x==0){
gui1.x=10;
}
If(globalint1<10&&gui.x==10){
gui1.x=0;
}
}
:


Thanks👍
#70
Quote from: eri0o on Sun 31/03/2024 10:38:38Just so you know if you really think that pathfinding is the problem it should be easy, create a new empty game, add 30 characters and put them all to walk and see if you can reproduce your issue. Don't use your game assets, just throw 30 Rogers walking around.

If you can please post this test game here.

I tried that and the good news is that neither pathfinding nor 30 characters on the map are any problem at all "^^ they follow me perfectly if I just use 'follow character' on room load.
So I'll keep investigating with my own aggro function paying attention to possible forgotten loops.
#71
Here goes

https://streamable.com/991ic1

I made you a quick video(low quality but you ll get the main issues). Of course don't pay attention to interface and basically graphics etc. since this is not done yet.

There is a freeze at the end, but also you can see that mobs behave weirdly, they kind of run as erraticly as I do^^ and sometimes they glitch a little when they are close to me. I thoughts I would deal with this later but maybe the whole thing is connected. I'll have a closer look at my whole function tonight but if watching the video gives you ideas of what the problem might be, be my guest :)

I'll also try the debugging program of eriOo, though I did put a variable to prevent repeatedly execute follow. Still I'll cross check.

CaptainD, as you can see I can't use move, I do use Noblock. I would also prefer the mobs to use walkable ares to prevent them from crossing a river or getting through a house, that would make them quite harder to deal with^^

eriOo, I thought about this too and initially my characters were all solid. They are not anymore, and pathfinding is better, but as you can see, still not great.

See you soon
#72
Quote from: Crimson Wizard on Sun 31/03/2024 11:59:31I cannot tell if this will help your game, but there have been a number of performance optimizations done between 3.5.1 and 3.6.1. 3.6.1 in particular showed the script performance improvement up to 40% in some games.

This is the first thing I did...I don't know why I stuck to the older version,nostalgy has its limits^^ thought you speak of 3.6.1 but on the site it says it's still in development so I guess 3.6.0 should already be a good start.
For the rest, it's goign to take some time. I've tried reducing the size of the map and number of characters but it doesn't change. I've isolated the problem to my "aggro" function that makes the ennemy-characters follow the player when he gets closer and it definitely seems to be the one faulty. Maybe the follow function is too hard to manage with multiple characters(I read in the 3.6.0 log that there used to be a limit to 30 characters following).
I'll keep you advised.

Thanks again <3
#73
Hi guys and first, thanks for the very quick and accurate reply.

So :
-I'm still running AGS 3.5.0, I never changed this version but maybe I should?
-Resolution is 640*400
-As for the map size, I was planning on dividing it into smaller maps and use edges to switch to the next one without pause and give the openworld impression (using mandatory passage points like bridges), but I haven't got into that point yet and am REAALLLY intrigued by the tile system you used eriOo and crimson spekas about. I'll look for that on the forum, might be easier. But I'm not sure this is the issue because I tried lowering to something like 2000*2000 and I still have freezes.
-To me, pathfinding could be the problem, first because, for test purposes (still working on the mechanics, I don't have the final map yet) I painted the whole thing in walkable area, so maybe a 7000*5000 walkable area is not the best "^^plus my characters seem to struggle quite often to walk to my player.character when they're chasing him(making a lot of detours^^). So I definitely believe this is part of the problem.
-Repeatedly execute might be suboptimal since it's certain I used some heavy functions when I could have done simpler, but this basically sums up to running a lot of numbers at the same time, I think there is no loophole or bad interrogations (I guess"^^) or the game would always freeze for the same reasons, which doesn't seem to be the case. I'll use the debug mode to try and see something, thanks for the tip:)
-About characters and items, I do make them asleep and teleport to areas around so that you have the impression there s a lot of them when there is actually "only" 30 (but I felt like if I wanted a good continuity and make the player able to pull multiple mobs at the same time this number would be the minimum. Same goes for invitems that 'transform' into the picked up item and release their properties when destroyed. If I do this correclty, I guess 30 characters (say 10 idle or active) and 20 asleep in the buffer zones and 80 invitems is not too much,right ? (Of course...if I do this correctly, this is the main issue -_-)

I definitely have a lot of things to try and work on so thanks a lot to you. I'll give you feedback when I've change a few things
#74
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:
#75
YEEEEES that's what I was looking for. It's perfect!! Thanks a million for everything Khris <3<3<3
#76
Quote from: Khris on Sun 03/03/2024 21:39:07I'm not sure how you're getting from the info stored in
Code: ags
Struct loot{
int sprite;
String Nameitem;
int bonus;
...
}
to an actual AGS inventory item though.

Actually I mixed my code and the translation I did on the forum to make things more understandable for english speakers. This was a bad idea.
 so butin and loot are the same struct. So the materialisation into an invitem is quite easy using lines like :

Code: ags
inventory[inventaireused+1].Graphic=loot[i].sprite
inventory[inventaireused+1].SetProperty("Name",loot[i].Nameitem);
inventory[inventaireused+1].SetProperty("Strenght",loot[i].Strenght);
inventory[inventaireused+1].SetProperty("Agi",loot[i].Agi);
//etc.
And then I can use the property variables to affect my character's stats, this seems to work alright.

On the first part of your message I really feel like I'm doing exactly what you are saying :s I do use the .count int. and it seems to me that on our previous posts we say the same thing  ???
 So one last thing before I stop annoying you(I already posted this message but it seems that it got deleted) :

If I go :
Code: ags
enemy_item[EiLookup(2, 1)].count++;
does it entail that :
Code: ags
Materialize_loot(2); 
//-- with

  function Materialize_loot(int enemyId) {
  for (int i = 0; i < enemy_items; i++) {
    if (enemy_item[i].enemyId == enemyId && enemy_item[i].count > 0) {
      //this here will be true for i==1
      //to give values it means that : enemy_item[1].enemyId==2 && enemy_item[1].count>0
    }

Thanks again for your patience, I really feel like I understand what I'm supposed to do with your function but I miss something somewhere :/
#77
Quote from: Khris on Sun 03/03/2024 16:49:15Your Materialize_loot function doesn't use my code at all it seems. It also doesn't use your loot array.
It doesn't in this function but it does at one point,and there is no problem with this part of the structure. at room load, it allocates each mob with its item using enemy_item[Eilookup(k, 1)].count = 1; // for each ennemy using the k counter
and then the materialize function uses the information to create the invitem caracs.
Code: ags
inventory[inventaireused+1].Graphic=butin[i].sprite; 
And i didn't write it all here but it also copies the properties etc. so there is no problem with this part.

The problem is, when I use
enemy_item[Eilookup(k, 1)].count = 1;
it doesn't seem toi give them the #1 item for each, but #1 for the first ennemy to be set(ennemy[0]) and then item#2 for the second ennemy and so on :confused: so I guess there is a misuse in the first part of my materialize function :

Code: ags
  for (int i = 0; i < enemy_items; i++) {
    if (enemy_item[i].enemyId == enemyId && enemy_item[i].count > 0) {
      character[enemyId].AddInventory(inventory[inventaireused+1]);   //gets the next free invitem
      inventory[inventaireused+1].Graphic=butin[i].sprite;  //--->because here 'i' is supposed to be 1 all the time to correspond the enemy_item[Eilookup(k, [b]1[u][/u][/b])].count = 1; , but instead it keeps getting higher 

You see what I mean? the 'materialize_item' function does translate as instructed and uses my butin[] settings as planned. But what I don't understand is why it doesn't create the right item.
#78
@Khris Hello again, I spent the last days struggling with this system. It seems really promising but I still don't get it completely and it makes it more complicated to adapt it to what I want to do. I did what you suggested and this is what happens :

-at room start, when I configure my ennemies it goes like this :
Code: ags
function room_Load()
{
  //-wolf-------------------
  int k=0;
  while(k<10){///---first 10 characters are wolves
  ennemis[k].HP=20;
  ennemis[k].damage=2;
  ennemis[k].skin=17;
//....the rest of the attributes for this kind of mob
//so thats where I write this : meaning each wolf has item number 1.
  enemy_item[EiLookup(k, 1)].count++;
}

and then when you loot the ennemy, based on your second post I created this function to materialize the loot, meaning it creates the invitem from the characs I specified for each item:

Code: ags
  function Materialize_loot(int enemyId) {
    nmobjets=0;///---this is the number of items the ennemy carries, just another variable to adapt the size of the ennemy inventory, not relevant here
  for (int i = 0; i < enemy_items; i++) {
    if (enemy_item[i].enemyId == enemyId && enemy_item[i].count > 0) {
      character[enemyId].AddInventory(inventory[inventaireused+1]);   //gets the next free invitem
      inventory[inventaireused+1].Graphic=butin[i].sprite;            //takes the sprite from the struct butin,which carries all the characs
         inventory[inventaireused+1].CursorGraphic=butin[i].sprite;
         inventory[inventaireused+1].SetProperty("numero",i);         //I used this for the pickup action which goes later, to be able to remove the right item once it's picked up
         //player.Say("%d",i);                                           //debugging device I ll explain later
      
    }
    nmobjets++;///if there were more items to give, this counter goes up(to enlarge the size of the inventory)
    inventaireused++;///and this is the counter to know how many invitems I've used so far
  }
}

But the problem is (I found out using my "device : player.say) if I understand your code,"i" should be equal to 1 for each ennemy, because it corresponds to the number of the item I gave at room start. But instead it keeps going, meaning ennemy[0] has item no1 as asked, but ennemy[1]has item no2(and the player says i=2 instead of one) and so on until ennemy[9] who carries item n°10 and i=10...
so I must have missed a point in your code and don't use it correctly, or this is normal I just didn't configure my loot attribution right.

Something else is weird, when I use my function 'materialize_loot', it doesn't just attribute the invitems to the specific target, but to all the ennemies. Which is not what I understood from your explanations and creates chaos in the invitem management(when I loot one mob, it creates 10 invitems, if i kill another one it creates 9 more etc. when I would like it to create just one invitem for the target I'm currently looting)

Could you give me a hand here please? I'm reaching my coding limit here and I'm out of ideas :/ I can be more specifi if needed, obviously

Thanks again
#79
OK! I wanted to give it a try and figure out on tests how it works, and what I can do with it. Problem is it tells me "i is already defined" and since I don't really get the whole function I can't correct it myself... :cry: sorry again"^^
#80
Wow... thanks Khris...This seems good...but to be honest I don't understand it all "^^Sorry I'm not used to reading someone else's code and I realize I also don't have all the tools to understand this.

So line by line, could you tell me if I got things wrong?
Code: ags
// header
#define MAX_ENEMY_ITEMS 1000  //easier to change the settings without hunting for pieces of code-->clever^^

struct str_enemy_item {
  int enemyId;          //self explanatory 
  int itemId;           //self explanatory 
  int count;            //number of items in the ennemy's inventory?
}

// main
str_enemy_item enemy_item[MAX_ENEMY_ITEMS];    //1000 of the struct above
int enemy_items;                               //tricky cause the name is similar but is the number of inventoryitems slots already used

int EiLookup(int enemyId, int itemId) {
  int i;                                        //this i is the one I don't really get...
  for (int i = 0; i < enemy_items; i++) {
    if (enemy_item[i].enemyId == enemyId && enemy_item[i].itemId == itemId) return i;  //and this line here is too tricky for me. I guess the idea is to check what is the next available slot on the list.
  }
  if (i == MAX_ENEMY_ITEMS) {
    Display("MAX_ENEMY_ITEMS limit reached");
    return -1; // this will cause an out of array bounds error---->ok
  }
  // i is now the first free list entry
  // list entry doesn't exist yet so create it
  enemy_item[i].enemyId = enemyId;
  enemy_item[i].itemId = itemId;
  enemy_items++;
  return i;
}
So the idea is to create a list that would be something like:
Code: ags
  enemy_item[0].enemyId == 0;
  enemy_item[0].itemId == 3;//-->invitem[0] takes the form of item[3] and is put in inventory of character[0]?
enemy_item[0].count==//? then I don't get this line :s
  enemy_item[1].enemyId = 3;
  enemy_item[1].itemId = 5;//-->invitem[1] takes the form of item[5] and is put in inventory of character[3]?
//...

Or did I get lost on the way?^^
Thanks again, and sorry for being slow to understand
SMF spam blocked by CleanTalk