Quest for Advanced Users

magano
I have been using quest for a long time, although never tamper with the codes and tried any advanced functionalities of quest, even touching JS and CSS

I usually used the default view...

But is there a certain limit of what kind of text/turn based game quest can make? I wanted to test that out with my new project

The first part is a Racing Car implementation. For this, let's make it simple at first: auto-acceleration, auto-transmission. However, the gear change will be made realistic by implementing the gear change ratio. This raised 3 problems:
1. If you played a racing game, you'll notice that the car's acceleration lowered a bit on high RPM before recovering when the gear was shifted up. How to create such effect?
2. When the player types brake, the car will brake to a complete stop regardless of the current gear and acceleration at a decreasing rate until the speed is 0. How to do that?
3. How to use the ratio in the first place?
Let's say the ratio is:
1st 1.4377
2nd 1.2873
3rd 0.997
4th 0.725
5th 0.5119

The second part is a random but patterned event. Here's the image:
You picked out a number for the first rime and got 4
2nd time you got 1
3rd 3
4th 2
5th 6
6th 3
7th 5
And so on... Then you'll start to realize that it is the number from a dice (as the results fall between 1-6)
The other player wouldn't get the same number in sequence, but the number would always fall from 1-6

That system is good, but the system can be elevated (Bear with me)
I have a vault in a room
The vault's code is 437672
I also have a drawer (Something that draw a numbered card from 0-9)
The catch is that the code is hidden inside the cards drawed
Example:
A player might draw, in 20 tries: 37197265094376721653
And another player might draw: 91886509437672187308
See that the code is somewhat 'in between' a seemingly-random draws? How to do just that?

HegemonKhan
A racing game uses some basic array~grid math, so quest (and any coding engine) can create such a game:

road width: 10

| 0123456789 |

car width: 2

| 01 |

you'll need to use the 'for' Function for this, and etc...

it's a bit complicated, but if you can handle it, quest can certainly do it, hehe.

(though the game might be a bit boring+weird as a text game, without the graphics~sprites of the cars, explosions~crashes, the road~course, and etc)

---------

before you attempt a car game, first try to create the old 'you sunk my battleship' game with quest, as it is much more simple than a car game.

magano
For the battleship game, I made that before (using old version of Quest) but left unfinished (and I lost the file!)
For the Racing Implementation, here's the basics:

The player went out from a building (house, maybe?) and saw a car. You typed a command to enter the car (which I knew how). When you enter the car, Quest Timer will handle the acceleration (thus the speed) and when the player reached a certain distance (e.g. 500 m from the corner and this is determined by the car's braking power, remember distance = speed*time), the player must react quickly and type either left or right, depends on the corner or the player will crash. Player may enter 'brake' to slow down decision-making but it will require more time (there's a time target, of course). This will be repeated until the destination has been reached where the player must brake before reaching the destination (distance required depend on braking power) or the player will crash

If the player crashed from a speed of over 64km/h, Gane Over. If not, the player's HP will be reduced depending on the speed of crash

HegemonKhan
ya, my way is a little different, in that you'd need to 'hook' a 'left' key and 'right' key to a 'left' Command and 'right' Command, and you'd move the car left and right, to drive the road~coarse, as the road~coarse turns~moves. Making it play like a graphical car game, except you'd have text messages instead of the visual sprites graphics. In other words, the game would play more like you're reading dials and equipment such as in a tank or jet, and adjusting to them, rather than physically looking around with your own eyes.

------

your way is very creative~ingenius too. I've only read up on how to make a car game, in the way I described, I've not even dared to attempt to actually make such a game yet. I did a super basic battle ship game, as one of the lessons of the pyhton course on codecademy site.

magano
For my first trial of making that happen, HK, I wouldn't dare making that like a graphical car game for a while... Until I figured out the mechanisms on how to do just that. So there will be no lane changes, traffics, traffic lights, polices, and any complicated things you might be thinking of (won't go that far for now)

And there goes the hook
It's quite complicated to explain the mechanisms of the Racing part of the game (and so it's not fully the game) in texts, and I don't have access to my laptop to open Quest and make the game for you to understand, but let's just answer the 3 questions

By the way, the suggestions are highly appreciated. I'll consider that when making the full game of racing (similar to Need For Speed)
I also have a lot of advanced ideas (Like making a FPS game), but I'll hold it for now

One more try to explain~enlighten you:
---The car set off from 0km/h. Distance from the next left corner is 2773 m
(When the distance reached 2073m, with the car able to take corners 500m away. Current speed is 234km/h)
---The corner is 700m away. You need to take a turn or you will crash
(0.2/234 = max Reaction + Typing time in hours needed to success. That's about 3 seconds)
>player type left before reaching 2273m (3 seconds)
---You drifted to the left and succeded
>player type any other before or after 2273m (3 seconds)
---You crashed. (if speed is more than 64) Game Over
(If less, you survived with HP depends on the speed

The Pixie
Quest has a few limitations as a coding language, most notably no arrays, but there are work-arounds so you can do pretty much anything. Where it gets tricky is the interface - how the game is displayed and especially how the user puts in commands.

The question is, why would you? For a racing car game, Use a more suitable language, JavaScript, for example, that can handle the player pressing A to go left and D to go right (in Quest, I guess you could use the compass). Computer languages are tools; use the one suitable for the job.

HegemonKhan
but... we love quest! ;)

ya, anyone can build the pyramids with modern machinery, instruments, materials, and computer models~calculators~calculations, but building the pyramids with a pick and cisel and etc simple tools (including for measurement, and having to do the math calculations yourself), and thinking up extremely creative~ingenius methods, that takes... something called... SKILL! ;)

using the best tool, requires the worst (no) skill

using the worst tool, requires the best skill

jaynabonne

using the worst tool, requires the best skill


Not to mention insanity! :lol:

magano
Yeah, Quest is beautiful and since I've been using it for quite a time, breaking the boundaries of Quest is deemed necessary... for unknown reason to myself :D

Anyway, back to the main topic, I'm really stuck in the gear ratio usage. How to use that ratio in the game is still under a lot of thinking to do and thus all 3 questions about the Racing Implementation

But my game isn't just about that. There's still some more to it, one of them is the random patterned event
Random functions have let me down as they can't produce a certain pattern, and I don't know how to implement the pattern into the drawer...

Read my first post to see what I meant

TM123
I kinda like the idea. I once made an XP "speedometer" for a MUD game. Whenever the XP updated, the value was put in an "acceleration bin" which was rapidly transferred at an exponentially decaying rate (0 to 2 million XP/hr in about 4 seconds) to the "current velocity bin" which exponentially decayed at a slow rate (2 million XP/hr to 0 in about a minute.) As the XP rate approached the maximum scale, the "speedometer" needle would begin to vibrate/oscillate slightly at first, then more and more wildly (a randomly fluctuated sinusoid) until, if the XP rate was high enough, it would spin ALL THE WAY AROUND! It had an XP-"odometer" which increased according to the indicated speedometer rate.

ANYWAY:

1. It sounds like you are saying a car engine's power to RPM ratio decreases at higher RPM. (I know a little about a lot of things, but not much about cars) If that's the case, I'd find some data on that and use a polynomial to approximate the curve. If you mean the car decelerates for a second or two as the gear shifts, this could be calculated according to the air friction (a function of the cube of the air velocity) and all the rest of the friction, which is linear.
2. If I remember correctly, sliding friction is a constant multiplied by the distance an object travels. I'm sure WIKIPEDIA has the equation. I think the deceleration comes out to be a simple thing, like a constant 10kph per hour per second.
3. multiplication.
random numbers with code: fill an array with 20 random digits. Pick a random starting point from 0 to 14. Put in the 6 digit code starting there.

If you want this to be a "real time" sort of thing, I think Quest timers only do 1 second intervals, which would mean you'd have a 1 "frame per second" rate.

Forgewright
This thread hurts my brain.... :lol:

TM123
Here's my racing game attempt. I haven't implemented steering yet. It wouldn't print multiple spaces so I used dots.

<!--Saved by Quest 5.6.5621.18142-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Car_Race">
<gameid>3c126979-2e96-4644-94fb-d2608439cac8</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<attr name="autodescription_youarein" type="int">0</attr>
<showlocation type="boolean">false</showlocation>
<showpanes type="boolean">false</showpanes>
<author>TM123</author>
<subtitle>commands: accelerate, decelerate</subtitle>
</game>
<object name="room1">
<inherit name="editor_room" />
<description><![CDATA[........./.....|....\..!......<br/>......../......|.....\........<br/>......./.......|......\.......<br/>....../.................\......<br/>...../.........|.........\..!...<br/>..../..........|..........\.....<br/>.../...........|...........\....<br/>../..........................\..<br/>./.............|..............\..! ]]></description>
<next>room2</next>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="room2">
<inherit name="editor_room" />
<description><![CDATA[........./..........\.........<br/>......../......|.....\..!.....<br/>......./.......|......\.......<br/>....../........|.......\.......<br/>...../...................\.....<br/>..../..........|..........\..!.<br/>.../...........|...........\...<br/>../............|............\..<br/>./............................\.]]></description>
<next>room3</next>
</object>
<object name="room3">
<inherit name="editor_room" />
<description><![CDATA[........./.....|....\ ........<br/>......../............\........<br/>......./.......|......\..!....<br/>....../........|.......\......<br/>...../.........|........\.....<br/>..../.....................\....<br/>.../...........|...........\..!<br/>../............|............\.. <br/>./.............|..............\. ]]></description>
<next>room4</next>
</object>
<object name="room4">
<inherit name="editor_room" />
<description><![CDATA[........./.....|....\........<br/>......../......|.....\.......<br/>......./...............\.......<br/>....../........|........\..!..<br/>...../.........|.........\.....<br/>..../..........|..........\....<br/>.../.......................\...<br/>../............|............\..!<br/>./.............|..............\. ]]></description>
<next>room1</next>
</object>
<command name="accelerate">
<pattern>accelerate</pattern>
<script>
EnableTimer (ticker)
</script>
</command>
<command name="decelerate">
<pattern>decelerate</pattern>
<script>
DisableTimer (ticker)
</script>
</command>
<timer name="ticker">
<interval>1</interval>
<enabled type="boolean">false</enabled>
<script>
ClearScreen
MoveObject (player, GetObject(game.pov.parent.next))
</script>
</timer>
</asl>

HegemonKhan
obviously I left out the presumably 'road barrier~graphical displayment' characters~symbols in the below

I presume you tried:

msg ("            " + VARIABLE + "            ")


so, maybe you have to do each individual space one at a time ... (annoying):

msg (" " + " " + " " + " " + " " + " " + " " + VARIABLE + " " + " " + " " + " " + " " + " " + " ")

TM123
Yah, I tried that. Apparently it puts together the final string then removes multiple spaces. This isn't good if you want to make poetry that wanders across the page.

magano
Right... Just got back to the forum and your idea, TM, is quite awesome

So can we do the math to find the power decay as the RPM went up using the gear ratio?
If you wanted to make the sample math for me, try using the example I gave on the very top

Help is always appreciated :)
I'll try the code later on when I'm on my laptop

TM123
magano wrote:So can we do the math to find the power decay as the RPM went up using the gear ratio?


The power decay would involve a lot of things, I imagine. So I figure the best thing to do is find out what that decay curve is and forget about why. I came across this chart showing power/RPM:
http://www.quora.com/What-happens-to-th ... cal-limits

I approximated the curve to within +/- 1% with this polynomial:
power = -27.332 + 60.463*x - 16.02*x^2 + 3.0876*x^3 - 0.2459*x^4

If you put MPH along the horizontal axis of the chart, the curve would shift to the left for a low gear, and to the right for a high gear. There's probably other stuff involved that I know nothing about. Hopefully the power produced remains a simple thing. From there you just plug the force (convert watts to newtons I think) and the opposing forces of friction into the proper physics equation to get acceleration. Probably everything can be found on wikipedia and hyperphysics.

magano
The thing is brilliant, used it already and it gave a good result
However, my 2nd question was not answered. How could you make a patterned, random event?

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums