"ZPong.zge" example needs fixing

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

"ZPong.zge" example needs fixing

Post by rrTea »

Here's what I noticed happens in the current build with one of the examples that comes bundled with ZGE...

As soon as the game is run, it starts to beep constantly.

Another thing is... it seems the MouseModelController component has a lag? You can see it in this example, the pink model is calculating its position by reading Mouse x and y directly and it works great, the other uses the MouseModelController and has a "touchscreen style" floaty / laggy / imprecise movement.

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FrameRateStyle="2" FixedFrameRate="60" Camera="ProjectionFrontal" NoSound="1">
  <OnLoaded>
    <SpawnModel Model="Model1"/>
    <SpawnModel Model="Model2"/>
  </OnLoaded>
  <Content>
    <Material Name="ColorMono"/>
    <Model Name="Model1" Comment="Gets the coordinates by calculating them manually" Scale="0.5 0.5 1">
      <OnUpdate>
        <ZExpression>
          <Expression>
<![CDATA[CurrentModel.Position.X = App.MousePosition.X*App.ViewportWidth/App.ViewportHeight;
CurrentModel.Position.Y = App.MousePosition.Y;]]>
          </Expression>
        </ZExpression>
      </OnUpdate>
      <OnRender>
        <UseMaterial Material="ColorMono"/>
        <RenderSetColor Color="1 0 0.502 1"/>
        <RenderSprite/>
      </OnRender>
    </Model>
    <Model Name="Model2" Scale="0.5 0.5 1">
      <OnSpawn>
        <ZExpression Expression="Mover.ScaleX = 1f*App.ViewportWidth/App.ViewportHeight;"/>
      </OnSpawn>
      <OnUpdate>
        <MouseModelController Name="Mover" ScaleX="1" ScaleY="1"/>
      </OnUpdate>
      <OnRender>
        <UseMaterial Material="ColorMono"/>
        <RenderSetColor Color="0.502 0.502 1 1"/>
        <RenderSprite/>
      </OnRender>
    </Model>
    <Camera Name="ProjectionFrontal" Comment="No rotation, for interface etc" Kind="1" Position="0 0 10"/>
  </Content>
</ZApplication>
Last edited by rrTea on Wed May 06, 2015 1:46 am, edited 2 times in total.
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Hi,

A beeping sound? I don't get that here. Can you try to locate what is causing it?

I kind of like the lag :). But indeed maybe the update logic should be changed to use an expression instead. I doubt the MouseModelController has ever been used anywhere except in this project. It is nice to have for simple movement though when you have preference for components over code.
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Post by rrTea »

Just to confirm what's happening, here's what it sounds on my computer (attached). Or is this by design? I could swear it wasn't doing it the last time I saw it. Maybe I'm using an outdated file.

As for the MouseModelController - well I'm probably the biggest fan of using components on this forum, yet I'd probably avoid using it if it were like this... maybe it could have an "elasticity" / lag factor for people who like it?
Attachments
Capture-245.avi
Just recorded a small portion of the screen to cut on the file size.
(422 KiB) Downloaded 409 times
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

It is by design. There is a short sound triggered repeatedly when either of the players move. So if both bats are moving then there is a lot of sound. I guess I wanted to show off the realtime audio fx features (with delay etc) and kind of of overused it a bit ;)
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Post by rrTea »

Oh... heh nevermind it then :) Well it does show the use of realtime audio fx.
Post Reply