cli345

joined 1 year ago
 

Hello, ๐Ÿ™‚

I created a new language called FuncSug. Its purpose is to make GUI programming in the browser easier and so game programming. The facility consists on eliminating asynchronism: In FuncSug, the code is no longer managed by an implicit/explicit global loop (I don't speak about implementation).

I intend, if I have time, to implement it for Godot as well. In FuncSug, the first tutorial of Godot would be roughly coded as this:

func showMessage(p_message):
	parallel exitWith branch 2 ||
		showIn(p_message, $MessageLabel)
	||
		waitSeconds(2)

parallel ||
	while true:
		# Start of game
		parallel exitWith branch 2 ||
			showMessage('Dodge the\nCreeps')
		||
			waitSeconds(1)
			awaitPressed($StartButton)
		get_tree().call_group(&"mobs", &"queue_free")
		score := 0
		$Player.start($StartPosition.position)
		
		# Middle of game
		parallel exitWith branch 1 ||
			awaitSignal('hit')
		||
			while true:
				playSoundFile('House In a Forest Loop.ogg')
		||
			showMessage('Get Ready')
			parallel ||
				while true:
					waitSeconds(1)
					score += 1
			||
				while true:
					waitSeconds(0.5)
					callgd spawnMob()
		
		# End of game
		parallel ||
			showMessage('Game Over')
		||
			playSoundFile('gameover.wav')
||
	while true:
		await score
		$ScoreLabel.text := score

The 'player.gd' and 'mob.gd' files would be keeped as they are. The "_on_MobTimer_timeout" function would be renamed as "spawnMob" and moved to 'mob.gd'. The timers wouldn't be needed any more.

Can you tell me what you think about it?

cross-posted from: https://programming.dev/post/26509534

[โ€“] cli345 2 points 1 day ago

Thank you for your kind wish! ๐Ÿ™‚

[โ€“] cli345 2 points 1 day ago

Thanks ๐Ÿ™‚

[โ€“] cli345 2 points 1 day ago

Here, for example, is how the showMessage function would work:

  • $MessageLabel is a field defined by the programmer in Godot.
  • The showIn(p_message, p_place) function shows the message p_message in the field p_place.
  • waitSeconds(2) waits 2 seconds.
  • When the 2 seconds are elapsed, the second branch waitSeconds(2) is finished and so the parallel block is exited (because of exitWith branch 2) and the other branch (the first one) is definitely interrupted (because my parallel exitWith branch N does so).
  • The interruption of the first branch showIn(p_message, $MessageLabel) makes the $MessageLabel invisible.
[โ€“] cli345 1 points 1 day ago

Yes, it's very different from what is done in G'MIC. Here, the language is preferably adapted to user interactions. There aren't many in G'MIC. ๐Ÿ™‚

[โ€“] cli345 2 points 1 day ago (2 children)

Yes, that's why I hope others will be able to join me. In the meantime, you can try FuncSug in the Playground. ๐Ÿ™‚

11
submitted 1 day ago* (last edited 1 day ago) by cli345 to c/gamedev
 

Hello, ๐Ÿ™‚

I created a new language called FuncSug. Its purpose is to make GUI programming in the browser easier and so game programming. The facility consists on eliminating asynchronism: In FuncSug, the code is no longer managed by an implicit/explicit global loop (I don't speak about implementation).

I intend, if I have time, to implement it for Godot as well. In FuncSug, the first tutorial of Godot would be roughly coded as this:

func showMessage(p_message):
	parallel exitWith branch 2 ||
		showIn(p_message, $MessageLabel)
	||
		waitSeconds(2)

parallel ||
	while true:
		# Start of game
		parallel exitWith branch 2 ||
			showMessage('Dodge the\nCreeps')
		||
			waitSeconds(1)
			awaitPressed($StartButton)
		get_tree().call_group(&"mobs", &"queue_free")
		score := 0
		$Player.start($StartPosition.position)
		
		# Middle of game
		parallel exitWith branch 1 ||
			awaitSignal('hit')
		||
			while true:
				playSoundFile('House In a Forest Loop.ogg')
		||
			showMessage('Get Ready')
			parallel ||
				while true:
					waitSeconds(1)
					score += 1
			||
				while true:
					waitSeconds(0.5)
					callgd spawnMob()
		
		# End of game
		parallel ||
			showMessage('Game Over')
		||
			playSoundFile('gameover.wav')
||
	while true:
		await score
		$ScoreLabel.text := score

The 'player.gd' and 'mob.gd' files would be keeped as they are. The "_on_MobTimer_timeout" function would be renamed as "spawnMob" and moved to 'mob.gd'. The timers wouldn't be needed any more.

Can you tell me what you think about it?

[โ€“] cli345 1 points 6 days ago

Thank you, Kissaki, for the crossposting :)

[โ€“] cli345 1 points 6 days ago

Thank you for your very useful feedback :)

A native representation of HTML tags is a good idea: I'll have to do that.

For ...---, I wanted a big split symbol between branches (||========) and a small split symbol between the two steps inside a branch (...---). ... because the branch continues and --- to mark a smaller split than ==========.

I intend to add a syntaxic sugar for:

parallel(select N) ||
||==============
	myFunction(arg1,...,argM)
...--------
	restOfBranch1
||=============
	myFunction(arg1b,...,argMb)
...-------
	restOfBranch2

that would be:

choose N by myFunction
	* arg1,...,argM
		restOfBranch1
	* arg1b,...,argMb
		restOfBranch2
[โ€“] cli345 2 points 1 week ago

Thank you for your feedback, which lets me know that you enjoyed the playground. :)

[โ€“] cli345 2 points 1 week ago (2 children)

Thank you! I look forward to hearing your opinion.

 

Hi, I made FuncSug to make GUI programming in the browser easier. It's a new language that aims to enable a clearer and easier code structure.

Can you tell me what you think about it?

 

Hello, I made a new programming language called FuncSug. Its purpose is to make GUI programming in the browser easier.

Can you tell me what you think about it?

[โ€“] cli345 2 points 10 months ago

Thank you very much for your feedback. ๐Ÿ™‚

 

This is just a very naive execution model for concurrency.

What do you think about it?