Forum Replies Created
-
AuthorPosts
-
Yeah, these are great stuff he’s making.
Wow, I didn’t know that such a book exists, I would definitely look at it.
It’s about since a few months I started paying attention to Romero’s speeches and writings, in hope that I would learn some “old school” techniques. For example one such recommendation of Romero (search it on Gamasutra) was not to write reusable code…
(considering that in order to write reusable code, you will have to predict unplanned features, make abstractions, add features that are not needed)
… but to write mission specific goal that does the job, and when if you consider re usability you just modify the existing foundation and improve it. From my understanding these are practical “agile techniques” as done in 1994.
Have you found the portal system of Doom any useful?
My personal note on this is that it has some good parts, it’s minimal so it doesn’t pump the engine with lots of concepts, also the ease of level design is phenomenal.
The downsides is that because there are no reusable assets, is somehow like painting the level, changes would be costly. An typical example is when making sliding it involves too much steps, where a simple asset would be much better.
I would be 50-50 on this for going into a hybrid approach and mixing classic portals with 3D assets, but I am not sure yet.
Amazing stuff!
Emscripten works perfectly!
Without getting too deep into the AI algorithms the most easy and thin approach would be to get inspired by Shiffman’s work: http://natureofcode.com/book/chapter-6-autonomous-agents/ . It’s true that here are more advanced algorithms and dedicated libraries, perhaps in more advanced and specific needs, it would make sense to link to an AI library if it is needed, this approach however has a good balance between ease of implementation and results.
The agents would have two states, 1: random walk (example 6.11), 2: attack (example 6.12), and then there could be some clever state management to define the AI tactic.
This means that you can create any tool needed to generate content in the most fast and productive way right?
A year ago I played “Brutal Doom” and I was hooked for weeks. I have put also attempts to study the source code, however mostly at this time I am interested in the system design generally, not touched the graphics at all.
Oh, I see!
By looking at Monkey’s List source code, my guessing is I see that the All() method might cooperate with the Eachin statement in the background. The All method however returns a new Iterator, not the existing (the essense of the elements) one.
I did this experiment and I see that I can’t mutate the element of the list directly, however I can mutate the local copy. Is this behavior valid or not?
Monkey1234567891011121314151617181920212223242526272829#Import "<std>"Using std..Struct MyStructField StructValue := 0Method To:String()Return "MyStruct: " + StructValueEndEndFunction Main()Local list := New List<MyStruct>For Local n := 0 Until 5Local s := New MyStructlist.Add(s)NextLocal item := list.FirstNode().Valueitem.StructValue = 1000Print(list.FirstNode().Value)Print(item)EndHere is how it would work.
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class MyWindow Extends WindowField items := New Vec2f[1000]Field TeleportDistance:Float = 200Field VisibleDistance:Float = 100Field VisibleDistanceFade:Float = 80Field speed:Vec2fMethod New()' create all of the itemsFor Local i := 0 Until items.LengthLocal item := New Vec2fitem.X = Rnd(-TeleportDistance, TeleportDistance)item.Y = Rnd(-TeleportDistance, TeleportDistance)items[i] = itemNextEndMethod OnRender(canvas:Canvas) Override' change position of the items and teleport themspeed *= 0.9If (Keyboard.KeyDown(Key.W)) Then speed.Y += 5If (Keyboard.KeyDown(Key.S)) Then speed.Y -= 5If (Keyboard.KeyDown(Key.A)) Then speed.X += 5If (Keyboard.KeyDown(Key.D)) Then speed.X -= 5For Local index := 0 Until items.LengthLocal item := items[index]item.X += speed.X * 0.05item.Y += speed.Y * 0.05If (item.X < -TeleportDistance) Then item.X = TeleportDistanceIf (item.X > TeleportDistance) Then item.X = -TeleportDistanceIf (item.Y < -TeleportDistance) Then item.Y = TeleportDistanceIf (item.Y > TeleportDistance) Then item.Y = -TeleportDistanceitems[index] = itemNext' start drawing stuffApp.RequestRender()canvas.Clear(Color.Black)' draw the visibility distancecanvas.PushMatrix()canvas.Translate(Width/2, Height/2)canvas.Color = New Color(0.1, 0, 0)canvas.DrawCircle(0, 0, VisibleDistance)canvas.PopMatrix()' draw all of the items' canvas.PushMatrix()' canvas.Translate(Width/2, Height/2)' For Local i := Eachin items' canvas.Color = Color.White' canvas.DrawRect(i.X, i.Y, 2, 2)' Next' canvas.PopMatrix()' draw all of the items within the visibility distance' canvas.PushMatrix()' canvas.Translate(Width/2, Height/2)' For Local i := Eachin items' If Distance(0, 0, i.X, i.Y) < VisibleDistance' canvas.Color = Color.White' Else' canvas.Color = Color.Grey' End' canvas.DrawRect(i.X, i.Y, 2, 2)' Next' canvas.PopMatrix()' draw all of the items but this time apply the visibility fadecanvas.PushMatrix()canvas.Translate(Width/2, Height/2)For Local i := Eachin itemsLocal distance := Distance(0, 0, i.X, i.Y)If distance < VisibleDistanceLocal visibility := Remap(distance, VisibleDistance, VisibleDistanceFade, 0.0, 1.0)If distance < VisibleDistanceFadevisibility = 1Endcanvas.Color = New Color(visibility, visibility, visibility)canvas.DrawRect(i.X, i.Y, 2, 2)EndNextcanvas.PopMatrix()EndEndFunction Distance:Float(x:Float, y:Float, x2:Float, y2:Float)Local dx := x2 - xLocal dy := y2 - yReturn Sqrt(dx * dx + dy * dy)EndFunction Remap:Float(value:Float, firstStart:Float, firstStop:Float, secondStart:Float, secondStop:Float)' For more information: http://monkeycoder.co.nz/forums/topic/math-remapvalue/Return secondStart + (secondStop - secondStart) * ((value - firstStart) / (firstStop - firstStart))EndFunction Main()New AppInstanceNew MyWindowApp.Run()End' Notes' ... canvas.Translate(Width/2, Height/2)' For presentation reasons I want to draw things to the centered of the screen' this is only a rendering matter, it does not affect how the coordinates of the system' work, which are within the limits of -TeleportDistance..TeleportDistance' ... If Distance(0, 0, i.X, i.Y) < VisibleDistance' Assuming that at position 0,0 is the player, and the i.X/Y is the item.Is there any secret to produce games fast? Refactoring and fixing bad code design sucks too much time.
As a sidenote you could do something like this to make the codebase a bit more modular.
Monkey1234567891011121314151617181920Class UnitMethod Do()EndEndClass UnitCollection AbstractGlobal Units:List<Unit> = New List<Unit>Function Init()'...'EndFunction Update()For Local unit := Eachin Unitsunit.DoNextEndEnd' usage:UnitCollection.Init()UnitCollection.Update()You did something like, sudo apt-get g++?
Don’t worry, knowledge is easy to acquire, you only need to take notes on what you want to do and then at some point you might find it somewhere in the internet. Asking at forums helps also because you can get direction on where to look.
For example the problem of the distance is solved like this.
http://www.blitzbasic.com/codearcs/codearcs.php?code=2739
If you are interested to use 3D distance, you can do this:
dx = x2 – x1
dy = y2 – y1
dz = z2 – z1
sqr(dx*dx + dy*dy + dz*dz)Keep up the good work!
mixing 2d with 3d in separate layers
Is this some type of masking? It might be interested technique.
-
AuthorPosts