Need help for generator

F

Fog

Guest
Greetings games maker friends!


I have a project a bit special and I am totally new to GameMaker (and in coding in general ...) so I have some questions about the realization of what I want to do.

But first things first, what is my project?

To make it short, I need, for a board game that I create, to develop random generators. Whether for weapons, for loots, for NPCs, for Maps, etc. And I would like some of them to interact with each other. (A map generator that also places loot in the rooms, the NPC generator that randomly equips the character, etc.)


So here are the big lines. You can already see that I do not look for something simple ... Especially for someone who starts developing ...

With tutorials, I have already done some tests on Gamemaker using the ds_list, the random, etc. It works well for something simple, but I'd like to do something much more complicated.

So, my questions are:
(Remember that I am a beginner, so if some of my questions seem stupid, sorry in advance ^^.)

Is it possible to create generators that would take informations (Example: weapon name, weapon damage, weapon status, rarity of the weapon, weapon cost, etc.) from a table that I would have done, for example on Excel? If yes, how ? Because I'm going to make changes (damage, rarities, etc.) on all the table quite often, so I'd like GameMaker to handle these changes dynamically.

How can I get GameMaker to take pictures from an external folder? (For the same reasons as the question above)

What is the best approach for you to make a map generator? (Knowing that it will be mostly building plans) I looked on the net and I found procedural level generators, but with a lot of constraints related to video games, in my case I “just” want buildings plans or things like that. Without having to manage collisions or other video game related problems.

What should I use to create search filters on my generators? For example, for the map generator I would like to be able to say to him "I want a small police station of around 5-6 rooms, which has few money so poorly equipped" so that it randomly generates me the plan of a small police station, with 💩💩💩💩ty loot, but taking into account that it has at least a toilet, an armory, a reception, etc. (I imagine that the filters will be much more precise and complicated than that, but is to give you an idea of what I am trying to do.)

And I'm going to stop there for the moment, because I think it will already be a big fish to handle! I would go into more detailed if needed.

But to put it simply, I have tons of images and tables of objects / NPCs, etc., and I would like to create generators that take what he need in these folders / files and use them as a basis to generate randomly what I will ask him.

Thank you in advance to all those who will help me on this big piece! ^^.


PS : I’m not native English speaker, so sorry in advance for my poor English ^^.
 

andev

Member
Is it possible to create generators that would take informations from a table that I would have done, for example on Excel? I'm going to make changes (damage, rarities, etc.) on all the table quite often, so I'd like GameMaker to handle these changes dynamically.
If you want the same information from your spreadsheet in your game, your best option is probably to transfer it manually into code and tweak it as necessary from in there. But that is not your only option.

You could find some kind of converter online that converts a spreadsheet file into a txt, which can then be read and parsed by your own code. Or you could look up how spreadsheet files are stored at byte level, and import the file as a buffer to parse it. Both of these options would take far longer than just manually copying it, and would also stand the risk of being modified by curious players that venture into your game folder (unless you do hashing checks or whatever, and by this point it's getting convoluted).

If yes, how ?
I would set up macros.
Wep_Name -> 0
Wep_Damage -> 1
Wep_Status -> 2
Wep_Rarity -> 3
Wep_Cost -> 4

So you can initialise weapon data like this:
Code:
///Weapon_Create(Name,Damage,Status,Rarity,Cost);
/*
Returns an array of weapon data
*/
//Backwards because it's faster to start with the last array entry.
var Array;
Array[Wep_Cost] = argument4;
Array[Wep_Rarity] = argument3;
Array[Wep_Status] = argument2;
Array[Wep_Damage] = argument1;
Array[Wep_Name] = argument0;

return Array;
Then it's as easy as:
Code:
var i = 0;
var Weapons;
Weapons[i++] = Weapon_Create("Rifle",100,4,10,250);
Weapons[i++] = Weapon_Create(Name,Damage,Status,Rarity,Cost);
Weapons[i++] = Weapon_Create(Name,Damage,Status,Rarity,Cost);
//etc
You could go a step further and split your macros into two categories, because you don't need to store all of that information with every iteration of the item. Things like "Weapon name" and "Rarity" aren't going to change on a per gun basis, so they can be stored once.

How can I get GameMaker to take pictures from an external folder
If you only want this for the purpose of updating images outside of game maker, you can just replace the images in the gmx folder so long as they have the same name. It would just be so much easier to use the game maker image importer though.

What is the best approach for you to make a map generator ... Without having to manage collisions or other video game related problems.
I don't understand what you're asking here! You're making a video game - you're going to have video game related problems. If you don't want collision issues, you will need to write code that prevents it.

What should I use to create search filters on my generators? For example, for the map generator I would like to be able to say to him "I want a small police station of around 5-6 rooms, which has few money so poorly equipped" so that it randomly generates me the plan of a small police station, with ****ty loot, but taking into account that it has at least a toilet, an armory, a reception, etc. (I imagine that the filters will be much more precise and complicated than that, but is to give you an idea of what I am trying to do.)
Use "flags".

For your example, you could have a script like this:
Generate_Base( type, rooms, loot_quantity, rooms);

And inside it, you'd use a switch statement for "type"

Code:
//Do different things for different types of rooms
switch argument0
    {
    case "Police station":
        {
        //Create the required rooms for a police station
        Create_room (reception);
        Create_room (toilet);
        Create_room (armory);
      
        //Create extra rooms defined on launch
        repeat argument2-3
              {
              Create_room (spare);
              }
      
        //Spawn loot in the rooms
        spawn loot based on argument1
        } break;
  
    case "Other type of room":
        {
      
        } break;
    //etc
    }
 
F

Fog

Guest
Wow ! Thanks a lot !!

I don't get everything of what you are talking about yet (Still don't know all GameMaker/Code possibility) So i'll look at some tutorial about macro, flags etc. That's very cool of you to give me thoses infos ! (And i test your code when i finnaly get what that mean and how to format it to use it on my code !)

For the "Excel (or other) table parts", is there anyway to make Game Maker to "read" those tables to use them as a basis ? Even if i have to format them all in a way to make GameMaker able to read it. I know that some other soft like Unity can do that, so i wonder if gamemaker also can.


andev said:
If you only want this for the purpose of updating images outside of game maker, you can just replace the images in the gmx folder so long as they have the same name. It would just be so much easier to use the game maker image importer though.
[/code]
No, cauz i really gonna always add or delete more and more pictures. And for example, for the NPC's, i can have all the pictures organized in different folder like "old man" "old woman" "child" "dwarf" and so on. And i can have like 50 pictures in each folders. And i'll for sure keep adding/moving new pictures in all folders all the time. (originally I'm a graphic designer / game designer, so I'm going to play a lot with the graphic and game design side.) So I'd like GameMaker to handle these adds dynamically. Even if the code as to be harder, i prefer pass 6 months on a code part and make it work dynamically, than adding/removing every picture i change, in the code. (I'm no dev so for me that the hardest part i guess).

So, is there any way to do that, or it's not possible in GameMaker ?


andev said:
I don't understand what you're asking here! You're making a video game - you're going to have video game related problems. If you don't want collision issues, you will need to write code that prevents it.
[/code]
Nope, like i said, it's for a board game, not a video game. Indeed I want to make a "random generator software", but it's to use with a board game. so i don't need all the video game related problems. i "just" want the plan, with, if possible, the furnitures and the loot inside of it. (And it's already hard enought i guess :p). So i don't need all thoses video game related problems. Or is there something I forget which you think about?

Thanks again for your answer ! That's very cool to see a quick reaction to my post ! :)
 

andev

Member
For the "Excel (or other) table parts", is there anyway to make Game Maker to "read" those tables to use them as a basis ?
Yes, but you will have to write the code for it (unless you use one of these). If you're doing it yourself, here's an article on how csv files are stored. Then you will probably want either game maker's text file reading, or buffers.

No, cauz i really gonna always add or delete more and more pictures. And for example, for the NPC's, i can have all the pictures organized in different folder like "old man" "old woman" "child" "dwarf" and so on. And i can have like 50 pictures in each folders.
You can do this from within the game maker UI. It has folders if that's what you need. Aside from keeping all the file names the same, the only other thing I can think of would be directly modifying the game maker gmx file (which if you're not careful can break a project).

Nope, like i said, it's for a board game, not a video game.
Oh sorry! I assumed you meant you were porting the board game to the PC. But unfortunately this doesn't make the problem go away. If you want your software to generate a map, it will likely need to think about collisions still (unless we're talking about different meanings of collision). I assumed you meant collisions like preventing houses from overlapping each other for example. But maybe you meant collisions of the player with the environment.
 
F

Fog

Guest
Hi !

andev said:
Yes, but you will have to write the code for it (unless you use one of these). If you're doing it yourself, here's an article on how csv files are stored. Then you will probably want either game maker's text file reading, or buffers.
Yes ! Thanks for the link ! now i'll got to learn that ! Thanks you a lot !

andev"You can do this from within the game maker UI. It has folders if that's what you need. Aside from keeping all the file names the same said:
Oh sorry! I assumed you meant you were porting the board game to the PC. But unfortunately this doesn't make the problem go away. If you want your software to generate a map, it will likely need to think about collisions still (unless we're talking about different meanings of collision). I assumed you meant collisions like preventing houses from overlapping each other for example. But maybe you meant collisions of the player with the environment.
Yeah, I was talking about the collisions of the character for example. But yes, you're right, if i want to prevent room to overlap each other, or even place them in a certain way, i probably need collisions. Or is there any other way to achieve that ?

Thanks again for your help !
 

andev

Member
if i want to prevent room to overlap each other, or even place them in a certain way, i probably need collisions. Or is there any other way to achieve that ?
The code would be very simple though, if you needed help with that, a new topic on here would get answered very quickly I'm sure
 
F

Fog

Guest
The code would be very simple though, if you needed help with that, a new topic on here would get answered very quickly I'm sure
Ok thanks, i'll do that when i get to this point. That's for a side project i do on my free time, so it probably gonna take long time. (even more knowing that i need to learn coding)

Anyway, thanks for your answers, it help me a lot and now i know approximately where i go ^^.
 
Top