Joe Marshall: Motion without Integration
Planet Lisp
by
1d ago
A game where things move around has equations of motion that describe how objects move. We need to solve these to produce the locations of the objects as a function of time, and we have to do it in lock step real time. Fortunately, we usually don’t need highly realistic models or highly accurate results. Game phyiscs, while inspired by real world physics, can be crude approximations. If the velocity of an object changes over time, we need to integrate the velocity to determine the position. This is typically done with forward Euler integration: the current velocity is multiplied by a small Δt ..read more
Visit website
Joe Marshall: Animation: Two Methods
Planet Lisp
by
1d ago
Animated sprites are much cooler that static ones and really make your game come to life. They are pretty easy to implement, but there are a couple of ways to implement them, and I've seen several projects use the less optimal strategy. The less optimal strategy is straightforward. We keep a time counter in the animated entity and increment it every time we update the entity. When the counter exceeds the amount of time for an animation frame, we advance to the next frame and reset the ticker. (defclass entity () ((animation-ticker :initform 0 :accessor animation-ticker))) (defun entity-ste ..read more
Visit website
Joe Marshall: Statements and Expressions
Planet Lisp
by
6d ago
In some languages, like Lisp and OCaml, every language construct is an expression that returns a value. Other languages, like Java or Python, have two kinds of language constructs: expressions, which combine compositionally and which have return values, and statements, which combine sequentially and which have no return values and thus must operate by side effect. Having statements in your language needlessly makes things more complicated, but language designers seem to want to go much further and add complexity that just seems capricious. You cannot usually use a statement in a context where ..read more
Visit website
Joe Marshall: State Machines
Planet Lisp
by
1w ago
One of the things you do when writing a game is to write little state machines for objects that have non-trivial behaviors. A game loop runs frequently (dozens to hundreds of times a second) and iterates over all the state machines and advances each of them by one state. The state machines will appear to run in parallel with each other. However, there is no guarantee of what order the state machines are advanced, so care must be taken if a machine reads or modifies another machine’s state. CLOS provides a particularly elegant way to code up a state machine. The generic function step! takes a s ..read more
Visit website
Joe Marshall: Plaformer Game Tutorial
Planet Lisp
by
2w ago
I was suprised by the interest in the code I wrote for learning the platformer game. It wasn’t the best Lisp code. I just uploaded what I had. But enough people were interested that I decided to give it a once over. At https://github.com/jrm-code-project/PlatformerTutorial I have a rewrite where each chapter of the tutorial has been broken off into a separate git branch. The code is much cleaner and several kludges and idioticies were removed (and I hope none added ..read more
Visit website
Paolo Amoroso: Testing the Practical Common Lisp code on Medley
Planet Lisp
by
3w ago
When the Medley Interlisp Project began reviving the system around 2020, its Common Lisp implementation was in the state it had when commercial development petered out in the 1990s, mostly prior to the ANSI standard. Back then Medley Common Lisp mostly supported CLtL1 plus CLOS and the condition system. Some patches submitted several years later to bring the language closer to CLtL2 needed review and integration. Aside from these general areas there was no detailed information on what Medley missed or differed from ANSI Common Lisp. In late 2021 Larry Masinter proposed to evaluate the ANSI com ..read more
Visit website
Joe Marshall: You May Not Need That :around Method
Planet Lisp
by
1M ago
I’ve seen this “anti-pattern” a few times in CLOS code. A superclass ’super will have a subclass ’sub and there will be a primary method specialized to the superclass. (defmethod foo ((instance super) arg) (format t "~&Foo called on ~s." arg)) Then I’ll see an :around method defined on the subclass: (defmethod foo :around ((instance sub) arg) (format t "~&Start foo...~%") (call-next-method) (format t "~&End foo.~%")) The intent here is clearly that code in the method specialized on the subclass is invoked “around” the call to the method specialized on the superclass. Bu ..read more
Visit website
Joe Marshall: With- vs. call-with-
Planet Lisp
by
1M ago
In Common Lisp, there are a lot of macros that begin with the word “with-”. These typically wrap a body of code, and establish a context around the execution of the code. In Scheme, they instead have a lot of functions that begin with the words “call-with-”. They typically take a thunk or receiver as an argument, and establish a context around a call to the thunk or receiver. Both of these forms accomplish the same sort of thing: running some user supplied code within a context. The Scheme way accomplishes this without a macro, but “call-with-” functions are rarely used as arguments to higher ..read more
Visit website
Joe Marshall: Porting a Game from Java (update)
Planet Lisp
by
1M ago
I didn’t expect anyone would be interested, so I just pushed the code that I had with little thought about anyone trying to use it. It turns out that some people actually wanted to run it, so I polished off some of the rough edges and made it easier to get working. Feel free to email me if you have questions or suggestions ..read more
Visit website
Eugene Zaikonnikov: EURISKO lives
Planet Lisp
by
1M ago
When I wrote about EURISKO a few years before there hardly was an expectation of a follow-up. The system was a dusty legend with some cynical minds arguing whether it existed in the first place. However, Lenat's death in August last year has unlocked his SAILDART archives account. This has led to a thrilling discovery of both AM and EURISKO sources by WhiteFlame. In a further development, seveno4 has managed to adapt EURISKO to run on Medley Interlisp. While I marveled at the idea of discovery systems before I hadn't even considered ever running EURISKO myself as a possibility. Truly an Indian ..read more
Visit website

Follow Planet Lisp on FeedSpot

Continue with Google
Continue with Apple
OR