Think I need advice on how to proceed...
-
- Addict
- Posts: 1675
- Joined: Sun Dec 12, 2010 12:36 am
- Location: Somewhere in the midwest
- Contact:
Think I need advice on how to proceed...
Hi guys,
As you know I have been trying to "get my fu back" and start working on my Text RPG game/engine.
But I have run into a technical dilemma that I am not sure how to move past. Those who know me should know by now that this will be a long post as I attempt to explain what the problem is, and why I can't move past it, and what I wish to accomplish; so please bear with me and read it.
When I first started out, long before I came to PureBasic, one of my goals for this game project was to come away with not only a fully working game, but also a game engine that could essentially be re-used and expanded upon further. The realist in me sees that there a lot of things I don't know, and would have a hard time learning in order to do what I want, but the kid/programmer in me wants to press forward and do things and have a finished project...
The proverbial straw that has broken the camels back is the constant thinking I have done on subsystems such as Quests and Combat/World mechanics, to a lesser extent AI as well..
When I set out to start my world editing tools, I wanted to make a program that I could create almost everything from. Rooms, NPC characters, Monsters, Items, Quests, etc.. As it stands right now the only thing I would be able to create and alter in a truly re-usable fashion are my Rooms. Rooms are very simple, it involves minimal code that spits out a room description and checks for valid directions. Rooms can be easily linked and unlinked with predefined fields and from that aspect it is pretty mailable and there is no need to hard-code anything important that I want to accomplish with a built room (because it requires a handful of static fields in a data structure).
With the other stuff it becomes more complex, from the way I see things.. Building a quest for instance, I cannot rely on a few predefined structure fields to hold all the data I need - not without having huge structures and unused fields littered all over (waste of memory yes?) depending on how big or small the quest is and what kind of interaction is required during said quest. There is the question of how to manage triggers for quest progression, how to update quests based on interaction with NPC's (new objective) or Monsters (kill x monster, collect something from them, etc).
The only solution I see would be to hard-code the majority of that stuff into the program source, which hurts code re-use from a management standpoint.. I have to worry about keeping things very tightly organized and keep reusable code out of files intended for a specific project, and from a motivational stand point that really hurts me.. It is a personal flaw of mine I guess.. My brain tells me "why do this if you are going to have to go back and rip it out the next time, and write the new stuff from scratch? ".... So it makes me feel really bad and like its not even worth it.
I do feel a lot of this would be solved by a scripting language, but as well all know good wrappers are scarce or incomplete, and for someone like me, I could easily spend half a year trying to understand how to integrate a language like Python, or LUA, just by myself. Some of it could probably be made easier by some Object Oriented management also, but PB is not OO and I have no desire to.... try and learn the various OO middle-ware that users have created.
I had an idea about trying to come up with some way of parsing an external data file (say, XML or INI/node based) to try and generate some dynamic content during runtime but I'm not even sure how/if that would work or if it would be too limited technically.. i.e reading some instructions from a file that say "create this variable and give it this value", or "here is a function definition, create this function" etc.. I don't think that's possible in any language? If anything that sounds more like a compiler / VM and way out of my realm anyhow..
I'm just at a real loss here.. Do I need to suck it up and just hard-code stuff? Is there any merit to trying to use external data files to dynamically change things during run-time?
Has anyone else faced this kind of problem, or at least something similar?
I think on an emotional level it is effecting me even more than being frustrated by my technical limitations/understanding.. Because I've been at this idea a couple years now, gone through a couple different programming languages, and now that I've gotten farther I still feel embarrassed because I've got a lot of participation on these forums, made a lot of posts, talked about ideas, requested help with some code -- and I still have nothing to show for it. Makes me feel like a fake?
As you know I have been trying to "get my fu back" and start working on my Text RPG game/engine.
But I have run into a technical dilemma that I am not sure how to move past. Those who know me should know by now that this will be a long post as I attempt to explain what the problem is, and why I can't move past it, and what I wish to accomplish; so please bear with me and read it.
When I first started out, long before I came to PureBasic, one of my goals for this game project was to come away with not only a fully working game, but also a game engine that could essentially be re-used and expanded upon further. The realist in me sees that there a lot of things I don't know, and would have a hard time learning in order to do what I want, but the kid/programmer in me wants to press forward and do things and have a finished project...
The proverbial straw that has broken the camels back is the constant thinking I have done on subsystems such as Quests and Combat/World mechanics, to a lesser extent AI as well..
When I set out to start my world editing tools, I wanted to make a program that I could create almost everything from. Rooms, NPC characters, Monsters, Items, Quests, etc.. As it stands right now the only thing I would be able to create and alter in a truly re-usable fashion are my Rooms. Rooms are very simple, it involves minimal code that spits out a room description and checks for valid directions. Rooms can be easily linked and unlinked with predefined fields and from that aspect it is pretty mailable and there is no need to hard-code anything important that I want to accomplish with a built room (because it requires a handful of static fields in a data structure).
With the other stuff it becomes more complex, from the way I see things.. Building a quest for instance, I cannot rely on a few predefined structure fields to hold all the data I need - not without having huge structures and unused fields littered all over (waste of memory yes?) depending on how big or small the quest is and what kind of interaction is required during said quest. There is the question of how to manage triggers for quest progression, how to update quests based on interaction with NPC's (new objective) or Monsters (kill x monster, collect something from them, etc).
The only solution I see would be to hard-code the majority of that stuff into the program source, which hurts code re-use from a management standpoint.. I have to worry about keeping things very tightly organized and keep reusable code out of files intended for a specific project, and from a motivational stand point that really hurts me.. It is a personal flaw of mine I guess.. My brain tells me "why do this if you are going to have to go back and rip it out the next time, and write the new stuff from scratch? ".... So it makes me feel really bad and like its not even worth it.
I do feel a lot of this would be solved by a scripting language, but as well all know good wrappers are scarce or incomplete, and for someone like me, I could easily spend half a year trying to understand how to integrate a language like Python, or LUA, just by myself. Some of it could probably be made easier by some Object Oriented management also, but PB is not OO and I have no desire to.... try and learn the various OO middle-ware that users have created.
I had an idea about trying to come up with some way of parsing an external data file (say, XML or INI/node based) to try and generate some dynamic content during runtime but I'm not even sure how/if that would work or if it would be too limited technically.. i.e reading some instructions from a file that say "create this variable and give it this value", or "here is a function definition, create this function" etc.. I don't think that's possible in any language? If anything that sounds more like a compiler / VM and way out of my realm anyhow..
I'm just at a real loss here.. Do I need to suck it up and just hard-code stuff? Is there any merit to trying to use external data files to dynamically change things during run-time?
Has anyone else faced this kind of problem, or at least something similar?
I think on an emotional level it is effecting me even more than being frustrated by my technical limitations/understanding.. Because I've been at this idea a couple years now, gone through a couple different programming languages, and now that I've gotten farther I still feel embarrassed because I've got a lot of participation on these forums, made a lot of posts, talked about ideas, requested help with some code -- and I still have nothing to show for it. Makes me feel like a fake?
Re: Think I need advice on how to proceed...
no need to beat up on yourself. You're taking on a large challenge and it's hard to know what to do and how to go about it
especially when you're fairly new to a language and programming in general.
Id say if you want to make the engine reusable and provide a means to script it
you may well benefit from learning to use oo like methods, it will probably make it a lot easier for you to
organise your code independently but you don't have to use interfaces to achieve it just structure your data
and use instances, it's no different than using regular PB objects. You use lists maps?
You may also want to consider providing a plug in mechanism to the architecture
so you can load insert or swap modules by pipelining it.
It's by no means simple to create a generic framework without first having solved the problem at least once
but how else are you supposed to know? though that leads me back to making modular code to start with
where you brake the logic down into structures isolating your data and algorithms into units.
If you build a tree of structures it becomes a lot easier.
You may also want to look into the theory of graphs / directed graphs, they could be useful and may make
some things easier to achieve from a scripting point of view, it may be over kill but I'd venture to say graphs
would be a good generic structure for some tasks in a RPG game.
Keep going Zach!
especially when you're fairly new to a language and programming in general.
Id say if you want to make the engine reusable and provide a means to script it
you may well benefit from learning to use oo like methods, it will probably make it a lot easier for you to
organise your code independently but you don't have to use interfaces to achieve it just structure your data
and use instances, it's no different than using regular PB objects. You use lists maps?
You may also want to consider providing a plug in mechanism to the architecture
so you can load insert or swap modules by pipelining it.
It's by no means simple to create a generic framework without first having solved the problem at least once
but how else are you supposed to know? though that leads me back to making modular code to start with
where you brake the logic down into structures isolating your data and algorithms into units.
If you build a tree of structures it becomes a lot easier.
You may also want to look into the theory of graphs / directed graphs, they could be useful and may make
some things easier to achieve from a scripting point of view, it may be over kill but I'd venture to say graphs
would be a good generic structure for some tasks in a RPG game.
Keep going Zach!
Windows 11, Manjaro, Raspberry Pi OS


Re: Think I need advice on how to proceed...
Short answer: it sounds like a scripting engine is exactly what you need.
But: do you develop your own, or use an existing scripting engine?
There are lots of proven scripting engines out there, many for games specifically. (Personally I haven't really used any though...) These have their own difficulties: interfacing with PureBasic, learning curve, overhead due to general-purpose nature of them...
Or you can write your own scripting engine. I think most games do this, to some extent. You can use a standard format (like XML as you mentioned) and apply your own meaning to it, or go full-custom syntax. I have done both the past (and enjoyed both!). Custom scripting engines allow you to fine-tune exactly the features you need -- even moreso with a custom format/syntax.
In every situation you have to draw a line between generalizing your engine, and hardcoding some aspects. It varies in every project. If you're the only working on this, you have to be realistic about your efforts and timeframe -- don't expect to create the next Skyrim engine yourself (or insert any other game I haven't played
). Also, always be aware of feature creep! Otherwise you will find yourself adding too many new features too often, and not making progress on the game content itself!
I've been working on a game for more than a year too. It's not an RPG, but it does have a custom script engine (parsed via PB's XML library). Totally worth it... even a small bit of scripting opens up a whole range of dynamic gameplay that would normally hit a plateau if hard-coded too much. But in the last few months I've forced myself to NOT add some feature ideas, for the sake of realistically finishing this one-man game by summer!
As for technical aspects... dynamic classes, gameplay variables, AI, whatever..... ask questions as you think of them! We are here to help.
But: do you develop your own, or use an existing scripting engine?
There are lots of proven scripting engines out there, many for games specifically. (Personally I haven't really used any though...) These have their own difficulties: interfacing with PureBasic, learning curve, overhead due to general-purpose nature of them...
Or you can write your own scripting engine. I think most games do this, to some extent. You can use a standard format (like XML as you mentioned) and apply your own meaning to it, or go full-custom syntax. I have done both the past (and enjoyed both!). Custom scripting engines allow you to fine-tune exactly the features you need -- even moreso with a custom format/syntax.
In every situation you have to draw a line between generalizing your engine, and hardcoding some aspects. It varies in every project. If you're the only working on this, you have to be realistic about your efforts and timeframe -- don't expect to create the next Skyrim engine yourself (or insert any other game I haven't played

I've been working on a game for more than a year too. It's not an RPG, but it does have a custom script engine (parsed via PB's XML library). Totally worth it... even a small bit of scripting opens up a whole range of dynamic gameplay that would normally hit a plateau if hard-coded too much. But in the last few months I've forced myself to NOT add some feature ideas, for the sake of realistically finishing this one-man game by summer!
As for technical aspects... dynamic classes, gameplay variables, AI, whatever..... ask questions as you think of them! We are here to help.
-
- Addict
- Posts: 1675
- Joined: Sun Dec 12, 2010 12:36 am
- Location: Somewhere in the midwest
- Contact:
Re: Think I need advice on how to proceed...
Thanks for the input guys,
I understand all of what you are saying and a lot of it does make sense.. I had considered "plugin" or code modularization before but I wasn't really sure how I would go about it or implement it.. But yes I had thought "well what if I write a DLL that contains all the combat algorithms and such, and then I can swap it out with another for a different combat system".. Stuff along those lines.
Although in terms of additional functionality, via plugin type systems.. I don't even know how those work and have never looked it up personally. So how do they work? I mean, how can you literally add new functionality into the existing system, and make it accessible to the old code? i.e if I swap out one DLL for another that has new / different named functions and such, I guess I don't understand how the system would be able to pick up and use those new or renamed functions at run-time.. without modifying the source code.. But I know there has to be a way its done, because people produce plugins for all kinds of apps that don't need to be recompiled, etc..
I would like to look into scripting, Kenmo, but I don't think I will get very far trying to make even my own basic scripting language.. Just reading about parsers and trying to comprehend them makes my eyes bleed... lol I don't even really understand BNF or whatever the acronym is (the language for defining your language) despite reading about it several times.
What was your experience like, developing your scripting language?
I definitely would like to be able to parse XML files and do something useful with the data.. But I guess I don't understand what is involved in that in terms of translating it to something the program can DO something with.. I basically know how I could use XML data to say.. define some items and their properties, and read that into a structured variable to make it an item in-game.. But I want to go beyond that I guess.. Like maybe I have a limited structure setup to use as a Quest tracker, but all the details about the quest itself won't be known until run-time? So if I want to add a data field on the fly, and attach some new data to an NPC or create some kind of check.. It seems like I would have to over-engineer the game mechanics and data structures for "all possibilities" to actually achieve that instead of being able to define it in a file format and parse it at run-time. I'm not even sure if that makes sense...
I knew it would be extremely hard getting into this.. Especially a Text game / Engine of the scale I envisioned, but perhaps it does need to sit on the back burner at some point? I have been wanting to toy with 2D graphics for a while now, and do something similar to a console style RPG. Although the whole problem of Quest management and other systems and scripting may come up again, I do visualize such a game as being much more modular thanks to a directional flow-chart I saw on how FF7 worked.
I will appreciate any other feedback people have on my first post, in additional to what I've gotten already.
I understand all of what you are saying and a lot of it does make sense.. I had considered "plugin" or code modularization before but I wasn't really sure how I would go about it or implement it.. But yes I had thought "well what if I write a DLL that contains all the combat algorithms and such, and then I can swap it out with another for a different combat system".. Stuff along those lines.
Although in terms of additional functionality, via plugin type systems.. I don't even know how those work and have never looked it up personally. So how do they work? I mean, how can you literally add new functionality into the existing system, and make it accessible to the old code? i.e if I swap out one DLL for another that has new / different named functions and such, I guess I don't understand how the system would be able to pick up and use those new or renamed functions at run-time.. without modifying the source code.. But I know there has to be a way its done, because people produce plugins for all kinds of apps that don't need to be recompiled, etc..
I would like to look into scripting, Kenmo, but I don't think I will get very far trying to make even my own basic scripting language.. Just reading about parsers and trying to comprehend them makes my eyes bleed... lol I don't even really understand BNF or whatever the acronym is (the language for defining your language) despite reading about it several times.
What was your experience like, developing your scripting language?
I definitely would like to be able to parse XML files and do something useful with the data.. But I guess I don't understand what is involved in that in terms of translating it to something the program can DO something with.. I basically know how I could use XML data to say.. define some items and their properties, and read that into a structured variable to make it an item in-game.. But I want to go beyond that I guess.. Like maybe I have a limited structure setup to use as a Quest tracker, but all the details about the quest itself won't be known until run-time? So if I want to add a data field on the fly, and attach some new data to an NPC or create some kind of check.. It seems like I would have to over-engineer the game mechanics and data structures for "all possibilities" to actually achieve that instead of being able to define it in a file format and parse it at run-time. I'm not even sure if that makes sense...
I knew it would be extremely hard getting into this.. Especially a Text game / Engine of the scale I envisioned, but perhaps it does need to sit on the back burner at some point? I have been wanting to toy with 2D graphics for a while now, and do something similar to a console style RPG. Although the whole problem of Quest management and other systems and scripting may come up again, I do visualize such a game as being much more modular thanks to a directional flow-chart I saw on how FF7 worked.
I will appreciate any other feedback people have on my first post, in additional to what I've gotten already.
Re: Think I need advice on how to proceed...
would a Map help with this?Zach wrote:I had an idea about trying to come up with some way of parsing an external data file (say, XML or INI/node based) to try and generate some dynamic content during runtime but I'm not even sure how/if that would work or if it would be too limited technically.. i.e reading some instructions from a file that say "create this variable and give it this value"
Code: Select all
Read XML/INI into var_string, var_value
var_map(var_string) = var_value
.
.
.
if var_map(var_string) = var_value, do stuff
there is no sig, only zuul (and the following disclaimer)
WARNING: may be talking out of his hat
WARNING: may be talking out of his hat
-
- Addict
- Posts: 1675
- Joined: Sun Dec 12, 2010 12:36 am
- Location: Somewhere in the midwest
- Contact:
Re: Think I need advice on how to proceed...
hmm...maybe? I will have to explore that option.
It -might- work for some thing..
But I was speaking more in the sense of creating a brand new variable, or even function, or even structure definition too.
Its kind of hard to put into words what I mean.. But Kenmo pretty much nailed it on the head, in that I pretty much would need a scripting language to accomplish most of what I want to do.
It -might- work for some thing..
But I was speaking more in the sense of creating a brand new variable, or even function, or even structure definition too.
Its kind of hard to put into words what I mean.. But Kenmo pretty much nailed it on the head, in that I pretty much would need a scripting language to accomplish most of what I want to do.
-
- Addict
- Posts: 1264
- Joined: Wed Feb 28, 2007 9:13 am
- Location: London
Re: Think I need advice on how to proceed...
Zach,
I've been where you are. What's happening is analysis paralysis. You're so worried about making the wrong step, or a step that you'll have to change later, that you're not making any step at all.
It is depressing because, as you say, you've got a certain timeframe in mind and you expect to have made progress by this date, this date, and this date, and so on. When you're not making that progress, it gets you down.
What's even worse is when you are trying to predict so much, that you end up not actually doing anything. It's like the guy who says "this is going to be the perfect fishing trip" and starts drawing diagrams and formulating plans of action etc., and gets so wrapped up in this that he never actually goes fishing. Contrast that with the guy who just calmly goes and does it, with a minimum of planning, and just adapts to things as they occur. One gets depressed, the other gets fish.
Face the fact that no matter what you do with this game engine, no matter how great you make it, no matter how much you build into it... you will end up modifying it for the next game. And the game after that. You can't make a definitive thing - at least, not if you expect to be wiser in 5 years than you are today. And I presume you do expect that? So, stop worrying about doing it perfectly today. It's not possible and even if it was, what would you do after you'd reached that Holy Grail?
More practically, I would suggest you look into writing processor tools which alter the source code prior to it being sent to the compiler. This may enable you to automate the creation of procedures, structures, etc., based on whatever code is there.
I've been where you are. What's happening is analysis paralysis. You're so worried about making the wrong step, or a step that you'll have to change later, that you're not making any step at all.
It is depressing because, as you say, you've got a certain timeframe in mind and you expect to have made progress by this date, this date, and this date, and so on. When you're not making that progress, it gets you down.
What's even worse is when you are trying to predict so much, that you end up not actually doing anything. It's like the guy who says "this is going to be the perfect fishing trip" and starts drawing diagrams and formulating plans of action etc., and gets so wrapped up in this that he never actually goes fishing. Contrast that with the guy who just calmly goes and does it, with a minimum of planning, and just adapts to things as they occur. One gets depressed, the other gets fish.
Face the fact that no matter what you do with this game engine, no matter how great you make it, no matter how much you build into it... you will end up modifying it for the next game. And the game after that. You can't make a definitive thing - at least, not if you expect to be wiser in 5 years than you are today. And I presume you do expect that? So, stop worrying about doing it perfectly today. It's not possible and even if it was, what would you do after you'd reached that Holy Grail?
More practically, I would suggest you look into writing processor tools which alter the source code prior to it being sent to the compiler. This may enable you to automate the creation of procedures, structures, etc., based on whatever code is there.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
-
- Addict
- Posts: 1264
- Joined: Wed Feb 28, 2007 9:13 am
- Location: London
Re: Think I need advice on how to proceed...
Another thing, Zach...
It might help if you create a basic version of what you want to achieve - an extremely simple version. That would be a base on which to work. You could just add to it and improve it over time. This would mean you would always have something real to look at in action. The opposite extreme is for the thing to be, for very long periods of time, in a non-functioning state - and that can be depressing. Bugs are one thing, but a crippled system that needs months of work before it will even initialise, is quite another.
One more thing to bear in mind is that computer programs are very easy to adapt and update. There's never really a "finished version" - just the most recent one. And adapting and updating doesn't have to mean clumsy, bolted-on bits... you can update the entire design of a program, making it simpler, more elegant, etc.
It might help if you create a basic version of what you want to achieve - an extremely simple version. That would be a base on which to work. You could just add to it and improve it over time. This would mean you would always have something real to look at in action. The opposite extreme is for the thing to be, for very long periods of time, in a non-functioning state - and that can be depressing. Bugs are one thing, but a crippled system that needs months of work before it will even initialise, is quite another.
One more thing to bear in mind is that computer programs are very easy to adapt and update. There's never really a "finished version" - just the most recent one. And adapting and updating doesn't have to mean clumsy, bolted-on bits... you can update the entire design of a program, making it simpler, more elegant, etc.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
-
- Addict
- Posts: 1264
- Joined: Wed Feb 28, 2007 9:13 am
- Location: London
Re: Think I need advice on how to proceed...
By the way... how about having your game as an HTML5 program written in JavaScript?
The PB executable could generate JavaScript which would then be executed in the webgadget. This way, you wouldn't need to invent a new scripting language.
The PB executable could generate JavaScript which would then be executed in the webgadget. This way, you wouldn't need to invent a new scripting language.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
-
- Addict
- Posts: 1675
- Joined: Sun Dec 12, 2010 12:36 am
- Location: Somewhere in the midwest
- Contact:
Re: Think I need advice on how to proceed...
Thanks for your thoughts.
What you have said makes a lot of sense. Analysis Paralysis - that's a catchy term
You are right that I need to just push forward.. I think my biggest fear is having to go back and modify things, and having so much source to go through that it becomes a burden, or I end up lost in my own code... But tight modularization can help offset that..
I agree with having a basic system working - I think my problem is, my idea of basic has too much to put into it.
I don't think I want to go outside of PB to do any of this however, the end-goal of this work is going to be a very complex system that will more than likely require significant processing power (at some point in the future, especially if I add server / client multiplayer) and I'm weary of being able to get that with a browser based solution.. Plus I hate Javascript; tried to learn it once, was almost as bad as C++
You guys have given me some good advice, so I thank you for that.
What you have said makes a lot of sense. Analysis Paralysis - that's a catchy term

You are right that I need to just push forward.. I think my biggest fear is having to go back and modify things, and having so much source to go through that it becomes a burden, or I end up lost in my own code... But tight modularization can help offset that..
I agree with having a basic system working - I think my problem is, my idea of basic has too much to put into it.
I don't think I want to go outside of PB to do any of this however, the end-goal of this work is going to be a very complex system that will more than likely require significant processing power (at some point in the future, especially if I add server / client multiplayer) and I'm weary of being able to get that with a browser based solution.. Plus I hate Javascript; tried to learn it once, was almost as bad as C++

You guys have given me some good advice, so I thank you for that.