Random Nikos questions

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:smile: :sad: :eek: :shock: :cool: :-x :razz: :oops: :evil: :twisted: :wink: :idea: :arrow: :neutral: :mrgreen:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Random Nikos questions

Re: Random Nikos questions

by Roody_Yogurt » Sat Mar 28, 2020 12:42 pm

Op code stuff isn't fully functional on the last uploaded Roodylib. Robb, I'll have to get you something more recent directly or when I upload the newer code.

Re: Random Nikos questions

by RealNC » Sat Mar 28, 2020 2:23 am

There is no version released on that date. So I don't know what you have. Version 2.2 is the latest one and released on Apr 6, 2019:

https://github.com/realnc/hugor/releases/latest

Re: Random Nikos questions

by Ice Cream Jonsey » Fri Mar 27, 2020 2:31 pm

I ran a RoodyLib routine called OpCodeAudit and it looks like the Windows version of Hugor I have from October 25, 2019 only supports the first opcode, "IS_OPCODE_AVAILABLE". Does that sound right? Should I be on a later version of Hugor?

by Ice Cream Jonsey » Mon Sep 12, 2016 10:37 pm

Okay, I think the other thing I need to do is use this version of Hugor going forward, and also put the documentation somewhere.

I'll get us organized.

by Roody_Yogurt » Sat Apr 23, 2016 7:13 am

For the benefit of anyone watching this thread, it turned out that in the case of the transition that was bothering me, I had multiple fades going on and it gave the impression it wasn't fading correctly (and I wasn't fading out quick enough).

Tweaking my code fixed the problem.

by Roody_Yogurt » Thu Apr 21, 2016 4:34 am

I'll send the code after work today.
RealNC wrote:You should do a blocking fade out, update the screen, then do a blocking fade in.
The reason I avoided that was just in case the game throws up enough text to have a MORE prompt (or some other instance that holds up the game), I didn't want the player to be caught with a dark screen.

by RealNC » Wed Apr 20, 2016 10:01 pm

Hm, it should work for the entire game area. Can you send me the modified version of the game? It would make it easier for me if I don't have to code the test cases in Hugo myself.

An explicit fade-to color and timing parameter should be doable. Although that sounds wrong for your use case. You should do a blocking fade out, update the screen, then do a blocking fade in.

by Roody_Yogurt » Tue Apr 19, 2016 6:49 pm

Tonight I was testing the fade opcode with Guilty Bastards, trying to put together a version with cool fades between rooms and such.

As far as I can tell, fading only affects the current window, eh? Would it be possible to add a fullscreen version that only works off fading in and out of black (as opposed to the current background color)?

Also, for unblocked fades, would it be possible to have an additional time argument that is a wait time before the fade is even begun? Ideally, I'd like to draw some of the screen while it's dark and then fade in to everything already being there.

by Roody_Yogurt » Sat Apr 02, 2016 9:41 pm

RealNC wrote: Typo. You get this back:

30 8888 4 11 22 33 44
As of right now, I have the debugging opcode monitor produce text like this:
[unrecognized opcode 5 attempted]
[unrecognized opcode 10 attempted with 3 arguments (1,2,3)]

by RealNC » Sat Apr 02, 2016 12:50 am

This falls outside the scope of Hugor. It's a Hugo engine front-end (not even an engine implementation; it uses the official engine under the hood.)

Most importantly, it's not a Hugo compiler. Removing the 16-bit limits cannot be done in the front-end or even the engine.

by Tdarcos » Sat Apr 02, 2016 12:07 am

RealNC wrote:Ah, yes. Any sufficiently advanced technology is indistinguishable from magic.

Now, multithreading is not really "sufficiently advanced technology", but let's pretend ;-)
I actually use that line in my book, it's
"Any sufficiently advanced technology is indistinguishable from magic."
- Arthur C. Clarke
"If it is distinguishable, it's not sufficiently advanced."
- Anonymous

Something I thought about with respect to Hugo, can we create a different file format so that the interpreter can be bumped up from 16-bit to 64-bit? So that an older 16-bit application would work but the new format would support more advanced features, such as

* 64-bit integers
* support for floating point (I have this memory of it not allowing it or not providing it)
* 1024 properties, up from 128
* object numbers are 64 bit or perhaps 32bit, possibly signed
* fixing some of the default assumptions in the compiler, so a reference in a room to a string as a destination means you want to print the string and not go there, not attempt to enter the string as if it was a room (possibly make constant objects have a negative number or something to distinguish them from enterable objects) the current behavior in the compiler makes no sense as there really no reason to do it that way
* True string support at least as good as Basic had back in the late 1970s
* Unicode support to encourage use in other non-latin-based character sets
* Support for displaying text right-to-left
* More system functions to support more of the machine's functionality
* Test capability so a program can query the interpreter to determine what's available on this machine

I am thinkling; Hugo can be more than just a game system, it could be used to support any text-based command system or application where the user clicks on things to select them, which might be useful for computer-assisted- / computer-based- instruction and for giving tests.

by RealNC » Fri Apr 01, 2016 8:36 am

RealNC wrote:For example, if you try to execute:

8888 11 22 33 44

What you get back is:

30 4 11 22 33 44
Typo. You get this back:

30 8888 4 11 22 33 44

by RealNC » Fri Apr 01, 2016 8:31 am

I added IS_MUSIC_PLAYING (800) and IS_SAMPLE_PLAYING (900). They return either false or true.

Also, when an opcode is not recognized, UNKNOWN_OPCODE (30) is returned, followed by the amount of parameters passed, followed by the parameters. For example, if you try to execute:

8888 11 22 33 44

What you get back is:

30 4 11 22 33 44

You can ignore this of course. It's there in case you want to print detailed debug information about what was actually passed to the interpreter that causes the error.

New build in the same URL.

by Roody_Yogurt » Fri Apr 01, 2016 1:05 am

Done!

by RealNC » Thu Mar 31, 2016 10:01 pm

I'd recommend using -9999 for the default start_opacity property value (-1 won't work due to the negative numbers bug) and true for the default block value, as these are the common values everyone would want by default.

by Roody_Yogurt » Thu Mar 31, 2016 11:23 am

Oh, since that last opcode example doesn't show how "save_info" is used, here's another opcode:

Code: Select all

opcode getversion "hugor version opcode"
{
	in hugor
	opcode_value 100
	save_info
	{
		hugor.version = readval
		hugor.version #2 = readval
		hugor.version #3 = readval
	}
}
Anyhow, for the most part, not even authors will have to worry about this, as they'll just be doing stuff like:

ExecOpcode(getversion)
ExecOpcode(clipboard, "copy this to clipbloard")
ExecOpcode(open_URL, "http://www.google.com")
ExecOpcode(full_opacity)
ExecOpcode(fullscreen)

by Roody_Yogurt » Thu Mar 31, 2016 11:13 am

So, I've implemented the opcode stuff into Roodylib as an object-based system with a feeder routine. Admittedly, it's kind of wasteful to not use constants for the opcode values, but since Hugo has a hard limit of constants that can be defined (and, as it is, the Hugo library and Roodylib already use up like half of them), I just want to always leave a bunch open in case people need them for their games for readability.

I've also felt a little guilty about how Roodylib often requires people to raise their routine max limit so I wanted to keep the routine numbers down (I'm actually in the process of reorganizing some other parts of Roodylib now, too).

When a game starts or is restored, Roodylib checks to see if Hugor is being used. If it is, it sets a hugor object as switchedon (and if not, clears it). This gives authors an easy way to tell if Hugor is being used at any point. At the same place, it also saves the version and port info to the following properties:

Code: Select all

object hugor "Hugor interpreter monitor"
{
	os 0
	version 0 0 0
	type settings
}
I've added Hugor version printing to the default game banner, so an author and player can see it in effect as soon as he starts a game:
GAME TITLE
Copyright 2016 by YOUR NAME
Hugo v3.1 / Library 31031 / Roodylib 4.1.2 / Hugor v1.0.99
Release 1.0 / Serial Number 033116
(New players type "INFO")
I don't include the OS there just because I figure it's not needed, but I do add it the beginning of beta transcripts:
This is a beta release! If you'd like to start a transcript right away, press B. Otherwise, push any other key to begin without starting a transcript.

Starting beta transcript for GAME TITLE (Hugor v1.0.99 Windows)
Here is the routine for running opcode files:

Code: Select all

routine ExecOpcode(op_file,str)
{
	if op_file.type ~= opcode
	{
#ifset DEBUG
		if debug_flags & D_OPCODE_MONITOR
		{
			print "[ExecOpcode run with non-opcode type object
			\""; op_file.name;"\"]"
		}
#endif
		return
	}
	writefile "HrCtlAPI"
	{
		writeval op_file.opcode_value
		if str
			writeval str
		if &op_file.execute
			run op_file.execute
	}
	local failure
	readfile "HrCtlAPI"
	{
		failure = readval
		if failure
		{
#ifset DEBUG
			if debug_flags & D_OPCODE_MONITOR
			{
				select failure
					case 10 : print "[Incorrect number of parameters for \
					opcode "; op_file.name; " ["; number op_file;"]"
					case 20 : print "[Hugor returned unexpected byte count \
					for opcode "; op_file.name; " ["; number op_file;"]"
			}
#endif
			return failure
		}
#ifset DEBUG
		if debug_flags & D_OPCODE_MONITOR
			print "[\""; op_file.name;"\" success.]"
#endif
		if &op_file.save_info
			run op_file.save_info
	}
	return
}
I may have to add more string arguments at some point, as I imagine the color-changing opcode might take at least a couple. Just the same, I think it's mostly set up to handle whatever an opcode needs.

Here is an example opcode file:

Code: Select all

opcode fade_screen "hugor fade screen opcode"
{
	nearby
	opcode_value 400
	block 0
	duration 0
	start_opacity 0
	end_opacity 0
	execute
	{
		! This just checks to make sure that somebody didn't accidentally
		! run ExecOpcode on this class object as it would hide all text on
		! the screen
		if self = fade_screen
		{
#ifset DEBUG
			if debug_flags & D_OPCODE_MONITOR
			{
				print "[Do not execute opcode
				\""; self.name;"\" itself. Create a fade_screen
				object with timing and fade values you want. Fade canceled.]"
			}
#endif
			return
		}
		local start_alpha
		start_alpha = self.start_opacity
		if self.start_opacity = -1
			start_alpha = -9999
		writeval self.duration , start_alpha, self.end_opacity, self.block
	}
}
The fade opcode is a little different than the others since I set it up to be an object class, so authors can just define whatever kind of fades they want and use those repeatedly. Since I figured authors will have different preferences for how long fades should be, Roodylib only defines a "restore to full opacity" fade object:

Code: Select all

fade_screen full_opacity "restore full opacity opcode"
{
	in fade_screen
	block 1
	duration 1
	start_opacity 255
	end_opacity 255
}
Roodylib executes that at every game start or restore just to make sure Hugor's opacity is not caught in a suboptimal place (I might eventually add that to UNDOs, too, but I thought that scenario might need a little more finesse depending on what the author is trying to do).

by RealNC » Fri Mar 25, 2016 12:27 pm

Good ideas. Except for the realtime thingy :-P The opcode mechanism should be for optional stuff. Games should still run on the official terp without issues.

by Roody_Yogurt » Fri Mar 25, 2016 11:26 am

Awesome, yeah, that works for me.

I've got the opcode stuff all put into Roodylib, but I'm in the process of improving some other stuff and then I'll update the documentation for everything and put out some kind of release.

As far as the negative numbers bug from the other thread, I'll add it to the Hugo bug list at some point (i've somewhat gotten out of the habit of updating it):

http://develop.generalcoffee.com/hugo/trac/report/1

That list might also be a good source of inspiration for some other opcode ideas.

Anyhow, here are some opcode ideas I have:
  • an opcode for saying whether a song is currently
  • an opcode for changing default interpreter colors so authors have access to that whole range (ideally, it'd only affect the session- not permenantly changing the player's settings and there would also be an opcode for going back to the player's settings so we can allow players to turn off colors mid-game).
  • an opcode for "pseudo-real time" games. I imagine it working like, every minute without any input, it automatically sends a "Z." command. I personally don't have any interest in designing a real time game, but I know some others have wanted to do that in the past.
In other Hugor feature request news, I think it'd be cool if there were a command line option to the interpreter that spits out a configuration file with Hugor's current settings (or blank, but I figured the current settings makes more sense). I'm always kind of unsure if I've missed any updates to configuration file options and that'd be a good way to always be sure one has everything.

by RealNC » Wed Mar 23, 2016 5:13 pm

Roody_Yogurt wrote:the clipboard thing doesn't seem to work under Windows
Oops. Should now be fixed. Same URL.

Top