Author Topic: Terror in the MAZE v20 (and newers)  (Read 1679 times)

0 Members and 1 Guest are viewing this topic.

Offline MasterGy

  • Forum Regular
  • Posts: 241
  • people lie, math never lies
Terror in the MAZE v20 (and newers)
« on: April 21, 2021, 01:45:17 PM »
Hello !
I opened a new post for the game because there is orders of magnitude more in the game than ever before. Also, because some of those who tried it didn’t look at the last link, but instead corrected and updated the first one in the post. From now on, if I update, the link will only be in one place, only here, in this section. Also because it’s not a “hibernate”. I didn’t write the latter elements in 4 dimensions, that part of the thing became uninteresting.
I didn’t make a video of the game because I didn’t want to cover up the game’s solution. Get started and only one thing is important: get out of the maze!
How do the gates open? What does the fairy do?
The controls are simple: WASD, mouse left shoot, right mouse button, you can develop a strong fireball.
From now on, I will want main enemies (witch, devil, fire-killing dragon) that will be activated when each gate is opened and will be orders of magnitude stronger than these little enemies.
I want you to describe how easy it was to figure out how to get out. What is the strategy? What bugs do you find?

download v39
https://drive.google.com/file/d/1K9MZO5uTnOFb0IG83gBRXjy0UF-HBlJu/view?usp=sharing


« Last Edit: May 12, 2021, 03:21:37 AM by MasterGy »

Offline Galleon

  • QB64 Developer
  • Newbie
  • Posts: 21
Re: Terror in the MAZE v20 (and newers)
« Reply #1 on: April 22, 2021, 12:22:18 AM »
I genuinely enjoyed playing your game.

Here are my thoughts:
* I suggest not including exe files when sharing games on the QB64 forum because an .exe file can contain a virus. Or provide 2 separate downloads (one which is the exe version and one which is the source)
* Don't split your game across 2 bas files if you can avoid it (I had to build each one separately)
* Consider using partial transparency on the maze windows (but this is hard because to do it well you will need to draw all objects in order of distance)
* Use lower resolution textures for far away objects (this is called mipmapping)
* It's not obvious what to do when you get to a gate, I went looking for a red key-card...
* Not obvious that you can charge up your weapon with right mouse and that a charge attack will break a gate, and sometimes it glitches and doesn't fully charge
* 3D navigation system - At first glance this is a 3D maze with no up/down orientation, but that is not the way the player rotates - I suggest a proper 3D orientation system which supports turning on all 3 axes. It can be annoying when you are trying to turn (what you believe is) right and the player spins/rolls
* If it was not for the fairy I would probably have given up, and when I couldn't see her I just moved around randomly
« Last Edit: April 22, 2021, 02:06:20 AM by Galleon »

Offline Galleon

  • QB64 Developer
  • Newbie
  • Posts: 21
Re: Terror in the MAZE v20 (and newers)
« Reply #2 on: April 22, 2021, 02:48:35 AM »
Here it is also with the ordering of the textures so the semi-transparent windows don't block the drawing of things behind them. I used a (slow, but didn't notice the difference on my comp) bubble sort for sorting the triangles but in theory as this is grid-based you should be able to come up with a much better way of drawing them in order.
*** updated to v3 which has some fixes ***
*** I am aware that some game-logic (being hit by enemies for example) has been broken by reordering of parts of code so if you want the proper game experience best play the one MasterGy shared. Treat this more as an example of how you might use mipmaps and transparency ***
« Last Edit: April 22, 2021, 04:04:52 AM by Galleon »

Offline MasterGy

  • Forum Regular
  • Posts: 241
  • people lie, math never lies
Re: Terror in the MAZE v20 (and newers)
« Reply #3 on: April 22, 2021, 01:28:56 PM »
Hi Galleon!
As I mixed the concrete today and looked at the forum over the phone, I saw that something had happened. I couldn’t wait to get home and watch the game, I saw in the screenshot that it was really good!
What you did is huge! On the one hand, because you analyzed and modified my code according to your idea! Seeing other people's thinking and code is a huge intelligence, mainly because I barely write a comment. The other is that you took the time! This is an even bigger thing! And the result is huge! I recommend everyone to try the GALLEON version as well! For now, unfortunately, I don’t even understand how I can make a texture transparent. I wanted the cube to have a window glass effect, but I wanted to leave that for later. You solved it! Elegantly, beautifully, the way I imagined. Thank you very much for that! I still have to understand the midmap and the glass-effect thing. unfortunately your conversion is running very slowly on my computer but it makes sense! good direction! worth dealing with! Display is very important! _maptriangle and friends. From this, the task must be solved. Thanks for the idea and for dealing with it!
Follow the fairy….
The right-mouse shot is also taken from the magazine on the right. If the magazine is not full, you will not be able to create 100 shot-energy fireballs. Before breaking through the wall, it’s worth checking this out as well as striving to make the magazine full. If there is little ammo in the magazine, it has an “R” button and reloads, just like in other fps games.

Offline Galleon

  • QB64 Developer
  • Newbie
  • Posts: 21
Re: Terror in the MAZE v20 (and newers)
« Reply #4 on: April 22, 2021, 11:08:44 PM »
I'm glad you like my graphical "enhancement" suggestions.
I recommend you use a tool like MinMerge to compare the source files before and after my changes because it will give a clearer idea of what I changed.
There are a lot of things that can be improved/fixed but I don't really want to do any more on this than show you the possibilities.

Here are some ideas I have...

Distance sorting triangles with partial-transparency slowness:
(i) use the previous distance sorted array as the basis of the next array (most data will be in the right order (or close to the right order) already so the sort will be very quick
or
(ii) build a binary-node tree of distances and then traverse that tree <-- recommended solution
or
(iii) as the map is a grid, and only the walls have partial transparency, process the map from furthest grid coordinates to closest grid co-ordinates

Startup slowness for mipmap generation:
(i) Pre-generate the images at different resolutions/blurry-ness and store as files (could be impossible because they contain grid co-ordinates and colours)
or
(ii) Use integer math (atm SINGLE is the default data type which I didn't realise when coding this, no doubt this slowed down the mipmap generation code) <-- recommended solution
Note: AT present all mipmaps are the same size just with different blurry-ness, ideally the lower quality ones would be lower resolution too but you need to adjust texture co-ordinates for that

Also note that along with making each mipmap more blurry the further it is, I also darkened them (only a little bit) as they are further away. This achieved a simple lighting effect which added a bit of atmosphere.

Whether you use my ideas or not doesn't bother me. Thank you for making and sharing interesting 3D games and experiences with the QB64 community.

'***Here is an updated version with some speed improvements for mipmap generation (integer math) and distance sorting (re-use previously sorted data)***
« Last Edit: April 23, 2021, 04:48:56 AM by Galleon »

Offline MasterGy

  • Forum Regular
  • Posts: 241
  • people lie, math never lies
Re: Terror in the MAZE v20 (and newers)
« Reply #5 on: April 23, 2021, 12:53:49 PM »
Again, I was really looking forward to getting home and trying it out. Unfortunately, it doesn't start with any of the qb64 versions. The window opens for a moment and exits.

sorry, it's already resolved. (I made my own mistake, I just started the generated exe and didn't notice that the file describing the parameters of the playing field, which is generated by the starter, is missing)

I tried to put both the game and the starter in 1 file, but despite the "RUN" key, the program crashes after a few starts. It would be nice if the "RUN" command came up with a full memory cleanup and started from scratch)

thank you so much for working on the development! I’m glad someone adds an idea and an implementation. I’ll be studying the solution over the weekend, and for now, I’m just admiring the rendering. Unfortunately, the large maze slows down the machine very much. As you wrote, I have already blocked the display for an unfinished game (tree_house_v40) in a similar way. I figured out in advance where I was, what it should look like. The same can be applied to mipmap.

https://drive.google.com/file/d/1JIrVMT3CN05-MfDhXdZVIfj8N0wWJSVw/view?usp=sharing
https://www.youtube.com/watch?v=pcQrHp97v8U
« Last Edit: April 23, 2021, 01:33:50 PM by MasterGy »

Offline Galleon

  • QB64 Developer
  • Newbie
  • Posts: 21
Re: Terror in the MAZE v20 (and newers)
« Reply #6 on: April 23, 2021, 10:15:57 PM »
The last version I shared yesterday supports multiple mipmap levels. It is probably set to 7 by default and it may generate too many textures for your system (as in your game every wall has its own texture to begin with).

Try changing it to 3...
DIM SHARED mipmapLevels AS LONG
mipmapLevels = 3 'max=20, recommended=7 (the higher the level the slower startup will be)

Offline MasterGy

  • Forum Regular
  • Posts: 241
  • people lie, math never lies
Re: Terror in the MAZE v20 (and newers)
« Reply #7 on: April 24, 2021, 02:35:56 AM »
I would like to transfer the glass effect anyway, and the mipmap will be done when the program is ready. For now, unfortunately, I don't understand either _alpha or the glass effect. Galleon solved it fantastically, and despite the code there, I don’t understand. I don’t know what the reason might be, I don’t understand the connections. I wrote a program quickly and I would like someone to help me in making the sq as it needs to be supplemented to make that circle, hole glass effect.

Code: (qb64) [Select]
'how do i make the center of an image called "sq" transparent ???? as if it were window glass

sq = _NEWIMAGE(200, 200, 32): _DEST sq
COLOR _RGB32(255, 0, 0) 'red circle
CIRCLE (100, 100), 90
PAINT (1, 1), _RGB32(255, 0, 0), _RGB32(255, 0, 0)

'what shall i do here ?????



'background
bg = _NEWIMAGE(800, 600, 32): _DEST bg
FOR x = 0 TO 799: FOR y = 0 TO 599
        PSET (x, y), _RGB32(255 / 800 * x, 255 / 600 * y, 0)
NEXT y, x
FOR t = 0 TO 199
    COLOR _RGB32(256 * RND(1), 256 * RND(1), 256 * RND(1))
    LOCATE 1 + 34 * RND(1), 1 + 95 * RND(1)
    PRINT CHR$(97 + 26 * RND(1))
NEXT t

show = _NEWIMAGE(800, 600, 32): SCREEN show

'show
DO: _LIMIT 20
    _DEST show: CLS
    _SOURCE bg
    _PUTIMAGE

    DO: LOOP WHILE _MOUSEINPUT

    _SOURCE sq
    _PUTIMAGE (_MOUSEX, _MOUSEY)
    _DISPLAY
LOOP



Offline Galleon

  • QB64 Developer
  • Newbie
  • Posts: 21
Re: Terror in the MAZE v20 (and newers)
« Reply #8 on: April 24, 2021, 05:17:33 AM »
Code: (qb64) [Select]
'what shall i do here ?????
_DONTBLEND
PAINT (100, 100), _RGB32(255, 255, 255, 160), _RGB32(255, 0, 0)
_BLEND

The 4th parameter in RGB32 is alpha

Note: PAINT is a special case where _DONTBLEND is actually unrequired but this is most likely a...
Anyway for all other drawing/printing if you want to override the dest with the source color (not blend the source colour with the dest color) and the source color has an alpha component you need to to use _DONTBLEND

Offline Petr

  • Forum Resident
  • Posts: 1665
  • The best code is the DNA of the hops.
Re: Terror in the MAZE v20 (and newers)
« Reply #9 on: April 24, 2021, 05:54:22 AM »
Code: (qb64) [Select]
'how do i make the center of an image called "sq" transparent ???? as if it were window glass

sq = _NEWIMAGE(200, 200, 32): _DEST sq
COLOR _RGB32(255, 0, 0) 'red circle
CIRCLE (100, 100), 90
PAINT (1, 1), _RGBA32(255, 0, 0, 120), _RGB32(255, 0, 0)

'what shall i do here ?????



'background
bg = _NEWIMAGE(800, 600, 32): _DEST bg
FOR x = 0 TO 799: FOR y = 0 TO 599
        PSET (x, y), _RGB32(255 / 800 * x, 255 / 600 * y, 0)
NEXT y, x
FOR t = 0 TO 199
    COLOR _RGB32(256 * RND(1), 256 * RND(1), 256 * RND(1))
    LOCATE 1 + 34 * RND(1), 1 + 95 * RND(1)
    PRINT CHR$(97 + 26 * RND(1))
NEXT t

show = _NEWIMAGE(800, 600, 32): SCREEN show

'show
DO: _LIMIT 20
    _DEST show: CLS
    _SOURCE bg
    _PUTIMAGE

    DO: LOOP WHILE _MOUSEINPUT

    _SOURCE sq
    _PUTIMAGE (_MOUSEX, _MOUSEY)
    _DISPLAY
LOOP

Row 6 contains Galleon´s idea.

Offline Petr

  • Forum Resident
  • Posts: 1665
  • The best code is the DNA of the hops.
Re: Terror in the MAZE v20 (and newers)
« Reply #10 on: April 24, 2021, 05:57:47 AM »
You can also create shadows - just add white or black to the original texture with the set transparency (if it is not better to have these textures ready in memory before use)

Offline MasterGy

  • Forum Regular
  • Posts: 241
  • people lie, math never lies
Re: Terror in the MAZE v20 (and newers)
« Reply #11 on: April 24, 2021, 06:05:09 AM »
I do not understand :))))

You succeeded with this little code. I also add color to the glass. I either add it to black or extract it from white. It worked.
Even though I try to just add titm_game_88.bas to be glass, I can't. I don't even understand exactly what _blend, _dontblend does, although I'm very much studying. Either nothing is visible or the windows will be black.

Offline Petr

  • Forum Resident
  • Posts: 1665
  • The best code is the DNA of the hops.
Re: Terror in the MAZE v20 (and newers)
« Reply #12 on: April 24, 2021, 06:26:55 AM »
Ok, so BLEND allow transparency. DONTBLEND disable transparency and program speed is then higher. You use hardware textures, right? For use with hardware _MAPTRIANGLE use it in this way:

Code: (qb64) [Select]
SCREEN _SCREENIMAGE 'place software background
texture = _NEWIMAGE(800, 600, 32)
_DEST texture
PAINT (1, 1), _RGBA32(255, 255, 255, 128) 'create SOFTWARE image with 50 percent transparency
_DEST 0 'return to default SCREEN (created in row 1 in this case)
HardTexture = _COPYIMAGE(texture, 33) 'create hardware texture for use with _MAPTRIANGLE 3D or with _PUTIMAGE


DO
    _PUTIMAGE (300, 20)-(500, 120), HardTexture, 0 'place hardware image to software background - PUTIMAGE use standard coordinates system for Hardware textures
    _MAPTRIANGLE (0, 0)-(_WIDTH, 0)-(_HEIGHT, 0), HardTexture TO(-1, 1, -3)-(1, 1, -3)-(-1, -1, -3), 0 'place hardware textured triangle to software background - MAPTRIANGLE use OpenGL coordinate system
    _DISPLAY
    _LIMIT 15
LOOP

Offline MasterGy

  • Forum Regular
  • Posts: 241
  • people lie, math never lies
Re: Terror in the MAZE v20 (and newers)
« Reply #13 on: April 24, 2021, 06:36:10 AM »
I had a lot of questions.

I do not understand. if I make a window, I only see the maze through the window, but not the sky and the Earth.
Does _maptriangle end with ", 0"?

I don't see all this.

is there any difference in use to ".32" or ".33" in the image? I noticed there wasn't.
« Last Edit: April 24, 2021, 06:37:33 AM by MasterGy »

Offline MasterGy

  • Forum Regular
  • Posts: 241
  • people lie, math never lies
Re: Terror in the MAZE v20 (and newers)
« Reply #14 on: April 24, 2021, 06:39:55 AM »
ok, I understood "0", he's the screen. I also mean transparency. Yet in the game, I don’t see the sky and the earth. But I don't understand that.