Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

A deep look into RPG game development

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> Creative Corner
View previous topic :: View next topic  
Author Message
chronoboy
Into the past with a splash




Joined: 04 Jun 2010
Posts: 162
Location: Canada

PostPosted: Fri Nov 19, 2010 2:00 am    Post subject: A deep look into RPG game development Reply with quote

This post contains some pre-release code from my Heart of OHR project, nothing is a spoiler, however.

Before moving this thread, consider this: A majority of this post is a creative story on RPG developments past and present including OHR, it has some very creative topics, and illustrates a very creative way of scripting. Can't say I didn't try...

What do most RPG engines have in common? A tag system! A tag a simple bit based variable, it can either be on, or it can be off. In many RPG engines and games, it is the driving force of the epic story lines. Did the player do this yet, has he purchased that item, talked to that NPC, etc...

The popularity of tags is due to their very small storage requirement. When computers and game consoles were young, using tags was a no brainer. However, with the very simplicity of tags, comes the simplicity or sometimes complexity of a story. In order to drive a very complex story using tags, you need a lot of them and need to branch them out a lot. Take a look at the console versions of RPG Maker for example, load up the sample game and look at their event systems. It's very confusing to follow the story and even find bugs with this much branching.

In the modern era of computer and console games, we have much more memory to use. Developers are now mixing both a tags system and full fledged variable system for the same purpose. Real variables have the advantage to store more than just two different states, it can store very large numbers. When you have a very complex story, it starts to become essential to use real variables rather than a tag system. Using both together definitely has advantages.

Which brings me to this, I personally use a 2D RPG engine called OHR.R.P.G.CE, to develop my RPG games and stories. This engine has a scripting system for driving story and cutscenes, this was it's main purpose when it was created. Now the scripting engine has completely evolved into something great. Although, when OHR developers use it's godly powers, it's not normally for an RPG game, but for a platformer, or another genre. Some of them get creative and code RPG mini-games using it. This is all and good, but it's a complete waste to what power it has to offer for an RPG game.

Let me elaborate, most OHR developers in their RPG games would use a script to add special effects, or add a fancy cutscene into the mix. It's very true that the scripting is great for those, but the same developers which are creating non-RPG games using scripts, are not really applying those same skills to an RPG game. I don't mean by adding a platformer mini-game into their RPG game, that's just stupid use of scripting for an RPG game. If a mini-game appears in an RPG game, the mini game should be Role-playing related, or at least match the theme of the RPG game. I admit seeing many mini-games in RPG games that look completely "tacked" on. There was absolutely no reason for the mini-game at all, but to frustrate the player.

Now on to the good stuff, this is how I utilize the scripting engine in OHR. I will say this many times over, I do believe that I am the only developer in the OHR community which uses these odd methods. I am explaining it here to provide some with ideas, and also the reasons behind my insane way of scripting. Believe me, you haven't seen RPG game scripting quiet like this yet.

Okay, my big rule number 1 when creating an RPG game, separate the game editor from the script and make as much of the scripting reusable as possible. I don't mean reusable in other RPG games, but reusable in the same game. Here is how I do this, read carefully. Inside custom, assign a new-game, load-game, and game-over scripts. Assign a generic map autorun script, which dispatches to other scripts. Assign a after-battle script. When designing the maps, only design the tile and wallmaps. Leave everything else a blank slate. Create the NPCs, but don't place them on the map in static locations, leave your NPC map a blank slate.

Now some of you readers are thinking... "Well this world will be very baron, not even a living creature in sight", well we did create the NPCs, but never placed them. I would recommend creating a template map, which would already have your autorun and after-battle set. Also, set the map music to just -same as previous map-, you'll see why I do this soon.

OHR.R.P.G.CE is very very limited when using the editor to develop your game and world. What we have done above is set the canvas, in which we will extend the engine via scripting. Most developers would use scripting for very simple and trivial things in their RPG game. Doing what we did above, allows us to control every aspect of the game from within a script, while keeping it an RPG game, and still using the editor. Having less scripts to set in the editor makes everything a whole lot easier to manage in the end.

Okay, here is our first scripting example, our map autorun dispatcher. Name it anything you like, and be sure every map has this set as it's autorun, using templates makes this a cinch.

Code:

  if (run mapsetup == 0) then (exit script)
  set tag (tag:Savable,true)
  if (current map == map:Waku Forest 1) then (waku forest 1)
  if (current map == map:Waku Village) then (waku village)
  if (current map == map:Waku Stables) then (waku stables)
  if (current map == map:Waku Forest 2) then (waku forest 2)
  if (current map == map:Waku Cavern) then (waku cavern)


There we have it, a very simple map autorun dispatcher function. It's very simple to read and pretty straightforward. I'll explain the first two lines: The first line checks a global variable, which is used in a load-game script to make sure that the map autorun runs after the game's load-game script. Depending on your game, this may not be needed. But for my game, the load-game script sets some very crucial variables that tend to break the map autorun if not correctly set. The second line sets a tag which controls the displaying of the "Save" menu option. Controlling this from a tag makes it incredibly easy to manage when the player can and cannot save their game. I also use a custom save-game script, which I will get into more detail later on.

Now that we have a map dispatch function for every map to use and call, lets go into what a map autorun has to do in a game such as how I script it. Reader bewhere, the next section of code may scare some OHR developers, you have been warned!

Code:

  variable (i)
  isBlue := 0
  isRed := 0
  set each step script (@map steps)
  set on keypress script (@key handler)
  create ns door (8,9)
  create ew door (13,13)
  create ns inside (19,14)
  if (hour >> 10,and,hour << 21) then (create NPC (2,9,6)) else (npc ns bed (11,6))
  north map := 1
  south map := -1
  east map := -1
  west map := 1
  for (i,3,10,1) do, begin
    make animal (i)
  end
  blue portal (21,3,1,91)
  setup blue npc (91)
  set moon (1,14,14)
  set timer (0,30,18,@pass cloud)
  set timer (1,20,18,@pass cloud)
  map soundtrack (Song:Starry)


This sniplet of code is taken directly from my staging demos first map autorun. Now, if your that curious on how I made the staging area, this is your lucky day!

For the most part, this is very straightforward scripting for most developers, I will point out a few things. Since we do not set a each step or keypress script in the map data, it is set-up here. Your thinking to yourself, what is the point of this, why not just set it in the map editor? The simple answer being, the map editor is static information! Lets say, along the development of your RPG, you wanted to make it so a special event would alter these scripts or disable them completely. Yes, you could have it set in the map, and then use the autorun to disable it or edit it, but if you include it in your map template, every map will have these. Well, okay, then I can just edit the map data for those maps. This is where things begin to get more confusing... Why not just do everything the same way in the editor, thus less menus to pawn through when your trying to debug something. Having everything in the source code is just simpler! You could create a debug tag or variable which can disable these on-demand for specific maps having problems.

This script uses a lot of custom functions, such as the ones to create doors. I like referencing things that use X,Y in the autorun, it makes it much easier to keep track of, and those functions also set special data to the NPC references so that they know how to work.

The next line is an IF line for checking the current game time and taking the correct actions. Some of you might of thought, I used tags to make the NPC vanish at night and populate the bed. No, this is my secret. In my final game, I have autoruns which need to do such things to an entire towns populace, where each NPC may not appear at the same position all the time. This is how I am able to add full NPC schedules to my game to make the game world seem more life-like.

The next four variables are used for when the player walks off the map to move the player to correct place.

The next FOR loop there is for dynamically generating animal NPCs, yet another attempt to make the world more life-like. The make animal function takes care of everything from setting the NPC picture and palette, to randomizing the NPCs place on the map, to even selecting the script that is run when you bump into such an animal.

If you played the staging demo, you will notice a blue gate in the game, these next lines control the gates creation parameters.

The next two lines control the overcast of clouds that pass by in the staging demo.

And last but not least, setting the maps soundtrack. Some of you might be thinking, isn't that suppose to be called "set ambient music"? Well if you want the same effect as setting it in the map editor. If you played my staging demo, you will notice that the ambient music fade in and out very smoothly during specific events, like a battle or playing the interactive item. Wait until you see this in action in the final game, during the development, it's bitter sweet how lovely the music transitions from event to event, it's like no other OHR game you played before.

And there you have it, the first insides of how I code in OHR, and this is not even the half of it. I will have another post soon which will show other things I do, such as textboxes(the most confusing part ever really).
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/
Back to top
View user's profile Send private message Visit poster's website
Newbie_Power




Joined: 04 Sep 2006
Posts: 1762

PostPosted: Fri Nov 19, 2010 8:35 am    Post subject: Reply with quote


_________________

TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN?
Back to top
View user's profile Send private message
chronoboy
Into the past with a splash




Joined: 04 Jun 2010
Posts: 162
Location: Canada

PostPosted: Mon Nov 22, 2010 2:36 pm    Post subject: Reply with quote

Not really re-inventing the wheel, developing your RPG in this way, allows you to, if you wanted, ship your RPG file unpassword(since the password is really easy to get by, I see little point in putting a password).

If the player enters into CUSTOM, he/she would not know where you placed the NPCs on the map or is even able to remove them to cheat for example.

Since all of my major story elements are in plotscript(hence the word plot), unless there is a really good plotscript decompiler out there, the player will not have access to the story elements to cheat or even spoil the game. Sure, the player can see lifeless maps, and solutions to mazes, but that's about it. Now onto how I manage my textboxes...

How to manage all your story element textboxes in plotscript:

First create up to 5 textboxes in CUSTOM, I like to label them 1,2,3,4,5, it makes it easier to refer to them, you'll see why in a few moments.

Textbox 1:
${S1}

Textbox 2:
${S1}
${S2}

and so on...

Now in plotscript, for your cutscene, which you do not want to the player to have access to in CUSTOM, do as follows:

Code:

$1="Blah blah"
$2="Blah blah"
show textbox (2)
wait for textbox


Sure, a very experienced computer geek can use a Hex editor to view the story elements in the scripts... But really, who would go through all that trouble just to uncover something in the story.

Also, by using textboxes like this, you can fully customize them and add better conditionals to them, which are not currently offered in standard textboxes.

My next section will be about how to use mapsteps to prevent any map alterations in CUSTOM, and to further make map transitions more customizable than CUSTOM has to offer. This makes it possible for players snooping in CUSTOM to not know how maps are connected, so they can't get to that secret area you made without actually exploring to find it.
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/
Back to top
View user's profile Send private message Visit poster's website
Newbie_Power




Joined: 04 Sep 2006
Posts: 1762

PostPosted: Mon Nov 22, 2010 2:42 pm    Post subject: Reply with quote

This is one of those things that defeats the entire point of using the OHRRPGCE (which is being able to do stuff with less programming), and an attempt to solve a non-issue that doesn't bother anyone.
_________________

TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN?
Back to top
View user's profile Send private message
chronoboy
Into the past with a splash




Joined: 04 Jun 2010
Posts: 162
Location: Canada

PostPosted: Mon Nov 22, 2010 3:08 pm    Post subject: Reply with quote

Newbie_Power wrote:
This is one of those things that defeats the entire point of using the OHRRPGCE

Tell Baby Bob the hamster that and he'll cry all night long. OHRRPGCE is a great engine for just about anything, and there are plenty of games(mainly in recent years) which well, defeats the entire point of this engine(hence the Heart of OHR contest was created). James could have made Baby Bob the hamster using a platformer engine, or James could have just forked OHR and built O.H.R.Platformer.C.E., which would be an engine to make platforms with as little programming as possible(hint hint there James).

In the end every game designer/developer has their own particular style of developing their game. I enjoy the programmatic approach and am just sharing my experience of this approach and some of it's advantages with the community. I could for example, use the Verge Engine, but I really dislike their scripting syntax, hamsterspeak is great. Verge is also a major train wreck(missing many built-in features for RPG games). I also like that I can easily manage many resources(of which I do not want to program) in CUSTOM. OHR is also much faster than other engines out there, I've been through many engines, and keep coming back to OHR, as I enjoy using it much more. By FAR OHR.RPG.CE is the most complete RPG Construction Engine out there. Other engines seem to lack this feature or that feature, some make a new release which completely breaks old games(*caugh RPG Maker*). I'm rather surprised that OHR hasn't yet stolen half of RPG makers userbase, considering all they have to put up with... But that's a story for another time.

Closing Question:
If OHR never came into existence(or James really did die), which engine would you be using in 2010 to make your SNES-style RPG games?
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/
Back to top
View user's profile Send private message Visit poster's website
Newbie_Power




Joined: 04 Sep 2006
Posts: 1762

PostPosted: Mon Nov 22, 2010 3:14 pm    Post subject: Reply with quote

You use examples of platformers and stuff that can't be done built in through custom, but what you're doing is basic NPC placement and textbox use and acting as though people should avoid doing these with custom.exe.

I see the point in scripting these things, but it's overmarketed and extremely annoying.
_________________

TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN?
Back to top
View user's profile Send private message
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Mon Nov 22, 2010 5:48 pm    Post subject: Reply with quote

It is true that you can do just about everything in plotscripting, but whenever I plotscript a whole game (Don't Eat Soap, Bell of Chaos, Mr. The Hamster's Math Class, etc...) Part of me wishes I just wrote it in python and saved myself a hell of a lot of time and effort... but another part of me enjoys doing things the hard way, so it balances out :)

Sometimes scripting a game in the OHRRPGCE is like painting a picture with oil paints. it is hard and messy and takes a long time and a lot of practice, so why not just use a camera and take a photograph? Sometimes a camera is the right tool for the job, and sometimes 30 different brushes and knives and an overpriced canvas and some rags and some turpentine and a pair of pants that you don't mind ruining is the right tool for the job.

(Full disclosure: I am a lousy painter)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Newbie_Power




Joined: 04 Sep 2006
Posts: 1762

PostPosted: Mon Nov 22, 2010 5:58 pm    Post subject: Reply with quote

I don't have a problem with non-RPG games, and definitely not for making traditional OHR games.

But I feel like this particular idea is pretty unnecessary for most people since it's mostly a way to script functions normally done in Custom.exe, but is spoken like the greatest idea ever.
_________________

TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN?
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Nov 23, 2010 8:33 am    Post subject: Reply with quote

Normally I'm all for misusing the engine, but this is basically the most extreme I've seen. And although people do ask from time to time about being able to prevent all snooping of game data, which I can understand, it's crazy as a justification for this!

I have to point out that a copy of your scripts are archived in the compiled .HS file and therefore stored inside your .RPG file. This is done for backup, and so that Game.exe can print the line on which an error occurs (which it doesn't yet do. Any day now...), so you should only disable this, if you want, when creating releases.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
chronoboy
Into the past with a splash




Joined: 04 Jun 2010
Posts: 162
Location: Canada

PostPosted: Tue Nov 23, 2010 11:23 am    Post subject: Reply with quote

The Mad Cacti wrote:
I have to point out that a copy of your scripts are archived in the compiled .HS file and therefore stored inside your .RPG file. This is done for backup, and so that Game.exe can print the line on which an error occurs (which it doesn't yet do. Any day now...), so you should only disable this, if you want, when creating releases.


I do use the -n switch when making my public releases, I believe the copy of my game I sent your way used the -n switch, the RPG file is unpassworded too.

I do keep a fair amount of game data in CUSTOM, currently using 65 textboxes and only 24 or so tags. Some of these tags are in transition to global variables, and the tags will be reused for other purposes. One of my quests currently switches the state of a global variable 6 times(more as I develop the quest). Tags cannot do this the same way, they only have 2 states and cannot track additional data, and when you have too many tags, it becomes a real problem to manage them all.

Using globals for this purpose, I can use the command-line grep to find all the instances of the global variables and what I set it to or check for in each instance. Since I have all my scripts organized in separate files, grep returns manageable results.

Oh, and a really really neat advantage to having lots of stuff controlled by scripts... you can use any command-line tools to alter the scripts, such as sed, which can come in handy if you need to do a mass string change for any reason.

Another interesting thing you can do with this, is something I did in my current game. I have one map with static objects, it's basically a huge indoor house. I plan on using this map over and over again for various houses of this special type in the game. Instead of copying the map an unbelievable amount of time, I build it once, and conditionally(depending on a single global variable), it populates the house accordingly, with NPCs and other required additional objects for the scene. If you did the same thing, but used tags, it would be very complicated and use a new tag for each NPC on that map, just to hide and show them, it would be crazy to manage.

I'm not saying this method of using the engine is one of the greatest every thought of, but for some special tasks is can make things much easier to manage. Why use 20 tags, when you can use a single global variable with 20 states? Depending on your requirements, use this method as needed.
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/
Back to top
View user's profile Send private message Visit poster's website
Newbie_Power




Joined: 04 Sep 2006
Posts: 1762

PostPosted: Tue Nov 23, 2010 1:41 pm    Post subject: Reply with quote

Okay, but why do we need this? Most people can use tags just fine, and most of the time you aren't checking more than two at a time.

While using a global for the game state is fine, the only real advantage I can see over just checking specific tags is to prevent sequence breaking, and that is a poor game design decision, IMO.
_________________

TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN?
Back to top
View user's profile Send private message
chronoboy
Into the past with a splash




Joined: 04 Jun 2010
Posts: 162
Location: Canada

PostPosted: Tue Nov 23, 2010 2:21 pm    Post subject: Reply with quote

For my particular game, sequence breaking can easily happen if I don't plan out story branching correctly. I have a document with the entire story and each way it can branch out from the root story. Each branch is basically associated with a global variable. During each map autorun which requires changing various tiles and NPCs, it uses these global variables to make sure that everything for the player is consistent to what they should see during that particular segment. I use the same global variables for various custom NPC interactions, so that an NPC would not blab out something inconsistent.

For linear RPG games with sub-quests, using tags is perfectly fine, as these RPGs don't tend to have as many consistency problems.

I wanted a great challenge and a game which would have a good replay value, as those are normally the games I shop for in the stores. Why waste $60 on a game you can play through once and that's really the fun of it. Why spend months to years making a game which you, yourself may only play a few times then get bored? During development there are actually times where I get so side tracked in testing a new feature that I just continue playing... This is sort of bad for me, as it's slowing down my development time. I enjoy bugtesting the story branching a lot, it is very fun to play through and find the inconsistent dialogs or actions, playtesting is very very unpredictable sometimes, as if I miss setting a global variable somewhere, well, the story is a tad off. I just hope to have a demo download out by tonight so people can see what I mean by all this. So far, it looks promising, as the first main story branches are almost bug-free, I'm just finishing up some NPC schedules and balancing out the battle system. Look for it on the CP Gamelist with a download link on the forum, more than likely on the Heart of OHR thread.
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/
Back to top
View user's profile Send private message Visit poster's website
Newbie_Power




Joined: 04 Sep 2006
Posts: 1762

PostPosted: Tue Nov 23, 2010 2:49 pm    Post subject: Reply with quote

Alright, so your game most likely uses the same cutscenes for different locations in the game based on where you go.

The problem is, that's not what this topic is about at all. It's setting up your scripts to do what could easily be done in custom.exe and simple tags. That might be fine for some people, but definitely not for everyone.

I remember a person complaining that the OHR is too script reliant as it is, so of course I'm not going to like topics telling people that they should make minimal use of the GUI and do the same thing with scripts instead.
_________________

TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN?
Back to top
View user's profile Send private message
Spoon Weaver




Joined: 18 Nov 2008
Posts: 421
Location: @home

PostPosted: Wed Dec 01, 2010 8:42 am    Post subject: Reply with quote

I find using the ohr to make non rpg games has it's advantages. I often use short cuts to achieve desired results when making platformers and the like. Plus the map and walkabout system can basically be used in any type of game without having to program that sort of thing yourself. I'm currently trying to mimic the ohr maps for my XNA project and it's giving me a bigger headache than I ever would have guessed.
So basically, I think there's big advantages to using the ohr as a base point for non rpg games.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> Creative Corner All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group