Maze Raider - The aMAZEing code a game comp entry

Started by Derron, September 02, 2018, 13:45:09

Previous topic - Next topic

Derron

#45
Still fiddling with the button not emitting signals ... but layed that aside and tried to come up with some "GUI" and "HUD" stuff.

Trying for half an hour now to use a sprite atlas as source for a ninepatch rectangle. I mean... for me it is obvious to have HUD/GUI sprites designed on a single image. So best thing is to just set up the coordinates/dimensions for such a sprite in the editor and then use this sprite for whatever I want it. Right? But seems Godot is (again) not capable of doing a specific thing. You can save the sprite you configured "on" your sprite atlas. But once you want to use this sprite as source for a ninepatch rect - it uses the whole image again. Seems as if "coordinates" are absolute and not "sprite relative" (which would allow usage out of a spritesheet/atlas). As the ninepatch thing configures as "left col width, right col width, top row height, bottom row height" you even cannot trick around (eg. one could define top left x,y,w,h, top x,y,w,h, top right x,y,w,h ... and voila, no trouble).

Means at the end I need to cut my spritesheed by hand/tool just to make it work "somehow" in Godot. Editing a bit within the GUI? Cut it again afterwards ... WOW, such a timesaver, not!

I see limitations all around the corners and it feels more and more as if I used a Flash-game designer-toolkit.
Nonetheless I am aware that there are surely some other options to achieve what I want in Godot - but hell, it is hard to find solutions within minutes - I do not want to search the internet everytime I want to use a feature I just _expect_ from a toolkit like Godot. Regarding 9patch: in my DIG-Framework it is not a big portion of code enabling what I described above and source of my ninepatches can be single images or spritesheets - did not try animations yet but it is the same: another sprite on the sheet which gets cut into 9 pieces.



Edit: Aeeehm... whatever. Did not change anything but now - it works as expected. At least a "NinePatchRect" can now use a portion of a SpriteAtlas. TextureButton still does not handle the 9 patch button (means: no scaling). Maybe it has some caching issues, I just checked and unchecked a box and resized the button - and the ninepatch "snapped" in - instead of using the whole texture it now properly uses the small sprite. I do not know what to say - such "bugs" are annoying as you now never know: is this a bug in the editor, or is this feature in the engine bugged? grrr.
And as it is surely not reproduceable I even cannot file an issue.
So for now I would need to code my own "Button" behaviour on top of a ninepatch sprite.
I think it is not worth the hassle, as this also means for "nine-patch stuff" I need to code my own "progress bar", "input" ... and the likes.


Fighting a "bug": 30 minutes
Crying about it in the syntaxbomb forums: 10 minutes
Lost time of my lunch break: 40 minutes in total

Mphhhf!

bye
Ron

Matty

So...would you use this godot thing by choice for a project that was your own free choice normally? Or is this just a learning experience?

Derron

I want to use it (or Unity) to try out more things than just BlitzMax for "game/tools", Java for "applications at work" (some android stuff) or php/mysql/jscript when it comes to websites.

There must be a reason so many use Unity for games - and especially for "3D" there seems to be no convenient solution for BlitzMax - if you are, like me, an absolute beginner when it comes to 3D games programming (while I have ~20 years of "amateur experience" in 3D software).
Godot is open source - which I favor - so I thought I will try it first (instead of Unity). Thought that it will surely provide what my "simple games" will need.

So - yes - for this competition I wanted to try out something new, Godot. I always aim to learn something new with these competitions (eg. in Blender: better texture painting, workflows for 3D assets from 3d tool to 3d engine). I am pretty sure that other "similar" games (tile/gridmap based things) will be easier to code in Godot for me from now on and so it is a potential software for other little games. As said I am surely most often fighting myself instead of (the software) Godot.



bye
Ron

Derron

#48
OK, fixed that "buttons do not react to clicks": my screen transition element(which is on a layer on top of the game) contained a "TextureRect" which overlayed everything. This "TextureRect" is not a simple "texture rectangle" but here in Godot it is extending "control". Controls are there for GUI/HUD stuff - which means it seems to listen to mouse/input interaction. I needed to set mouse interaction to "ignore" and voila... it goes "through".


Editor screenshots:




(as you see - with ninepatch I need to handle my own "normal/hovered/pressed"-visual representation stuff)


Lol: seems syntaxbomb and Godot use the same gray tone... :-)


Ok, family will arrive soon, so coding for today seems to be done. At least a "issue" solved.


bye
Ron

Qube

QuoteLol: seems syntaxbomb and Godot use the same gray tone... :-)
Huh! that's pretty weird :P
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Steve Elliott

#50
What person in their right mind designs a coding theme with a bright white background and black text?!  #eyestrain.  Dark Theme all the way for me!
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Derron

Odd behaviour of today?
I added some "spawn creature triggers" (will get replaced with sarkophags or so). They spawn creatures at the given grid.

To do this you have to:
- create an instance of the creature object (in Godot: "scene")
- move it to the desired position (set/adjust translation of the instance)
- add it to the node tree (so it gets rendered)


This is exactly what I do - so translation is done right before it gets added to the node, aka it is moved before it can get rendered. But still added ones are first rendered at "0,0,0"  and are then moved/"snapped" to their target position.
I also "debug printed" some stuff - and it claimed to have set translation as I wanted it to do.



func AddUnit(unitID, col=-1, row=-1):
var unit = preload("res://Scenes/Creature.tscn").instance()
print("AddUnit: ", unit.get_name(),"  translation=", unit.translation)
if col == -1 or row == -1:
var tile = GetRandomWalkableMapTile()
if tile:
col = tile.col
row = tile.row
else:
print("no tile found")
if col == -1 or row == -1:
print("no free slot found")
if col == -1: col = 1 + randi() % (mapCols-2)
if row == -1: row = 1 + randi() % (mapRows-2)

unit.set_translation(Vector3(col * TILEMAP.TILE_SIZE, 0, row * TILEMAP.TILE_SIZE))
unit.RefreshGridPosition()

AddMapTileObject(col, row, GLOBAL.GROUP_HOSTILE_CREATURES, unit)
print("         -> grid=", unit.gridCol,",",unit.gridRow, "  translation=", unit.translation)
emit_signal("unit_add", unit, col ,row)
return unit


output was:

AddUnit: Creature  translation=(0, 0, 0)
         -> grid=6,2  translation=(12, 0, 4)


So as you see it correctly changed object's translation ... I even removed potentially interferences and really cut it down to:
- create instance, set translation, add to node tree
and it still ... has this annoying visual "jump". I must have missed something. grr.


bye
Ron

Matty

What if you set it to invisible for one frame first?

Derron

Yes, invisibility or having some kind of "getting added"-animation (scale up, fade in , ... whatever fits) was on my "circumvention list" already.

But I want to understand why it happens at all. It is not a threaded build - so I assume "adding + placement" is done straight each after another. I am pretty sure that I have done something somewhere (checkboxes, or similar) which I shouldn't.
I cannot see this happening for some other items (the collectible "yellow boxes" for now).

Will try to fix it at lunch.


bye
Ron

Derron

#54
While on initialization of such a spawned item an:
visible = false
yield("0.05 second"-timer, "timeout")
visible = oldVisible

"covers" the initial bug I tried a lot of stuff. It's not an attached script issue (replaced the script of the creatures with that of the collectibles). Thought maybe physics are the culprit (I have a particly system attached to the creatures but not the collectibles). Seems not to be the issue too.
Argh...
Ok, so leaving on the "invisible"-fix for now.


Meanwhile I got another issue: when the player dies it actually does a "StartDying()" and a "FinishDying()" (so I could play animations properly - or just extend whatever happens in that moments in extending types/classes).
When tween for "dying" (swirl, scale to "up to zero") ends, a signal is emitted automatically (inbuilt signal) - "tween_completed". For exactly one time a single listener to listen to this signal is registered (I print out a "connected to signal" right below the connection-establishing - and this line is only printed once). I also gave the "to call" method/callback a unique name so that other scripts might not interfer. When I start the tweening process I also print out a debug message - which is also only printed once.
Ok ... so guess what happens? This signal listener is called twice in a row. How can this be ... ? For now I could fix that by only reacting if a certain flag is set.

I feel a bit lost by fighting all these little annoyancies.


bye
Ron

Derron

#55
Grr.. ok, that signal issue is ... I would call it not a bug but a missing feature.. in a "Tween" node you can chain up multiple individual tweens (eg. one for location, another for scale and a third for rotation).

Tween (as of now) emits a "tween_completed" signal for _each_ of these individual tweens - but none for "finished with everything".

This is the reason why I received the signal multiple times. Means I need to take care for myself how many "individual tweens" are stored within one big "Tween node" (and subtract then for each finished - only reacting then if the last one finishs). Annoyance!


Edit: seems in v3.1 this _will_ be fixed in a way that "tween.is_active()" returns false once all tweens finished. A pity that I am at the latest release: v3.0.6.

bye
Ron

Qube

Sounds like Godot is as much a WIP as your game :o - Keep plodding on though and finish :)
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Derron

Yes I will try. So this weekend was/will be short (next family party - big families need multiple parties to get all under one roof ;-)) but at least I got some basic:
- start menu (needs some more love put into design ...)
- player can die (burn baby burn!)
- game over notification
- score notification
- basic HUD elements/icons

plenty to tryout/do:
- open final door/reveal final treasure to fetch/ ... once you collected all requested elements
- add music
- add sfx
- create player / enemies / collectibles + animations for walking/raise from the grave/ ...
- create difficulties (more enemies, more traps ...)
- decorations for the level (make it look "nicer")

pheww. At least some of this stuff is done in Blender so should create _less_ trouble ;-)


bye
Ron

Qube

OMG! looks like you've an arse load still to do :o - Better ring the family and tell them to stop visiting so you can finish it off ;D
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Derron

Lunch time used to create some simple tiles:
- door with border and stairs
- some ground tiles to potentially cover objects going below "ground" (eg. stairs or moving-down-doors at the bottom of the level)
- sarkophag (including simple "open" animation)
- painted backsides of the walls :-)




Let's see if this evening offers me some spare time or not. Wifey time can be everyday so ... surprise surprise.

bye
Ron