Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Simon

Pages: 1 ... 146 147 [148] 149 150 ... 275
2206
Tech & Research / Re: Object-oriented design with Simon
« on: May 10, 2017, 11:09:07 PM »
apple-knowing baskets frankly sound like a hack
need to track that [peeling] separately too?
carry my fruits in a tray instead, does the tray now have to copy all the special-casing that the basket is doing?

I assume the work grows too quickly here, yes.

I don't dare to propose a Basket<mainClass, subclass1, subclass2, ...> with compile-time code generation, even when that's probably possible. :lix-suspicious: Maybe this is truly the land for dynamic typing without any static checks at all? But even those raise errors on unsupported methods...

Quote
How does Smalltalk handle [...] still return some sort of default or special value (think null or undefined or similar) for that case?

Most of this is answered by "I erred and Smalltalk doesn't allow it by default." The Smalltalk nil object responds to all messages that the class would normally respond to, and returns the nil object. This looks OK because everything is an object in Smalltalk.

Quote
For languages where it must be done explicitly, it just becomes a matter of if/where/how you want to "hide" the check.

Wise interpretation. The three proposed suggestions happen give the three possible answers: The check can go in the element class, in the client code, or in the container class. I didn't see this! :lix-scared:

Quote
I do agree that the situation you are describing [ie. abstracting out the pattern of "if (supported) dothis() else /* do nothing */"] is not uncommon, and it would probably be useful for commonly used languages to support that case better.

Nnnnn, thanks. :lix-grin:

Quote from: Colorful Arty
create a boolean attribute for Fruit named isCoreable and then give the subclasses of fruit that are coreable the core() function. Then, you can check each fruit, check if its attribute isCoreable is true, then call the method core().

Yep, this looks like a variant of the fat interface. The Fruit class gets some Apple-specific knowledge.

If you define isCoreable in Fruit, and core() only in the subclasses, then you still have to cast in the client code.

Quote
subclasses of Fruit that are coreable implement an interface that lets them be cored. I'm not sure how many languages use interfaces, but Java does, and Python can use abstract classes instead to solve the problem.
Quote
In some cases you can also simplify the manual checking by, for example, requiring fruits to implement an ICoreable interface if it supports coring.  So you just have to check for ICoreable and not more explicitly for specific fruit types.

This is excellent when we don't like to put everything right in base class. The example becomes Banana : Fruit; Orange : Fruit; Apple : Fruit, Coreable.

Defining the Coreable interface is probably wise even if we do it solely for explicit dynamic casting later. Coring seems to be a central concern in our domain, otherwise we wouldn't worry as much about this particular design problem. We can well abstract that into an interface and dynamic-cast to that.



Bonus: Found a webpage with the exact section from Riel's book! I bought the hardcover second-hand last year, it was splendid bedtime reading. At least if you believe that OO is often good. :lix-laugh:

-- Simon

2207
Tech & Research / Re: Object-oriented design with Simon
« on: May 10, 2017, 08:34:24 PM »
Good reply, I googled some more.

Errata: Smalltalk won't let you call nonexistant methods on objects by default, that's a runtime exception. You could redefine the nonexistant-method handler in your classes, but that would be considered a massive hack.

Smalltalk lets you call existant methods on null references, and does nothing. This is much different and doesn't help with the fruit basket problem.

Will come back for the rest!

-- Simon

2208
Tech & Research / Re: Object-oriented design with Simon
« on: May 10, 2017, 03:47:38 PM »
Yes, I like RAII helpers in similar situations. I wrapped target bitmaps or blenders in them, these are Allegro thread-local.

Lix is entirely single-threaded. There is theoretical potential to parallelize: D has all mutable variables thread-local by default, Allegro 5 drawing routines have a global drawing target per thread. But multithreading is daunting and my early dabblings in 2015 to parallelize crashed.

In my application, the drawing context switches so rarely that I'd rather not clutter the GUI elements' interface. But enlarging that interface is a good solution in general.





Fruit basket problem

(Source: Object-Oriented Design Heuristics, by Arthur J. Riel)

You have a class Fruit, with subclasses Apple, Banana, Orange. In particular, Apples know how to core themselves. And there is a container class Basket, this collects Fruit and allows you to insert and iterate over the fruit. We have lots of different fruits in the basket. How do we iterate over the fruits, telling the Apples to core themselves, ignoring other types of fruit?

The Smalltalk solution is that you tell every fruit to core itself. Calling core on a Banana would be legal even if Banana doesn't understand this, and the banana would do nothing. (Wrong, see 2 posts further down.) The problem becomes much harder in D, C++, or Java; here, it's illegal to call core on Fruit. I like strict static analysis and want the compiler to yell at me.

Proposed solutions:

Fat interface: Make an empty method core in Fruit. Override this only in Apple with the meaningful behavior. Call core on every fruit in the Basket. Downside: Fruit gets special knowledge of Apple behavior. But maybe this is the least intrusive solution.

Explicit analysis: dynamic_cast<Apple*> every Fruit*. This returns null if we have a banana or orange. Call core on what casts successfully to Apple. Downsides: The fruit basket problem is far too common. Explicit case analysis everywhere is exactly what OOP tries to avoid. Instead of littering the entire codebase with special-casings, we should centralize all this special-casing in classes Fruit and Apple. We'd get OOP's verbosity without reaping its benefits.

Apple-knowing Basket: Consider Fruit and Apple correctly designed, but Basket ill-suited for our purpose. By definition, the Basket returns Fruit references, and calling core on Fruit is not allowed. Instead, the Basket should privately maintain a list of Fruit references, and, separately, a list of Apple references that point to the same objects as the Fruit list points to. Downsides: What is the Basket's interface to add elements? Will it dynamic-cast, or should Basket's caller make sure he calls addFruit and addApple correctly? What happens if Basket's caller gets their Fruit from a Fruit source that doesn't support this pattern?

-- Simon

2209
Fan Corner / Re: Music from DOS Lemmings, on piano :)
« on: May 10, 2017, 10:34:11 AM »
Nice!

Rainbow Islands has always sounded like a piano piece to me. So relieving to see it. You might have considered to play the middle voice whenever the melody voice pauses, but I assume that jump of the right hand too wide and fast to be practical. Needs 3-4 hands. :D

-- Simon

2210
I haven't got fresh ideas. Both the 0.6 or 0.7.1 brick placement bring design problems.

I'll probably introduce 0.7.1 bricks, with brick doubling on blocker turning  builder. It sounds weird at first, why should you get bonus terrain from the blocker, but the doubling is surprisingly nonintrusive and feels appropriate. The blocked bridge is nicely traversable.

-- Simon

2211
Closed / Re: [sugg] scroll with button instead of edge of screen
« on: May 10, 2017, 01:50:22 AM »
I tested player V10.13.17:bfe87e5 in wine.

The improved egde scrolling feels snappy and good. Very refreshing, makes the game feel modern.

I remapped hold-to-scroll to RMB. Hold-to-scroll feels quick enough for me. The mouse is always kept in the window, that is perfect. I'd always use this hold-to-scroll over edge scrolling.

geoo would probably like to configure it even faster because his mouse is set slow and insensitive.

NL keeps scrolling even after I stop moving the mouse. This feels slippery. I have the map in my mind and habitually hold-to-scroll with one quick, controlled movement to where I want. I'm not 100 % sure if, due to the extra scrolling after I stop moving the mouse, NL overshoots my target, or whether NL has undershot before and now approaches the goal slowly. I believe this extra scrolling overshoots.

NL doesn't freeze the mouse cursor when hold-to-scrolling. Different than what I do in Lix, but NL's behavior is straightforward and simple. Unless you're extremely close to the window edge, you can scroll everywhere in NL. I merely have the hunch that not-freezing is related to the slippery overshooting. What is the basic behavior for NL's hold-to-scroll?

Waiting for mobius's reaction to this hold-to-scroll.

-- Simon

2212
Lix Main / Re: Oriental blocks are confusing for climbers
« on: May 10, 2017, 12:38:10 AM »


I've got the rough work done for the remaining tiles: The bonsai tree, and the red bridges.

I'm not happy with the bonsai tree's stem color, it should match the slightly darker roots and branches. But at least the shapes seem good. That's most important for physics.

But that's all tiles remade for now! Planned course of action:
  • Redesign the bridges. Done, see images in this post.
  • I migrate all Oriental levels in the main Lix repo: Lemforum community pack, NepsterLix, Rubix's levels, multiplayer levels.
  • I merge Raymanni's 3 tilesets.
  • I merge some physics bug fixes from the 2016 backburner, release experimental Lix version.
  • For each pack maintainer (Proxima, Nepster, Rubix), I'll prepare a list of affected levels with Oriental tiles. Pack maintainers check if levels still look OK, are solvable, and prepare a new proof in experimental if needed.
  • Everybody shall complain about physics bugs, tile oddities, etc. in experimental. I love bugs! Tell me the bugs! What is not 100 % perfect? Tell me!
  • Release as stable.
Quote
Looks a lot better! :D

Thanks!

I always feel like my energy is best spent on code. Tilesetting is more exhausting and daunting for me. But this set has been nagging me for years. I'm happy that I tackled it and that geoo even contributed.

-- Simon

2213
NeoLemmix Main / Re: Experimental Releases
« on: May 09, 2017, 01:48:10 PM »
(or "J" in the Lix-like setup).

You asked earlier what players would expect more on RMB: hold-to-scroll or priority invert. My answer was that I didn't know, at least Icho wouldn't use either.

If only one makes it into the default layout, I'll recommend hold-to-scroll on RMB over priority invert on RMB. Reasoning: It's more common to scroll than to assign super-precisely.

-- Simon

2214
I solved Nice Catch on stream, then raced geoo in Cavelems and Classic.

Vod of my play, with geoo's and my voice
Vod of geoo's play

Kieran and Raymanni stayed in chat the entire time, thanks!



geoo won the Cavelem race by 2 minutes, really close. I won the Classic race because geoo didn't want to backroute Richard's Cliff.

The races have been good fun, looking forward to have more!

Ideally, I'd manage to include geoo's broadcast into my own stream, in a corner. I've looked into local RTMP servers, and while I can test-stream to a server running on my own machine, I haven't managed to watch from it yesterday.

Rage sources, sorted by severity, 1 is severest:
  • L2 has abysmal assignment code.
  • L2 has no framestepping, but I'm used to framestepping.
  • Tiring after 3 hours of Jazz runs, then 6 hours of L2 racing.
  • L2 offsets assigned builders and blockers towards the right.
  • Nicely rarely: Unnecessary demand for execution in Kieran's designs. Out of the 25 levels that I played on stream, I suggested at most two easenings of execution, in Spiral Staircase and Bass the Baton. Well done, Kieran, in keeping this number low, I know you kept an eye on this!
-- Simon

2215
Tech & Research / Re: Object-oriented design with Simon
« on: May 05, 2017, 12:45:58 PM »
Lesser of two globals

Mutable global state is a source of bugs; avoid if possible. This is joseki standard knowledge.

But even immutable globals bite you in the ass. The medium font is a global? Let's export things as images that are independent from screen size, then immediately continue to draw to screen afterwards. Maybe add decoration that silently depends on resolution to our unscaled exported image. Load and destroy the independent medium font and the scaled medium font back and forth?

One answer is to wrap this in a drawing context, load and cache multiple drawing contexts lazily. The first time I draw to screen, a context loads the scaled font. The first time I export as image, another context loads the unscaled font.

Switch between these contexts by mutable global state, because it's rare to switch? <_<

-- Simon

2216
Lix Main / Re: Oriental blocks are confusing for climbers
« on: May 03, 2017, 09:07:24 PM »


I recolored the Asian gate, it looks neat in levels now. Used sparingly, it's a nice colorful stamp in levels. geoo drew great bamboo leaves.



-- Simon

2217
General Discussion / Re: Hello hello hello!
« on: May 03, 2017, 03:10:54 PM »
Welcome welcome! Arch! :lix-grin:

Proxima cares a lot about DROD. We've often discussed how the Lemmings and DROD communities grew similar cultures around level design, with lots of peer reviews for backroutes. You can develop most of the pack in private, or test with few community members, or publish incomplete packs early on.

We don't have to declare Lemmings levels as final once they're released. Even the older, stable packs might get occasional updates.

Modern Lemmings shifts away from dexterity and towards pure puzzling too, with framestepping, savestates, and interruptible replays.

-- Simon

2218
Moved Kieran's excellent instructions how to install DOSBox and play L2 to the Help board.

-- Simon

2219
Help & Guides / Re: How to play Lemmings 2 in DOSBox
« on: May 03, 2017, 08:23:45 AM »
Moved to own topic, linked from Quest From Kieran 2.

Excellent and concise, thanks! :lix-grin:

My only :lix-unsure: would be that it plays Lemmings 2 every time you run DOSBox. Maybe that's even good: We're trying to help who has never used DOSBox. Your solution bypasses DOSBox's command prompt entirely, that can be a good idea at first.



Configuring DOSBox for multiple games:
I assume you have all your DOS games in c:\dosgames, e.g., as c:\dosgames\lem2, c:\dosgames\mygame, ... We no longer want to run a single game in autoexec. Instead, we mount the directory of games:
  • Either remove all 3 autoexec lines, replace with
    mount c c:\dosgames
  • Or remove all 3 autoexec lines, and give DOSBox the games directory as a command-line parameter. You can right-click on the Windows shortcut to DOSBox and configure its command:
    your\path\to\dosbox.exe "c:\dosgames"
Run DOSBox, then type:
cd lem2
l2-fix




DOSBox too loud?
mixer master 20:20
Type this at the DOSBox prompt to adjust volume, or add this line to DOSBox's autoexec. Explanation



Lemmings 2 looks for C:\L2:
I ran into this quirk when maintaining several copies of Lemmings 2, one with the default levels, one with user levels.

Problem: Whenever you mount Lemmings 2 in DOSBox such that the emulated game believes there is a directory C:\L2, it will read files from there instead of from its own directory. All your different installations would load the same levels, that's not what we want.

Solution: Maintain multiple installations of Lemmings 2 as c:\dosgames\l2dma, c:\dosgames\l2qfk, ..., then none of them will be mounted as C:\L2 once you mount c:\dosgames to C: in DOSBox.

-- Simon

2220


QFK v6 Egyptian by geoo and Simon -- this stream shows both geoo's and my gameplay. This comes close to ccexplore's with for watching a race live. :lix-grin: Will expire in 14 days.

Thanks for Kieran for joining twitch chat!

In case you had preferred not to make a twitch account: An alternative for chatting during the livestream would have been IRC (irc.quakenet.org #lix and #neolemmix, webchat). We sit there often, even when not streaming.

During streams, twitch is better anyway. It's one chatroom for all viewers, and twitch saves the chat along with the vod for 14 days.

-- Simon

Pages: 1 ... 146 147 [148] 149 150 ... 275