Forum Replies Created
-
AuthorPosts
-
You know that https://chipmunk-physics.net is faster, see the benchmark.
I don’t know how easy it is to convert to mx2 but its a alternative
oke, works here now.
I din’t know that ‘updatemx2cc.sh’ did something more then ‘rebuildall.sh’What I do is not using git, but
1. delete the whole monkey directory.
2. download the git zipfile
3. run rebuildall.shbut as I can see now, updatemx2cc.sh does the trick and does something more.
And about my other question, I a other topic someone said that using a Field is faster than accessing a Property. With that in mind I will use fields first and then property’s.
Downloaded the latest version, but its still give the wrong Return Self back.
The output is the same.
What I expect was
Vec2(3,4)
Self.X 3
Self.X 3
_x 10
Self.X 10
Self.X 10
Vec2(10,10)
3 < wrong ? >>> 10
3 < wrong ? >>> 10
Vec2(3,4) < wrong ? >>> Vec2(10,10)The module is now online inside Ted2.
cool, then a new module for the community is on the way.
September 10, 2016 at 6:11 pm in reply to: Bug or not ? 2 windows only one draws something, and can't use variables #3853I know you may don’t have time for this but maybe you can see the problem what I discovered here.
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071Namespace myapp#Import "<std>"#Import "<mojo>"#import "<mojox>"Using std..Using mojo..Using mojox..Global game:GameClass GameField accessibleField:String = "game text"Method render(canvas:Canvas)canvas.DrawText(accessibleField,50,50,.5,.5 )EndEndClass GameWindow Extends WindowMethod New(title:String,width:Int,height:Int)Super.New( title,width,height,WindowFlags.Center)SwapInterval=1EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()game.render(canvas)EndEndClass EditorWindow Extends WindowMethod New(title:String,width:Int,height:Int)Super.New( title,width,height)SwapInterval=1Local label:=New Label( "Idle" )label.Gravity=New Vec2f( .5,0 )Local button:=New Button( "Click ME!" )button.Clicked=Lambda()Global n:=0n+=1label.Text="Clicked #"+n' game.accessibleField="Clicked #"+nEnd'Local dockingView:=New DockingViewdockingView.AddView( label,"top" )dockingView.ContentView=buttonContentView=dockingViewEndEndFunction Main()New AppInstancegame = New Game()New GameWindow("Game",600,800)New EditorWindow("Editor",200,400)App.Run()EndWhen you run this code above, then the editor window is on top, and is black.
You see in the GameWindow the a text in the top.Magic 1
When you press +/- 10px below the middle inside the Editor window (there is the button located), then everything is visible in the Editor window !Magic 2
But the GameWindow din’t update, because now some new magic will happen.
Uncomment the lineMonkey1' game.accessibleField="Clicked #"+nWhen you do the same as Magic 1 above, then nothing will be visible inside the Editor window.
But the GameWindow will will update the text like I want !Magic 3
Comment the line above again, and now the bonus magic.
Change the line in the top to thisMonkey1Field accessibleField:String = "game window text"With this the string is larger, and what do you think: magic 1 is now not working, only by making the text a longer.
Then I thought, what do people say about sdl two windows, so I can use that.
But using some examples in combination with the bananas/sdl2test gives the same output.
http://stackoverflow.com/questions/21691450/how-to-create-a-subwindow-using-sdl
http://stackoverflow.com/questions/22227811/sdl2-and-opengl-functions-with-two-windowsI don’t know if MX2 is doing something wrong or SDL.
Now I’m thinking about this, maybe I switch back to a in game editor window that you can move around like the /bananas/calculatorIt has some pros and cons to do a editor in game or in a external editor window.
Not that I know.
But I was thinking last week, that there are now 3 devices
- joystickdevice
- keyboarddevice
- mousedevice
With IOS/Android maybe its a good idea to get a new device
- touchdevice
Or call it gesturedevice or something else.
I don’t know if mouseclick === touch
I ‘uploaded’ the module PNG2Polygon and made a screenshot to make it easy to understand what is does. (check this image first, and then read below)
I use it in a situation like this.
– a number of high quality transparent PNG files that need a check for a collision and/or user mouseFirst I use a PNG2Polygon inside a editor to convert all the PNG files to the smallest simplified x and y coordinates and save them in a json file. something like this:
circle.png : [x,y,x,y,x,y]
star.png : [x,y,x,y]Then where I need the collision in game I load the coordinates (verts) once.
And use it something like this:Monkey12345678Local CollisionType:Int = PolyCollision(verts,Mouse.X,Mouse.Y)If CollisionType=0 Then' no collisionElseif CollisionType=1 Then' line collisionElseif CollisionType=2 Then' point insideEndAs you can see, the simplified coordinates are way less x,y points then the total png2polygon.outline points.
So there is less CPU/GPU needed to check for a collision.There are situations that simplifying not work in combination with a line collision.
For example the figure below the circle.
In that situation the PolyCollision() can’t detect line collision, but it can detect point inside collision
If you want a perfect line collision using that figure, then you need the full png2polygon.outlineThis script uses
https://en.wikipedia.org/wiki/Moore_neighborhood
https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithmInside the module there is a [test] directory with examples.
Attachments:
September 1, 2016 at 9:21 am in reply to: Bug or not ? 2 windows only one draws something, and can't use variables #3589I understand, its a desktop editor to create games while running them.
Don’t know if you are going to do a rough check in the near future so I wait.
September 1, 2016 at 9:19 am in reply to: Bug or not ? 2 times using a (mouse) event = ignoring both #3588Oke, than I don’t change my code and wait for an update at your side.
search for Activity Monitor
@mark
I see software company’s using software testing tools to test ‘all’ combinations/methods.
Is it (or maybe you do that) a idea that you create a [test] profile, to make MX2 super stable ?I don’t know how, but maybe there are some software tools that you can use ?
oke.
This means they will remain open and usable/modifiable by all
I thought it this way.
At the end, new users will download MX2 in the future, just to look and try.
They open the inside module manager, and choose the modules
[IDE: color picker]
[IDE: painter]
[IDE: synth]That users (me) don’t care about that its modifiable, i’m a user that want to use a color picker.
If I really want to modify it, I clone the module and make changes.
Its a idea, just to make everyone happy
(and you don’t know what mark is adding/changing inside ted)
Does Ted21 going to use the latest MX2 version ?
I can see problems if you are behind the main version, and people want to use the latest MX2 version.Maybe you can concentrate to write modules for the official ted2 version.
That way your work is future proof and you reach more peopleAugust 25, 2016 at 7:57 pm in reply to: FPS, Delta, FixedFPS, Timing, Animation Topic (almost done) #3450Final round
I just going back to my old setup what is working, using a delta class I found some years ago.
(In the bananas, no delta code found)Can someone agree with the fact below ?, then I and maybe others understand it better then.
Its hard to understand because of the various factors:
CPU / GPU / MONITOR (hz) / MX2
When I use my delta timing code below and use the this setting:
– SwapInterval=0 > I get FPS 450+
– SwapInterval=1 > I get FPS 60 (I will use this setting)Everything looks oke now, but need to be sure.
[fact 1] Because I’m using the delta I don’t care about the FPS, the movement (looks) works oke
[fact 2] Devices that don’t support SwapInterval=1, movement will be oke because i’m using delta
[fact 3] Devices with 75hz or other are oke because i’m using delta
[fact 4] MX2 loop is always like this App.RequestRender() then OnUpdate() then OnRender()Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207#Import "<std>"#Import "<mojo>"#Import "assets/animation/"Using std..Using mojo..Global dt:DeltaTimerClass DeltaTimerField targetfps:Float = 60Field currentticks:FloatField lastticks:FloatField frametime:FloatField delta:FloatMethod New (fps:Float)targetfps = fpslastticks = Millisecs()EndMethod UpdateDelta:Void()currentticks = Millisecs()frametime = currentticks - lastticksdelta = frametime / (1000.0 / targetfps)lastticks = currentticksEndEndClass MyWindow Extends WindowField frameSets:Stack<FrameSet> = New Stack<FrameSet>()Method New( )SwapInterval=0 ' vsyncdt = New DeltaTimer(60)' this part is normaly using loaded using json and 1 atlas file' ==========================================frameSets.Add(New FrameSet())Local oFS:FrameSet = frameSets.Get(0)oFS.frames.Add(New Frame("1.jpg",60))oFS.frames.Add(New Frame("2.jpg",60))oFS.frames.Add(New Frame("3.jpg",60))oFS.frames.Add(New Frame("4.jpg",60))oFS.frames.Add(New Frame("5.jpg",60))oFS.frames.Add(New Frame("6.jpg",60))oFS.frames.Add(New Frame("7.jpg",60))oFS.frames.Add(New Frame("8.jpg",60))oFS.frames.Add(New Frame("9.jpg",60))oFS.frames.Add(New Frame("10.jpg",60))oFS.frames.Add(New Frame("11.jpg",60))oFS.frames.Add(New Frame("12.jpg",60))oFS.frames.Add(New Frame("13.jpg",60))oFS.frames.Add(New Frame("14.jpg",60))oFS.frames.Add(New Frame("15.jpg",60))oFS.frames.Add(New Frame("16.jpg",60))oFS.frameEnd = oFS.frames.Length-1oFS.Position = New Vec2f( 400,400 )oFS.move2left = True' another framesetframeSets.Add(New FrameSet())oFS = frameSets.Get(1) ' another framesetoFS.frames.Add(New Frame("1.jpg",500))oFS.frames.Add(New Frame("2.jpg",500))oFS.frames.Add(New Frame("3.jpg",500))oFS.frames.Add(New Frame("4.jpg",500))oFS.frames.Add(New Frame("5.jpg",500))oFS.frames.Add(New Frame("6.jpg",500))oFS.frames.Add(New Frame("7.jpg",500))oFS.frames.Add(New Frame("8.jpg",500))oFS.frames.Add(New Frame("9.jpg",500))oFS.frames.Add(New Frame("10.jpg",500))oFS.frames.Add(New Frame("11.jpg",500))oFS.frames.Add(New Frame("12.jpg",500))oFS.frames.Add(New Frame("13.jpg",500))oFS.frames.Add(New Frame("14.jpg",500))oFS.frames.Add(New Frame("15.jpg",500))oFS.frames.Add(New Frame("16.jpg",500))oFS.frameEnd = oFS.frames.Length-1oFS.Position = New Vec2f( 400,250 )oFS.move2left = True' another framesetframeSets.Add(New FrameSet())oFS = frameSets.Get(2)oFS.frames.Add(New Frame("1.jpg",1000))oFS.frames.Add(New Frame("2.jpg",1000))oFS.frames.Add(New Frame("3.jpg",1000))oFS.frames.Add(New Frame("4.jpg",1000))oFS.frames.Add(New Frame("5.jpg",1000))oFS.frames.Add(New Frame("6.jpg",1000))oFS.frames.Add(New Frame("7.jpg",1000))oFS.frames.Add(New Frame("8.jpg",1000))oFS.frames.Add(New Frame("9.jpg",1000))oFS.frames.Add(New Frame("10.jpg",1000))oFS.frames.Add(New Frame("11.jpg",1000))oFS.frames.Add(New Frame("12.jpg",1000))oFS.frames.Add(New Frame("13.jpg",1000))oFS.frames.Add(New Frame("14.jpg",1000))oFS.frames.Add(New Frame("15.jpg",1000))oFS.frames.Add(New Frame("16.jpg",1000))oFS.frameEnd = oFS.frames.Length-1oFS.Position = New Vec2f( 200,100 )' ==========================================EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()OnUpdate()canvas.TextureFilteringEnabled=Falsecanvas.DrawText( "FPS="+App.FPS,Width/2,0,.5,0 )For Local oFS:FrameSet = Eachin frameSetsoFS.Draw(canvas)NextEndMethod OnUpdate()dt.UpdateDelta()For Local oFS:FrameSet = Eachin frameSetsoFS.UpdateFrameTimer()If oFS.move2leftoFS.Position.x-=1*dt.deltaIf oFS.Position.x <= 50oFS.move2left = FalseoFS.move2right = TrueEndElseif oFS.move2rightoFS.Position.x+=1*dt.deltaIf oFS.Position.x >= 450oFS.move2left = TrueoFS.move2right = FalseEndEndNextEndEndClass FrameSetField frames:Stack<Frame> = New Stack<Frame>()Field currFrameKey:Int = 0Field timer:IntField frameEnd:IntField Position:=New Vec2fField move2left:Bool ' debugField move2right:Bool ' debugMethod New()EndMethod CurrentFrame:Frame()Return frames.Get(currFrameKey)EndMethod UpdateFrameTimer:Void()' If frame_total > 1If dt.lastticks > timer + frames.Get(currFrameKey).durationcurrFrameKey+=1If currFrameKey > frameEndcurrFrameKey = 0Endtimer = Millisecs()End' EndEndMethod Draw:Void(canvas:Canvas)canvas.DrawImage(CurrentFrame().img,Position.X,Position.Y)EndEnd ClassClass FrameField duration:IntField name:StringField img:ImageMethod New (_name:String,_duration:Int)name= _nameduration = _durationimg=Image.Load( "asset::"+_name)img.Handle=New Vec2f( .5,.5 )EndEnd ClassFunction Main()New AppInstanceNew MyWindow()App.Run()End -
AuthorPosts
