Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Text adventure questions

Author
Message
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 26th Oct 2012 18:39
I am not really into 3D yet even though I have played around with some of the commands. I am thinking about doing a little text game just to learn better, things like text commands, ink, 2D graphic commands, the statements, functions, types etc... and also setting up the game systems like inventory, character creation, banking and money system etc... This will be an RBP based on a mid 80's old school RPG. I already have a lot of this planned out on paper (Notepad Doc.LOL)

My first level will be a city level so I want to see if I have the basic idea of a level right as far as programming.

The levels will be a 30x30 grid. The player and his party will move one square per click of the arrow key. I figure with a 30x30 grid I will have to have 900 locations even if it is an empty square. I plan random encounters, less during the day more at night. I am guessing that the locations will have to be in an array. That is a lot of typing and figuring. Is there an easier and better way?

I want to design a time system (night and day), a money and banking system NPC's a party system, inn's/tavern's,casino, inventory system, magic system, character creation system.

I am actually thinking of the map being an all gray screen and as the player moves it takes out the gray and places a black square there. This would be a road or path square, building squares would be another color. This way the player might not have to use graph paper and map the levels. Not sure yet. I played a game like this years ago called phantasia. Thought it was very cool. I am an old Commodore 64 guy. My first computer!

Any ideas on setting up the maps, (array's or other) or any ideas on the in game systems or anything else are more than welcome!!!

Thanks
Dragonslayer
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 26th Oct 2012 19:20
The most straight forward way of making a map is, you guessed it, use arrays. To make it easier, use arrays in combination with UDTs:



I suggest using constants to save the type of each tile. For example:



So for example, if you wanted to have a dirt tile at position 14,8, you'd do:



Rendering your map is done something along the lines of this:



I suggest rendering the map to an image, and then drawing that image to the screen instead of rendering it directly to the screen. 900 tiles can get pretty slow. You'd only have to update the image whenever the player moves.

Collision detection is pretty straight forward as well. Something like:



Inventories can be handled with arrays as well.

Money system can be added to the player's UDT:



Night/day can be handled by a world UDT.

Magic can be handled with an array as well. Basically just a list of abilities with different strengths etc. stored in each index.

TheComet

- The codebase
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 26th Oct 2012 20:09
That is pretty much how I saw things in my head. The collision routine and keeping the player on the map was something I did not really give more than a very quick passing thought to. You made it pretty clear! Thanks.

One thing I am not to clear on is the image thing. If it is a total text game I don't think I really want an image of the map on screen.
Something is in my head about this but I just can't get it out. Also for the case/end case code, is that a case/end case for every tile on the map?

Thanks
Dragonslayer
Mr909
14
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 26th Oct 2012 20:35
Well, for the exploration feature you mentioned (Map "clears up" as the player proceeds) what you want to do is draw a box of the color, not an image. So when he said "draw", he did just mean a colored box. Here's the function I use, it may or may not be your style.



It's just a modified BOX designed to draw only using one point.
However, you'll need to add data as to whether or not that space was explored. Since there are only two possibilities (it is or it isn't) I'd use a boolean.



Whenever they move into a square, set that square's is_explored to 1.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 26th Oct 2012 21:41
No, what I meant was draw to an image and render the image to the screen.

This runs at 134 fps:



This runs at 896 fps:



You only have to call render_to_image( img ) when you update the map, and if you play your cards right, you won't ever have to update it unless you load a new map, or the map data changes for some reason.

BTW, the render_to_image( img ) function is ridiculously slow. If you did it with memblocks (just ask me if you need something like that), it would be a lot faster. But I don't think you'll need it.

TheComet

- The codebase
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 26th Oct 2012 22:00
Ok that is only if I make the map open up when player moves. Don't know if I will do this or just totally text but now I understand the image thing.

If one runs at 134 fps and the other is 896 Isn't either one a great frame rate? There ae people in FPSC struggling to get anything over 40 fps

Dragonslayer
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 26th Oct 2012 23:44
There is no difference between rendering text to an image, or rendering it directly to the screen.

With 2D games, static things are always rendered to an image first. You have a map of 30*30 now, but what happens if you want to expand to, say, 200*200? You can do the speed test again with a map that size and see what a huge difference that makes.

Things that move are rendered directly to the screen. Your player for example, or enemies. The map image is drawn first and then you populate it with moving things on top.

Go and look up any 2D top down game and you'll find they all do it that way.

TheComet

- The codebase
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 26th Oct 2012 23:50
Neither is a fantastic frame rate for doing nothing but rendering some very simple 2D. They run at 400 frames per second for the first example and almost 5000 frames per second for the second example for me so, as you can see, it is very hardware dependent.

Regardless, even if you're happy with both frame rates, when it is little to no extra work, you should always go with the option that gives you more efficiency, especially when it is such a huge difference as in this example. Firstly, it means your game will run at decent speeds for a larger range of computers and, secondly, further down the line you may want to add more features which will slow the game down but, because you optimised earlier on, you'll be able to add them and and still have good speeds.


Previously TEH_CODERER.
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 27th Oct 2012 00:15
Comet
Maybe we are not understanding each other. Are you thinking that I am going to do a 2D game? I was thinking of that as an option. I am really considering doing a text only game like this!

Your starting point is in some building what do you want to do
1. some option
2. some option
3. some option
4. leave building (this is picked)

You are in a street facing east (so they can get a starting direction for mapping) what do you want to do?
1. move forward
2. turn left
3. turn right
4. turn around and go back into building

I can understand how what you are saying would be for 2D top down program. If I understand right my map in a text game is going to be an array of locations

Dragonslaye
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Oct 2012 00:31
Quote: "I can understand how what you are saying would be for 2D top down program. If I understand right my map in a text game is going to be an array of locations"


It appears we weren't on the same page. I thought you wanted to actually display the map graphically.

Well in that case, using a 1 dimensional array to store each location is fine. Everything I said up to the rendering part is still valid.

TheComet

- The codebase
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 27th Oct 2012 00:46
Cool, the 2D thing was and still is a thought, an option.

dragonslayer
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th Oct 2012 09:08
This thread got me thinking about 2D now...

Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 27th Oct 2012 15:06
Got me thinking about a lot
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 27th Oct 2012 16:01
Andrew

I understand and will always do whatever speeds up things if I know how. I am pretty new to programming and have a lot to learn.
hclayton
15
Years of Service
User Offline
Joined: 13th Nov 2010
Location: US
Posted: 2nd Nov 2012 23:35
Don't know if these will help, but they are from the newcomer forum.

Tutorial: Create Zork by pluto
http://forum.thegamecreators.com/?m=forum_view&t=129931&b=7



Tutorial: A simple structure for a text adventure by bmaczero
http://forum.thegamecreators.com/?m=forum_view&t=129766&b=7&p=0
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 3rd Nov 2012 19:11
Hclayton

I have been looking at that zork tutorial. It is in the DBP guide by nickydude. I will be checking out that other one right away.

I have a plan, not a game. The map in my game has around 900 locations. I am going to make a small map, 16 locations. 8 will be street locations and 8 buildings, basically a street. This is what I am going to do to learn some things. first I will hash out the movement and location and directions details. Then I will start working on the building. They will have a function in a game, such as an inn, shop bank etc... I will then work on inventory system, create character system etc...

Dragonslayer
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 3rd Nov 2012 19:27
Hi Dragon slayer

Do you want to create a text adventure with a text parser?

such as

The Hobbit

http://www.youtube.com/watch?v=XJ9LuK5Tcgg

where you type commands such as

GET KEY

UNLOCK DOOR

ATTACK DRAGON

GO NORTH

etc etc

Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 3rd Nov 2012 20:14
I am not sure yet, I was thinking of an options game. I played an old rpg about 25 years that was great and it was options.

You have come upon 3 skeletons and 2 magic users do you?
a attack
r run
h hide
u use item
m use magic

I played that game for hours a day for months. I like the idea of a parser game though so I am not sure yet. That thing I am going to do in the above post is not a game but something very small just to learn more about programming. It will be so small that maybe I can code it each way just to learn both ways.

I am at this moment reading a tutorial that talks about both ways and the parser way takes longer and may frustrate the player quicker and is a little harder to program since you have to come up with the keywords.

the tutorial says you can't hide things from the player in the options game but you can make them hard to get such as locked rooms where locks need to be picked or traps that need to be cleared etc...

Dragonslayer

Login to post a reply

Server time is: 2026-07-10 22:43:56
Your offset time is: 2026-07-10 22:43:56