Forum Replies Created
-
AuthorPosts
-
There is a alpha module for monkey2 linked on the old blitzbasic.com (frontpage) There are a number of examples included. Seems to all work allright.
Monkey2 can also compile to Wasm(Web assembler) This is really fast html5.
Ok, that should be easy
I expected this to be a lot harder. Thanks..
And where do I put the downloaded github for ted2go? Do I need to copy these files (all of it?) into the src/ted2go directory?
Is there a guide in how to compile/install ted2go?
I just had Ted2go kill itself the moment I typed in the self. thing! I forgot to disable it in the preferences. (time for the b release?
)
That is quite the list
Are you doing this on a netbook? (You mentioned once you had one)
Yeah, emscripten is really neat. I tested the game yesterday on the ipad mini 1’s browser and it worked. (Only no touch yet) Earlier this year emscripten did not work on on the device.
I wil add the city radius. I hope I fixed that city build at 0.70 . Some code was placed wrong I think. Version 0.70 wil probably be uploaded in a few hours that should have this fixed.
I also added a new screenshot on the top of this thread here.
btw there is no selection for mapsizes yet. I usually put it at 20×20. The last screenshot was 32*32. Some tiles I noticed are wrong(the yellow ones)
Yes, this fixed it! Thanks.. Both Emscripten and Wasm now are fast as the previous version. I wil now start using 1.1.05 for development.
And I wil start using the dynamic flags if I draw on them reguraly.
I created a little test program just in case it is my bad programming.
The speed difference is. WIth the previous version ( +/-80ms per redraw) and with the new version (+/-600ms)
This is emscripten in debug mode in latest chrome browser.
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class worldField Width:Int,Height:IntField image:ImageField icanvas:CanvasMethod New(Width:Int,Height:Int)Self.Width = WidthSelf.Height = Heightimage=New Image( Width,Height)image.Handle=New Vec2f( 0,0 )icanvas=New Canvas( image )End MethodMethod redraw(canvas:Canvas)Local t:Int=Millisecs()canvas.Clear(Color.Black)For Local i:=0 Until 1500drawgrass(Rnd(Width,Height),Rnd(Width,Height),canvas)Nextcanvas.Flush()Print "Took :"+(Millisecs()-t)End MethodMethod drawgrass(x:Float,y:Float,canvas:Canvas)Local tw:Float=10 'tilewidthLocal th:Float=10 'tileheightSeedRnd(x*y)canvas.Color = New Color(0,0.5,0)canvas.DrawRect(x,y,tw,th)' noiseFor Local y2:Int=y Until y+thFor Local x2:Int=x Until x+tw'noiseIf Rnd(2)<.1canvas.Color = New Color(0,Rnd(0.2,0.6),0)canvas.DrawPoint(x2,y2)' highlight noiseIf Rnd(1)>.9 ThenLocal grey:Float=Rnd(.3,.7)canvas.Color = New Color(grey,Rnd(0.2,0.3)+grey,grey)canvas.DrawPoint(x2,y2)End IfEnd IfNextNextEnd MethodEnd ClassGlobal myworld:worldClass MyWindow Extends WindowMethod New()myworld = New world(Width,Height)End MethodMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender() ' Activate this methodIf Keyboard.KeyReleased(Key.Space) Then myworld.redraw(myworld.icanvas)canvas.Color = Color.Whitecanvas.DrawText("Press space to test draw speed",0,0)' if key escape then quitIf Keyboard.KeyReleased(Key.Escape) Then App.Terminate()End MethodEnd ClassFunction Main()New AppInstanceNew MyWindowApp.Run()End FunctionI was drawing to images(buffers) and I had used static images and tried to set them up as dynamic images but it made no difference. It takes about 2 seconds now to redraw everything while in the previous monkey version it was done in a fraction of a second.
I am using a lot of drawrect and drawpoint and drawoval and drawcircle commands. Rnd and new color.
edit: I did some side by side testing. In the method I tested now it seems that the graphics drawing speed has halved in the new version.
edit: I will spend some time creating code that shows the speed difference between the two versions. Might take a while since I am having such a fun time working on my current project. (I am using the previous monkey2 version) I am not to sure if it is my coding that is the blame for the problem so I will wait to post a bug report (spamming it with my newb things)
edit : here is the project with which I tested it. It is a lot of code though.
https://github.com/Pakz001/Monkey2examples/blob/master/CivClone%200.6.monkey2
When I used to press ‘b’ to build a city it was immediat, now it takes a second or two. Happens with the map redraw.
No, just checked it. You are right. Good to know.
btw, anyone know how to do the typecast with the lambda’s?
I also tried to do this with the Lambda but I was not able fo figure out how to use the Typecasts <T>
The regular way works.
Monkey123456Local copy2darray := Lambda:Int[,](in:int[,])Return inEnd LambdaUsage :myarray2 = copy2darray(myarray1)Lambda’s are kind of like functions but they can be put near the code that you are working with.
Returning arrays from functions do not require you to copy each element. This is done automatically. Only the Return is needed
Monkey1234Function copy2darray<T>:T[,](in:T[,])Return inEnd FunctionYeah, I was wondering how to do it with the [,] arrays. Maybe someone else knows.
edit: I guess if you would create a function that returns a multidimensional array and inputs a multimimensional array you would be able to copy it that way.
-
AuthorPosts