OMEGANAUT

Post screenshots, binaries and projectfiles of the projects you have made with ZGE that you want to share!

Moderator: Moderators

User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Kjell wrote:You're right, should be Translate instead of Transform ~K
Documentation updated :) There are probably more errors and omissions at places, I'm not very good at documentation I'm afraid.

About collisions styles: From the beginning ZGE was mostly used for making simple 2d games then I've added additional kinds of collisions as the projects became more advanced. Mesh and 3d obb collisions are difficult to implement so I have been reluctant to add them until absolutely necessary. ZGEs collision model is very simple, if you need more advanced you could look at ZGE integration with Bullet3d physics.
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Post by Ats »

Attaching nodes to the ship was exactly what I did. But your example is better made than mine I must admit.
Ville, do not worry as nodes works well in that case, and ZGE is running very smoothly on my 2008 Dell mini 8 with xubuntu. So I'm most happy with that :)

Anyway, I made a snippet for keyboard double tap. I needed that for the barrel roll.
Kjell, I saw on your examples that you're stocking variables inside arrays. Is it way better than to declare a few variables ?
Attachments
doubleTap.zgeproj
DoubleTap Keyboard snippet
(1.47 KiB) Downloaded 578 times
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Post by Ats »

Hi everyone !

Today I had some time to play with ZGameEditor so I added some sounds to the game and I released it to my website (it's in french)
http://bit.ly/Vga2XL

Maybe I'll improve this little game in the future while making some other tests.

Anyway, thanks for the help you provided ;)
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Post by Ats »

Thanks to Rado1's thread concerning the OSK for Android, now I know that the physical keyboard works natively on Android if you put the characters xX instead of charcode 88. So I'm playing it right now on my TV screen with a keyboard plugged into my OUYA.
It's a blast!
So I'm quite motivated to continue working on that prototype and make a real game out of it.

By the way, particles are making the 3D models blinking like crazy on Android. Should I know something about that?
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Ats wrote:By the way, particles are making the 3D models blinking like crazy on Android. Should I know something about that?
I'm not sure but possible cause can be that GPUs on Android (even very good such as Tegra 3) usually have problem with z buffer fighting (for info see here) caused by lower z buffer "sensitivity" than GPUs on PCs. In this case you should either put overlapping objects further from each other (relatively to camera) or to use

Code: Select all

glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(FACTOR, UNITS);
before drawing object in the OnRender section. There are many discussion on this topic on the web. You usually must find your proper constants for FACTOR and UNITS.

Another thing is to use proper combination of Material's Blend combinations for your objects on scene and background. Again there's some space for experiments.

BTW regarding to OUYA controller: I tried to setup some emulation on PC, but failed for ARM virtual device. I had some success with OUYA image for Intel, but the problem was that ZGE does not compile for Intel platform. Quite disappointed I stopped the experiments after one day... and will return back when there's will be some more time; I have some ideas but will take more time...
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Post by Ats »

Each time I'm amazed how simple ZGE is and how complicated it can get if you do not know OpenGL and stuff... :?

So after some readings, I've added that in general OnLoaded:

Code: Select all

<ZExternalLibrary ModuleName="opengl32">
  <Source>
<![CDATA[//
void glEnable(int cap) {}
void glPolygonOffset(float factor, float units) {}]]>
  </Source>
</ZExternalLibrary>
But glEnable(int cap) does not go well with glEnable(GL_POLYGON_OFFSET_FILL): Invalid address expression: GL_POLYGON_OFFSET_FILL
It should be an GLenum, but I'm not sure about the equivalent of that in ZGE.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

To enable OpenGL calls just do the following:
1. Rightclick on the OnLoaded item.
2. Select Add from library... / External libraries / OpenGL 4.0 graphics

Now, you can use many OpenGL functions and constants in expressions; including GL_POLYGON_OFFSET_FILL.
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Post by Ats »

Oh! Ok THAT was simple :oops:

Edit:
Hi everyone! I have a quick question about the design logic in ZGE. I've come with two different enemies with different shapes and behaviours. But before going too far, I'd like some precision about how variables works inside components.

Right now, I defined the var EnemyLife in the Definitions of the first enemy.
But I can't make the same thing for the second enemy because there can't be twice the same name for a var...
So I was wondering: do I have to set different names for the variables of the different enemy components, or do I have to create only one enemy component that displays and react differently depending on the type of enemy that I choose while creating it (but maybe I'll have problems with collision boxes with that...). What do you think is the best?
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Ats,
Ats wrote:Right now, I defined the var EnemyLife in the Definitions of the first enemy. But I can't make the same thing for the second enemy because there can't be twice the same name for a var.
This is a bit of a annoyance / design-flaw yes.
Ats wrote:So I was wondering: do I have to set different names for the variables of the different enemy components
That's one possibility .. use something as follows to access the differently named variables from another Model.

Code: Select all

switch(enemyModel.ClassId)
{
  case Goblin.ClassId:
    enemyLife = enemyModel.GoblinLife;
    break;

  case Skeleton.ClassId:
    enemyLife = enemyModel.SkeletonLife;
    break;
}
Ats wrote:or do I have to create only one enemy component that displays and react differently depending on the type of enemy that I choose while creating it
That's what the ModelState component is for. So, to replicate the code-snippet you would have a Enemy Model with a EnemyLife variable defined, and two ModelStates ( EnemyGoblin and EnemySkeleton ). Then in the OnStart event of each ModelState you dynamically set the Collision properties for each model. But i'd only recommend this approach when there's a good amount of shared behavior / components.

K
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Post by Ats »

Hi guys, it's been a long time since I had the pleasure to play with ZGE...
But I'm back and I intend to finish at least one project :oops:

So I have two little questions for you in order to get right on tracks:

I'm starting to have a lot of different ships in the game. Is it possible to create a zgeproj file per spaceship and then load them in the main game file?

For a first release, I would like to have one level playable. In a first time, I'll go with scripted level instead of randomly generated waves of enemies. Do you have some tips for me in order to start in the right direction with scripted level? There are different enemies and obstacles and the enemies have their own way to move but I can define where they are appearing.

Thanks ;)
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Ats,
Ats wrote:I'm starting to have a lot of different ships in the game. Is it possible to create a zgeproj file per spaceship and then load them in the main game file?
Not really no. Why would you want to do this anyway?
Ats wrote:Do you have some tips for me in order to start in the right direction with scripted level? There are different enemies and obstacles and the enemies have their own way to move but I can define where they are appearing.
It really depends on which workflow you want to use. You could use a external program ( such as Blender or Maya ), or create a in-game editor, or use persistent arrays, or simply a external text / binary file.

K
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Post by Ats »

By experience, I prefer to have the data outside the main game file, especially when I'm going to produce quite a lot of data.
Furthermore, I would like to make a space ship viewer as another zgeproject. I can do it by copy/paste the ships from the game to the viewer, but that would be a lot of work to maintain both files if I modify the ships.
That's why I'd like to have the ships as external files, if that's possible.

For the level, I'll go with an external text / binary file. I have to think of a good way to handle that. Maybe something like: time, ship, position, time, ...
I have to dig that a little :)
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Ats,
Ats wrote:By experience, I prefer to have the data outside the main game file, especially when I'm going to produce quite a lot of data.
Me too, i keep most of my data outside of the .zgeproj file.
Ats wrote:Furthermore, I would like to make a space ship viewer as another zgeproject. I can do it by copy/paste the ships from the game to the viewer, but that would be a lot of work to maintain both files if I modify the ships.
Yea .. it would be convenient when Import components had a checkbox to toggle between embed and external. Especially when you're updating resources often, it's cumbersome having to re-import them every time you've made a change.
Ats wrote:For the level, I'll go with an external text / binary file.
You could even use ZGameEditor as your "notepad" to create the binary files :wink:

K
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Post by Ats »

Hi,
Now I have quite a lot of different ships and stuff. Each one are generating an explosion when destroyed. Always the same one but with different parameters: spawning some particles and rotating cubes.

I think it would be better to only have one explosion model. But how can I pass parameters to it in order to make it size and number of generated cubes to vary?


Also I've added the ZGE logo from Vector Locust (viewtopic.php?t=408), but wireframe materials don't seem to render on Android...

Otherwise, all is taking shape. I'm making a few more spaceships with different behaviors and then I'll try to make some cool generated sounds ;)
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Ats,
Ats wrote:Now I have quite a lot of different ships and stuff. Each one are generating an explosion when destroyed. Always the same one but with different parameters: spawning some particles and rotating cubes.

I think it would be better to only have one explosion model. But how can I pass parameters to it in order to make it size and number of generated cubes to vary?
It's really easy .. simply set whichever properties you want to control of your explosion just before spawning a clone. Below is a quick example ( press spacebar to spawn a clone ).

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application">
  <OnUpdate>
    <KeyPress Keys=" " RepeatDelay="0.25">
      <OnPressed>
        <ZExpression>
          <Expression>
<![CDATA[// Set all properties you want to control

BlastForce = random(3,2);
BlastRepeat.Count = random(6,4);
BlastTransform.Scale = 2.0 / BlastRepeat.Count;

BlastColor.Color.R = random(0.6, 0.4);
BlastColor.Color.B = random(0.6, 0.4);

// Spawn the clone

createModel(Blast);]]>
          </Expression>
        </ZExpression>
      </OnPressed>
    </KeyPress>
  </OnUpdate>
  <Content>
    <Model Name="Blast">
      <Definitions>
        <Variable Name="BlastTimer"/>
        <Variable Name="BlastForce"/>
      </Definitions>
      <OnRender>
        <RenderSetColor Name="BlastColor" Color="0.2249 0 0.4473 0"/>
        <Repeat Name="BlastRepeat" Count="3" WhileExp="//">
          <OnIteration>
            <RenderTransform Name="BlastAngle" Rotate="0 0 0.25"/>
            <RenderTransformGroup Name="BlastTransform" Scale="0.6667 0.6667 0.6667">
              <Children>
                <RenderSprite/>
              </Children>
            </RenderTransformGroup>
          </OnIteration>
        </Repeat>
      </OnRender>
      <OnUpdate>
        <ZExpression>
          <Expression>
<![CDATA[BlastTimer += App.DeltaTime;
BlastTransform.Translate.X = sin(BlastTimer) * BlastForce;]]>
          </Expression>
        </ZExpression>
        <Condition Expression="return BlastTimer > 1;">
          <OnTrue>
            <RemoveModel/>
          </OnTrue>
        </Condition>
      </OnUpdate>
      <OnSpawn>
        <ZExpression Expression="BlastAngle.Rotate.Z = 1.0 / BlastRepeat.Count;"/>
      </OnSpawn>
    </Model>
  </Content>
</ZApplication>
Hope this helps :)

K
Post Reply