Topic:   Roguesoft RPG Engine?   (Read 94813 times)


0 Members and 2 Guests are viewing this topic.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Roguesoft RPG Engine?
« Reply #15 on: December 05, 2009, 09:49:39 AM »
I'd think the when you enered the map it would mark each open tile in a variable. Then when it sets to spawn, just pick a random number of how many open tiles are on that variable. That'd do it.


-Gandolf
« Last Edit: December 05, 2009, 12:31:56 PM by Gandolf »

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Roguesoft RPG Engine?
« Reply #16 on: December 05, 2009, 12:09:14 PM »
how complex can enemy spawning get? i can only think of random placement with no delay? but you already did that

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Roguesoft RPG Engine?
« Reply #17 on: December 05, 2009, 01:19:05 PM »
Quote
I'd think the when you enered the map it would mark each open tile in a variable. Then when it sets to spawn, just pick a random number of how many open tiles are on that variable. That'd do it.


-Gandolf
Exactly! :D And here's how I did it in ToF:

Code: [Select]
    IF NPCalive = 0 THEN
 Â     NPCspawnchance = RANDOM 10
 Â     IF NPCspawnchance = 1 THEN

 Â       tilecheckXY = 0
 Â       freetiles$ = ""
 Â       freetiles = 0
 Â       REPEAT
 Â         tilecheckXY = tilecheckXY + 1
 Â         freetilecheck$ = MID$ gridlayout$ tilecheckXY 1
 Â         IF freetilecheck$ = "0" THEN
 Â           tilecheckXY$ = STR$ tilecheckXY
 Â           freetiles$ = freetiles$ + tilecheckXY$
 Â           freetiles$ = freetiles$ + ""
 Â           freetiles = freetiles + 1
 Â         END IF
 Â         IF tilecheckXY = 49 THEN EXIT REPEAT
 Â       END REPEAT
 Â       NPCspawnlocation = RANDOM freetiles
 Â       NPCspawnlocation = NPCspawnlocation + 1
 Â       NPCspawntile$ = WORD$ freetiles$ NPCspawnlocation
 Â       NPCspawntile = VAL NPCspawntile$
 Â       XYcalculator = 0
 Â       NPCgridX = 0
 Â       NPCgridY = 1
 Â       REPEAT
 Â         XYcalculator = XYcalculator + 1
 Â         NPCgridX = NPCgridX + 1
 Â         IF NPCgridX = 8 THEN NPCgridY = NPCgridY + 1
 Â         IF NPCgridX = 8 THEN NPCgridX = 1
 Â         IF XYcalculator = NPCspawntile THEN EXIT REPEAT
 Â       END REPEAT

 Â       NPCspriteY = NPCgridY * 44
 Â       NPCspriteY = NPCspriteY - 39
 Â       NPCspriteX = NPCgridX * 44
 Â       NPCspriteX = NPCspriteX - 39
 Â       NPCmoveY = NPCgridY
 Â       NPCmoveX = NPCgridX
 Â       SHOWBUTTON 3 $enemyname$$ $enemyHP$
 Â       SPRITE 13 NPCspriteX NPCspriteY $NPCsprite$$
 Â       NPCalive = 1
 Â     END IF
 Â   END IF

Quote
how complex can enemy spawning get? i can only think of random placement with no delay? but you already did that
Oh, it's better than that alright. Much better... *more mad cackling*
« Last Edit: December 05, 2009, 01:22:51 PM by Silverwind »
I survived the spammage of 2007

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Roguesoft RPG Engine?
« Reply #18 on: December 06, 2009, 01:39:52 PM »
It looks like you have so it figures out how many tiles are able to be spawned at then it picks one randomly to spawn at. That is a strange way of doing things. It also is very bulky code. I just have it keep guessing until it picks a location that it is allowed to spawn at.
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Roguesoft RPG Engine?
« Reply #19 on: December 09, 2009, 08:21:59 AM »
Ok, because I'm so busy of late and mightn't finish this for a week or so, I'll reveal the awesomeness I have planned...

First the computer checks how many NPCs are alive in the current room, and if there are less than the allotted maximum (3) the spawn routine kicks in once the player makes a valid turn/action. The routine first rolls a spawn chance as customary, but here's where the magic comes in:

If the spawn roll is successful, the computer reads the collision classes of each node located at the edge of the player's visibility (-3xy to +3xy from the player's node), and stores the XY locations of any traversable nodes in a "spawnableTiles$" variable. A random node is then selected from the list and the NPC is spawned there. This ensures that NPCs won't spawn miles away from the player and fail to hinder them (for the new room size is quite large and there can only be 3 NPCs alive at once, not nearly enough to populate the square radius). Further more, when an NPC travels 5 spaces from the player's visibility it will disappear, allowing the spawn routine to kick in again. In this way it'll appear to the player that each room is thriving with NPCs! Preserving the danger element of exploration.

Cool huh?
« Last Edit: December 10, 2009, 08:22:29 AM by Silverwind »
I survived the spammage of 2007

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Roguesoft RPG Engine?
« Reply #20 on: December 09, 2009, 11:19:00 AM »
NICE! The world will appear to be FILLED with monsters.
EDIT: However what will happen when you reach the edge of the screen?
« Last Edit: December 09, 2009, 11:19:48 AM by Tireas_Dragon »
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Roguesoft RPG Engine?
« Reply #21 on: December 09, 2009, 08:01:18 PM »
nice, thats very similar to what i used in the gangwars ex mini game in stans world 2, also the suit cases of money (treasure chests) would only appear if in the screen radius too
« Last Edit: December 09, 2009, 08:01:48 PM by EqwanoX »

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Roguesoft RPG Engine?
« Reply #22 on: December 10, 2009, 07:12:43 AM »
Quote
NICE! The world will appear to be FILLED with monsters.
EDIT: However what will happen when you reach the edge of the screen?
Any nodes located at XY < 1 or > 25 return nullified. :) I have a rare hour to spare so I'm gonna hit the code now.

Quote
nice, thats very similar to what i used in the gangwars ex mini game in stans world 2, also the suit cases of money (treasure chests) would only appear if in the screen radius too
Nice! The mini games never worked for me. I think I had an incorrect file or something.
I survived the spammage of 2007

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Roguesoft RPG Engine?
« Reply #23 on: December 11, 2009, 07:19:38 AM »
The spawner is coming along well. Here's what I've got so far:

Code: [Select]
'----NPC SPAWN---------------------------------------------------------------------------------
    IF npcAlive = 0 THEN
      enemySpawnChance = RANDOM 5
      IF enemySpawnChance = 1 THEN

        ' --- Determine the player's sight radius.
        minCheckX = playerGridX - 4
        minCheckY = playerGridY - 4
        maxCheckX = playerGridY + 4
        maxCheckY = playerGridX + 4
        checkX = 0
        checkY = 0
        freeTileList$ = ""
        freeTileCount = 0

        REPEAT
          ' --- Determine which node to check.
          checkX = checkX + 1
          IF checkX > 25 THEN
            checkX = 1
            checkY = checkY + 1
            ' --- Determine the collision classes of the X row to be checked.
            IF checkY = 1 THEN gridRow$ = gridRow1$
            IF checkY = 2 THEN gridRow$ = gridRow2$
            IF checkY = 3 THEN gridRow$ = gridRow3$
            IF checkY = 4 THEN gridRow$ = gridRow4$
            IF checkY = 5 THEN gridRow$ = gridRow5$
            IF checkY = 6 THEN gridRow$ = gridRow6$
            IF checkY = 7 THEN gridRow$ = gridRow7$
            IF checkY = 8 THEN gridRow$ = gridRow8$
            IF checkY = 9 THEN gridRow$ = gridRow9$
            IF checkY = 10 THEN gridRow$ = gridRow10$
            IF checkY = 11 THEN gridRow$ = gridRow11$
            IF checkY = 12 THEN gridRow$ = gridRow12$
            IF checkY = 13 THEN gridRow$ = gridRow13$
            IF checkY = 14 THEN gridRow$ = gridRow14$
            IF checkY = 15 THEN gridRow$ = gridRow15$
            IF checkY = 16 THEN gridRow$ = gridRow16$
            IF checkY = 17 THEN gridRow$ = gridRow17$
            IF checkY = 18 THEN gridRow$ = gridRow18$
            IF checkY = 19 THEN gridRow$ = gridRow19$
            IF checkY = 20 THEN gridRow$ = gridRow20$
            IF checkY = 21 THEN gridRow$ = gridRow21$
            IF checkY = 22 THEN gridRow$ = gridRow22$
            IF checkY = 23 THEN gridRow$ = gridRow23$
            IF checkY = 24 THEN gridRow$ = gridRow24$
            IF checkY = 25 THEN gridRow$ = gridRow25$
          END IF

          ' --- Determine the XY coordinates of the checker based on the individual X and Y coordinates.
          checkXY = 25 * checkY
          checkXY = checkXY - 25
          checkXY = checkXY + checkX
          checkXY$ = STR$ checkXY

          ' --- Check if the tile is fit for spawning.
          tileToCheck$ = MID$ gridRow$ checkX 1
          IF tileToCheck$ = "0" THEN
            tileOnEdge$ = "No"
            IF checkX = minCheckX THEN tileOnEdge$ = "Yes"
            IF checkX = maxCheckX THEN tileOnEdge$ = "Yes"
            IF checkY = minCheckY THEN tileOnEdge$ = "Yes"
            IF checkY = maxCheckY THEN tileOnEdge$ = "Yes"

            ' --- If the tile is 1 node from the player's sight radius, add it to the list of spawnable tiles.
            IF tileOnEdge$ = "Yes" THEN
              freeTileList$ = freeTileList$ + checkXY$
              freeTileList$ = freeTileList$ + ""
              freeTileCount = freeTileCount + 1
            END IF
          END IF
          IF checkXY = 650 THEN EXIT REPEAT
        END REPEAT

        ' --- Select a tile from the list of spawnable tiles.
        IF freeTileList$ <> "" THEN
          chosenItemFromList = RANDOM freeTileCount
          chosenItemFromList = chosenItemFromList + 1
          spawnXY$ = WORD$ freeTileList$ chosenItemFromList
          spawnXY = VAL spawnXY$

          ' --- Determine the NPC's X and Y coordinates based on its XY coordinates.
          npcXY = 0
          npcGridX = 0
          npcGridY = 1
          REPEAT
            npcXY = npcXY + 1
            npcGridX = npcGridX + 1
            IF npcGridX = 26 THEN npcGridY = npcGridY + 1
            IF npcGridX = 26 THEN npcGridX = 1
            IF npcXY = spawnXY THEN EXIT REPEAT
          END REPEAT

          ' --- Determine the NPC's sprite coordinates based on its grid coordinates.
          npcSpriteY = npcGridY * 44
          npcSpriteY = npcSpriteY - 39
          npcSpriteX = npcGridX * 44
          npcSpriteX = npcSpriteX - 39
          npcNewGridX = npcGridX
          npcNewGridY = npcGridY
          npcAlive = 1

          ' --- Determine which type of enemy to spawn.
          enemyType = RANDOM enemyTypes
          IF enemyType = 1 THEN enemyName$ = enemyName1$
          IF enemyType = 1 THEN enemySprite$ = enemySprite1$
          IF enemyType = 2 THEN enemyName$ = enemyName2$
          IF enemyType = 2 THEN enemySprite$ = enemySprite2$
          IF enemyType = 3 THEN enemyName$ = enemyName3$
          IF enemyType = 3 THEN enemySprite$ = enemySprite3$
          IF enemyType = 4 THEN enemyName$ = enemyName4$
          IF enemyType = 4 THEN enemySprite$ = enemySprite4$
          IF enemyType = 5 THEN enemyName$ = enemyName5$
          IF enemyType = 5 THEN enemySprite$ = enemySprite5$
        END IF
      END IF
    END IF
'---/NPC SPAWN---------------------------------------------------------------------------------
I haven't tested it yet as I'm heading to work soon, but I'm fairly sure there's a few kinks I need to work out. It's coming along nicely though. :)
I survived the spammage of 2007

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • Arcade of the Absurd
Re: Roguesoft RPG Engine?
« Reply #24 on: December 11, 2009, 08:35:41 AM »
So this is like a rougelike? Interesting...

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Roguesoft RPG Engine?
« Reply #25 on: December 11, 2009, 10:35:12 AM »
so this makes for an endless amount of enemies in a dungeon? if thats true thats kind of like just having random encounters, except theyre visible on the screen. i like the idea of haveing a fixed amount of enemies per floor so that clearing out a whole floor gives a sense of accomplishment.... and maybe randomly spawns the boss of that floor that gives a special item or gold when defeated

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Roguesoft RPG Engine?
« Reply #26 on: December 11, 2009, 10:46:21 AM »
Quote
Nice! The mini games never worked for me. I think I had an incorrect file or something.
what?! why does noone tell me these things

i just went to download stans world 2 to see if thats true and its not even in the downloads! thats so aggrivating when one works so hard to make a game and then ghost doesnt even put any effort into making it available. its not hard to make a link, and it adds content to the site for new people looking to get into game design. the downloads is the best part of the site and the easiest to maintain. while im on this, what happened to haveing a screen shot for each game, that was a great feature

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Roguesoft RPG Engine?
« Reply #27 on: December 11, 2009, 12:46:50 PM »
Quote
so this makes for an endless amount of enemies in a dungeon? if thats true thats kind of like just having random encounters, except theyre visible on the screen.
Yeah, that's a good way of looking at it. I suppose it adds an extra element to the gameplay, being able to avoid encounters.

Quote
i like the idea of haveing a fixed amount of enemies per floor so that clearing out a whole floor gives a sense of accomplishment.... and maybe randomly spawns the boss of that floor that gives a special item or gold when defeated
Yeah, the idea of clearing a floor is cool, especially if that were to initiate the boss spawn. I doubt I'd have enough room for all the NPC code though.

One of these days I should really write a new NPC AI routine which references the stats of NPC "slots" and thus handles multiple NPCs without using duplicate code. Anyone up for the challenge? (keeping in mind that GM doesn't have methods, or it'd be easy)

Quote
what?! why does noone tell me these things
They tell me, and I tell Kirk Douglas.

Quote
while im on this, what happened to haveing a screen shot for each game, that was a great feature
You can submit a screenshot via the Submit Content form and it'll be added when Ghost gets a free moment. Click the camera icon prefixing the game's title to view the screenshot. :)
« Last Edit: December 11, 2009, 12:48:35 PM by Silverwind »
I survived the spammage of 2007

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Roguesoft RPG Engine?
« Reply #28 on: December 11, 2009, 08:11:15 PM »
does gm have a loop code? is the npc movment random? cause that wouldnt use that much code

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Roguesoft RPG Engine?
« Reply #29 on: December 11, 2009, 09:18:44 PM »
GM has 3 ways of looping
(On Main Card Script)
You may click loop script.
You may use ON TIMER x and that will repeat the code in the ON TIMER
(anywhere)
x = 0
REPEAT numberoftimes
x = x + 1
do stuff
END REPEAT
I can't think of any other ways of looping script at the moment.
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.