Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,190
» Latest member: noah032515
» Forum threads: 21,970
» Forum posts: 22,857

Full Statistics

Online Users
There are currently 748 online users.
» 2 Member(s) | 740 Guest(s)
Applebot, Baidu, Bing, DuckDuckGo, Google, Yandex, das210, seetuvarma5

 
  Microsoft - Teaching 100 teachers: Teenager turns the tables with Minecraft
Posted by: xSicKxBot - 02-26-2020, 08:34 PM - Forum: Windows - No Replies

Teaching 100 teachers: Teenager turns the tables with Minecraft

Namya Joshi, a 13-year-old, loves training teachers.

The seventh grade student has been helping teachers of her school convert their class lessons into interactive Minecraft sessions.

“Minecraft is a great platform. If a child does not like reading books, for example, you can make them in Minecraft and get the child interested,” the student from Sat Paul Mittal School in Ludhiana, says very matter-of-factly.

It all started two years ago when her mother, who is the IT Head at the school, signed up to become a global Minecraft mentor, as a part of Microsoft Innovative Educator program.

“I didn’t know much about Minecraft when I signed up. I had some exposure in our school during Microsoft’s Hour of Code but that was all I knew about it. I started researching about it and was initially shocked to see how a game could be integrated into the school’s curriculum. I wasn’t convinced,” says Monica Joshi, Namya’s mother.

A Microsoft Expert Educator herself, Joshi thought she’d learn how to use Minecraft on her own gradually, but all that changed when one day she found Namya playing with Minecraft: Education Edition, a special edition of the game customized for the classroom environment, on her laptop.

“I’d seen Minecraft installed on my mother’s Windows 10 laptop and started trying it on my own. After understanding the basics, I watched some tutorials and got myself familiar with it,” Namya says with pride.

Recovering from the initial shock, Joshi asked her daughter to create her upcoming lesson in the Minecraft world. It was a creative writing lesson and Namya had to write about her recent trip to the hills. The result convinced Joshi about using Minecraft in her school.



https://www.sickgaming.net/blog/2020/02/...minecraft/

Print this item

  News - Pokémon GO Celebrates Pokémon Day With The Return Of Armored Mewtwo
Posted by: xSicKxBot - 02-26-2020, 08:32 PM - Forum: Nintendo Discussion - No Replies

Pokémon GO Celebrates Pokémon Day With The Return Of Armored Mewtwo


The Pokémon Company and Niantic have already started this year’s Pokémon Day celebrations in Pokémon GO with a limited-time event featuring Armored Mewtwo, Clone Pokémon in Raid Battles and special party-hat Pokémon.

This all ties in with the Netflix debut of Pokémon: Mewtwo Strikes Back—Evolution on Pokémon Day:

Armored Mewtwo will return to Pokémon GO in five-star raids during the Pokémon Day Celebration event, and this time it’ll know the exclusive Charged Attack Psystrike!

The Clone Pokémon include Venusaur, Charizard and Blastoise, and the party hat Pokémon are Pikachu and Eevee. There’ll also be eggs (appearing in one-star raids) that hatch party hat Bulbasaur, Charmander and Squirtle, and there are even shiny variants.

Last but not least is a classic confrontation:

If you’ve ever played Pokémon Red, you might recall the iconic intro sequence that features Nidorino battling Gengar. That beloved moment will be honored during Pokémon GO’s Pokémon Day Celebration in a Raid Day event on Sunday, March 1, 2020, from 2:00 p.m. to 5:00 p.m. in your local time zone.

During this time, Nidorino wearing party hats will be appearing in two-star raids, and party hat–wearing Gengar that know Lick and Psychic will be appearing in four-star raids. If you’re lucky, you might encounter a Shiny Nidorino or Shiny Gengar wearing a party hat!

To out players during this period, you’ll be able to receive up to five Raid Passes at no cost during the Raid Day event by spinning Photo Discs at Gyms.

This event runs from now until 2nd March. Will you be booting up GO on your mobile device to celebrate Pokémon Day? Leave a comment down below.



https://www.sickgaming.net/blog/2020/02/...ed-mewtwo/

Print this item

  News - Samurai Jack Is Back In Battle Through Time, Releases On Switch This Summer
Posted by: xSicKxBot - 02-26-2020, 08:32 PM - Forum: Nintendo Discussion - No Replies

Samurai Jack Is Back In Battle Through Time, Releases On Switch This Summer


Samurai Jack is making a comeback on Nintendo Switch, Xbox One, PlayStation 4 and PC in a brand new video game, due out this summer.

Samurai Jack: Battle Through Time by Adult Swim Games and Japanese developer Soleil Games is a 3D hack-and-slash title based on the popular American animated series, and takes place before Jack’s final fight with Aku – the evil entity that trapped him in alternate timelines.

As the player, it’ll be your job to guide Jack through multiple different timelines to reach Aku and stop him once and for all. Throughout the game, you’ll be able to wield a variety of different weapons – covering both melee and ranged attacks.

The 3D artwork retains the style of animated series and the development team behind the game is comprised of individuals who previously worked on the Ninja Gaiden and Dead or Alive series.

More details about this upcoming release will be revealed by the Samurai Jack series’ creator Genndy Tartakovsky and head writer Darrick Bachman at the Adult Swim PAX East panel later this week.



https://www.sickgaming.net/blog/2020/02/...is-summer/

Print this item

  News - Don’t Miss: A water interaction model for great video game boat physics
Posted by: xSicKxBot - 02-26-2020, 08:30 PM - Forum: Lounge - No Replies

Don’t Miss: A water interaction model for great video game boat physics

Jacques Kerner is a senior software engineer at Avalanche Studios.

We don’t talk enough about vehicle physics for video games. Articles on the net about vehicle physics for video games are few and far between, and are usually about how to get started. A video game vehicle programmer today finds herself or himself in a relative vacuum. Maybe it is because it seems too complicated to explain, or we are ashamed to expose the hacks, simplifications and shortcuts we make compared to ‘proper’ realistic simulations. Whathever the reasons are, video games have unique constraints when it comes to simulating vehicles, and this makes it worth writing about. It is a fascinating subject that mixes physics, camera work, audio, special effects, but also human perception and even psychology.

I chose to start talking about boats because, well, I recently worked on them, but also because I found that their dynamics is not fully understood even at the research level (although a lot is understood). When it is, the models or theories are formulated in such a way that makes them hard to apply directly to video games. Or they require very expensive simulation methods that are practically impossible to control and adapt to the capricious needs of designers and gamers. But it is possible to write a simplified model that captures the important features of a boat. There is definitely an art to it, a scary leap of faith involved and quite a bit of creative physics that would have a Kelvin or a Stokes roll in their graves.

In this series, I present an algorithm for calculating the most important forces acting on a boat in water. The main motivation is to develop a model which captures the major dynamic traits of boats in water, yet avoids resorting to complex and expensive fluid dynamics computation.

I constrain myself to a reasonable performance budget, say less than 1 ms per boat. The model must be robust enough to simulate boats of a wide variety of sizes and shapes evolving in calm to very stormy waters.

The first article in this series will be dealing with hydrostatic forces, but will lay an important foundation for calculating all the other forces involved in this model. The other forces are dynamic forces caused by the motion of the boat relative to the water. They will be the subject of articles to follow.

Buoyancy Force 101


Before I dive in the algorithm itself, I want to review a bit about buoyancy. All we need to be able to do is to calculate the magnitude and point of application of the buoyancy force on an partially submerged body.

When a body is submerged in a fluid, the fluid exerts a force on the surface of the body, due to the pressure in the fluid. The bigger the pressure, the bigger the force. The force is the result of the many water particles in movement in the fluid, colliding against the surface of the body in an elastic way – i.e. like perfect billiard balls. It is a microscopic force, its effect is felt even if the water isn’t flowing in any particular direction (current) or if the boat stays still, and it is therefore called the hydrostatic force. The net force of all these atoms or molecules hitting the surface is perpendicular to the surface. One other thing to note is that the pressure in water increases with depth (on a planet with gravity anyway), because a greater depth implies that more and more water is pressing down with its weight. However pressure doesn’t have a preferred direction in itself, and even if there is no fluid directly above a point in water, the pressure at the point will still be dependent on the overall depth nearby. (*)

The increasing force with depth is very important for buoyancy, because the overall buoyancy force is due to an imbalance in the vertical component of the hydrostatic forces on the surface of a body. The horizontal component of the hydrostatic forces all cancel out. Intuitively, this is because for every given small surface of the (closed) volume, you can always find another small surface facing exactly the opposite direction at the same depth. Since the magnitudes of the hydrostatic forces are the same but applied in opposite directions, they cancel out. On the other hand, the vertical component of the hydrostatic forces do not cancel out at all. Overall, because the volume is closed, surfaces which normal is generally pointing down will be found at greater depths than surfaces which normal is generally pointing up. So the pressure forces on surfaces which normal is pointing down prevail. The pressure force being in the opposite direction to the normal, the resulting force is pointing up and it can be shown [2] that its magnitude is equal to “the weight of the displaced fluid”, meaning the weigth of the volume of the body if it were filled with water.

Now we are still missing one piece of the puzzle: to have everything we need to work on buoyancy, we also need the point of application of the hydrostatic force. The point of application of the buoyancy force is the point with respect to which the moments of all hydrostatic forces cancel out. If we continue reasoning in terms of small elementary surfaces on the submerged body, things become a little less obvious. Since the hydrostatic force gets larger the deeper you go, the point of application of the hydrostatic force on a given non horizontal surface is generally found lower than the center of the surface. As shown in Appendix A, on a submerged triangle, which is particularly useful in games since we tend to triangulate everything, the point of application is always lower than the center. Yet somehow the sum of all the moments of all these forces applied generally lower than the centre of any surface still cancel out around the centroid of the volume. A formal proof of this is found in [2] by applying the Ostrogradsky-Gauss theorem (**), or divergence theorem. It can also be verified numerically. The reason I mention this is that if you were to divide the body in small surfaces, say triangles, and sum all the hydrostatic forces and their moments, you could be tempted to make the simplification to calculate the moments as if the elementary forces on each triange were applied at its center (easy to determine). If you do so however, you will not get the correct result. You will get the correct force, but you will get a residual moment around the center of the volume submerged, and the boat may tip on one side at rest, even on perfectly flat water. This is especially true if you use a low polygon count mesh to reduce performance cost, as the error made on each triangle is then relatively important. On the other hand, if you have many small triangles, the error caused by the simplification will be reduced drastically and the simplification may become acceptable. But there is a trade-off between the complexity of the computation of the correct center and the number of triangles in the hull. Appendix A gives the formula for the location of the point of application of hydrostatic forces on a submerged triangle.

Two ways to flip a boat


In light of what we just reviewed, there are two ways buoyancy forces can be calculated. The volumetric method: by evaluating the volume submerged and determining its centroid. The surfacic method: by determining the surface submerged, and calculating the force applied on it. The two methods, if applied correctly, should give the same result.

Both the volumetric and surfacic methods, without too much approximation, require us to determine the intersection of the water with the hull. This can be intimidating, especially when considering non flat water surface: it sounds expensive and complicated. This may be why the use of simple volume primitives is tempting to many. For instance, spheres: in contrast to intersecting a complex shape with the surface of the water, calculating the volume of a portion of a sphere submerged in water is fast and easy if the water can be approximated as planar around it. It can even be determined analytically, which means that, in theory at least, it is of infinite precision, or as precise as floating point operations will allow (yes, so many puns in this article). It also looks like the volume submerged will change in a continuous, progressive manner as the body moves in and out of the water, and continuity of a physical model is often desirable in games. But approximating the hull of a typical boat with spheres can quickly turn into a nightmare, as many spheres of different sizes may be needed. Because spheres are one of the worst choices for densely packing a volume, you will be left with significant gaps in between the spheres (figure 1). There is an upper bound to how densely the volume can be packed, even with spheres of different radii [5]. The presence of these gaps leads to noticeable irregularities in buoyancy. Spheres can also be made to overlap, but then the volume submerged will be overestimated. Finally, while it is easy to compute the intersection of a planar surface with a sphere, calculating the intersection of a sphere with an arbitrary water surface is much more work, and we might as well try and find a solution to intersecting the hull with water.

Figure 1 – Approximating the volume of a boat with spheres is not the way to go.

The volume of the body could also be voxelized, i.e. approximated by a collection of simple volume primitives like cubes. The voxels which happen to be intersected by water could be further voxelized, till a certain precision is reached. The problem with volume approximations is that they give a (somewhat coarse) answer to the question “what is the amount of water displaced?”, but are pretty much useless in terms of determining the waterline of the object immersed, which is useful for instance for water special effects such as splashes and foam, or for determining the shape of the surface in contact with water, unless you use an obscene amount of them.

Assuming we could compute accurately the surface of the hull submerged in water, we still have the choice between the volumetric and the surfacic approaches. With the volumetric approach, we must close the submerged surface of the hull to form a closed volume, compute its total volume and centroid, and apply the buoyancy force there. With the surfacic approach, we would calculate the hydrostatic pressure forces at each submerged surface element (triangles), and sum their linear and angular impulses around the center of gravity of the body.

The advantage of the surfacic method is that it is not necessary to close the volume, everything is prepared to directly sum forces. With the volumetric approach, the volume submerged could also consist of more than one volume. It’s easy to see in the case of catamaran hulls for instance. But even if the boat doesn’t have holes, the intersection with water could represent two or more volumes to close, and we would have to determine which submerged triangles contribute to which volume, which represents an additional complication to that approach. The surfacic approach is more robust in that respect, as it works regardless of the number and shape of volumes formed and doesn’t require any closing. It is the one I chose for the algorithm.

Structure of the algorithm


I’m now going to outline the structure of the algorithm with some of the key simplifications that allow it to run fast, yet give adequate results.

The first assumption I make is that the surface of the water is described by a triangle mesh of some sort, which vertices move each frame with the motion of the water. It is not always the case of course, but it is always possible to approximate the surface of the water by a triangulated mesh. Later in the article, I describe how to sample the water surface and prepare a triangulated mesh representation for it around the body.

The main objective is to determine the intersection between the surface of the water and the surface of the hull. After seeing the implementation by Edouard Halbert [1], I started by implementing an accurate solution taking into account all cases of the water surface intersecting a triangle. This problem is somewhat complicated because in theory there are lots of ways that a surface can segment a triangle. The surface could cut one triangle in several places, go through the center without intersecting any edges, or submerging any vertices. Each such submerged region needs to be triangulated, but those regions are not necessarily convex, so are harder (and slower) to triangulate. Furthermore, these cases are relatively common. Even in relatively calm waters they are very quickly encountered, and need to be properly handled in a way that doesn’t cause unrealistic discontinuities in the amount of surface considered submerged. After some effort spent implementing a perfectly accurate but very slow intersecting algorithm it became clear that I needed to find ways to simplify the algorithm without sacrificing too much of the general behavior. The algorithm I present here is the result of these simplifications. I will not present details of the first accurate algorithm because it is extremely tedious and boring, and ultimately the optimized algorithm works just fine and runs an order of magnitude faster.

The structure of the optimized algorithm is as follows: the floating body is approximated by a triangulated mesh: the hull. We determine the height above water of each vertex of that hull. If the height above water is negative, the vertex is submerged. Triangles which three vertices are above water are considered to be entirely out of the water. This is a simplification, in reality the water could be above some part of the triangle but below all three vertices, as show in figure 4. Likewise, we consider a triangle to be fully submerged if all three vertices are under the water, even though some part of the water could be sinking under the triangle in some of its area. When only one or two vertices are under water, we cut the triangle into one region under the water and one region over, as shown in figure 2. If the region under the water is not a triangle, we further triangulate it. I am making the bold (and theoretically incorrect) assumption that the surface of the water is cutting the edge only once between a submerged vertex and a vertex out of the water. Figure 3 shows some examples of cases not accurately intersected. We end up with a list of triangles, all of which are under water. We then calculate the hydrostatic and hydrodynamic forces acting on these triangles.

Figure 2 – The 4 simplified cases of triangle intersections with the water patch. From left to right, triangle with respectively 0, 1, 2 and 3 vertices submerged. With 2 vertices submerged we need to further triangulate the part submerged. Notice that the intersection with the water is not exactly accurate. It is due to another simplification which we will explain.

Figure 3 – Three examples of cases mishandled by the optimized algorithm. The red areas denote triangles which should have been considered under water, yet were missed. The two triangles on the left have intersections with the water, but none of their vertices are under water. The triangle in the middle is seen in perspective, it doesn’t even intersect the surface of the water on any of its edges, as the crest of the wave punches through the middle of the triangle. The triangle on the right has two vertices below the water, but the water also leaves the triangle at the edge between these two vertices.

Figure 4 – An example of a case happening often with choppy water. The bigger lower right triangle of the hull is intersected in several regions, one of which does not intersect any edges. Worse than that, the intersected regions could have been concave, making them harder to triangulate quickly. Supporting all such cases consumes both development time and performance at runtime. Ultimately, it is somewhat pointless since, in all rigor, the surface of the water is itself modified by the presence of a boat.

For a boat model, those cases are less important than it seems. The sacrifice in accuracy is not a problem in practice, as long as the size of triangles of the hull is not too big compared to the amplitude and wavelength of the smallest waves we are interested in.

The main advantage of the proposed approach is that all vertices can be processed in a first pass, regardless of which three form a triangle. All the information is then available to process each triangle, which gives rise to 0, 1 or 2 submerged triangles. The triangle intersection part is very simple and fast. Most of the processing lends itself nicely to parallelization if need be. We also know the maximum number of submerged triangles we can get: twice the number of triangles in the body hull. This allows us to pre-allocate all the memory beforehand in a simple array.

In the next section, we present important details of implementation, such as how to approximate the water surface to optimize the water depth query, how exactly to cut a triangle which has only one or two vertices under water and how the buoyancy forces are calculated.

Details of implementation


Water patch


To determine the height above water of each vertex, we need a fast way to determine the position of the water under a given point. Here a lot depends on the way water is simulated in the target game or simulation. If the water is flat or described by a simple function, it may be fast to simply determine the height of the water by directly sampling it or evaluating it, at every query. In other cases though, the algorithm to determine the height of the water is expensive and only a limited number of queries can be made. It is the case of Fast Fourier based methods for instance, such as Tessendorf waves [4]. In such cases, I suggest sampling the water once and for all at equally spaced points around the body, therefore creating a height map which is used for all subsequent height queries. I’ll refer to this height map as thewater patch. The water patch needs to be at least as big as the vertical projection of the body. For instance, you can start with a square water patch which side is as long as the diagonal of the bounding box of the body. As in a traditional height map, the water patch consists of a rectangular area subdivided in bands which form rows and columns, intersecting at square cells (figure 5 and 6). Each cell is itself separated in 2 triangles. For each triangle, we compute the equation of the plane supporting it, which makes it very fast to determine the projection of a point onto it.

Figure 5 – A 4 by 4 water patch and the water line (cyan) seen from below

Figure 6 – A 5 by 5 water patch and the water line (cyan) seen from above

Cutting algorithm


When a triangle has some of its vertices under the water and some over, we need to cut the triangle into a portion which is fully over the water, and a portion fully under the water. There is a way to simplify the cut which is fast to calculate and continuous in behavior. By “continuous in behavior”, I mean that we want to avoid situations where a small change in vertices height introduces sudden large changes in the submerged area. This problem wouldn’t happen if we were accurately cutting the triangles in parts under and parts over the water, it is solely due to the approximation, and we need to find one which behaves nicely. This problem was one of my earlier setbacks, and would sometimes introduce instability in buoyancy where the body would suddenly jump or sink in noticeable ways, ruining the overall effect.

Calculating the hydrostatic forces


Once the cutting algorithm has been run on all triangles of the body’s mesh, we have a list of fully submerged triangles. The buoyancy force acting on the body is the sum of all hydrostatic forces acting on each fully submerged triangle. As far as the linear force is concerned, we can sum only the vertical component of the hydrostatic force since we have seen that the other forces cancel each other. The force on a submerged triangle is:

Remember that applying the hydrostatic force at the center of the triangle instead of at its real center of application results in a residual torque around the center of the volume displaced. If the number of triangles is low and it is important to not get any residual torque, it is necessary to calculate the point of application of the force on the triangle. Appendix A gives the formula for finding the center of application of the hydrostatic force on two types of triangles which base is horizontal, with the apex either pointing up or pointing down. An arbitrary submerged triangle needs to be further cut in two such triangles, and the two sets of hydrostatic force and centers of application are calculated and summed.

Piecing it all together


Figure 10 presents an overview of the algorithm.

Figure 10 – Outline of the algorithm

So we can summarize the structure of the algorithm as follows (we assume that the x/z plane is the horizontal plane and y is the vertical up axis):

  • At each step of the simulation, we update the water patch position to follow the floating body. The water patch does not follow, the vehicle smoothly, as you can see in the animated gif of figure 11. When the boat moves horizontally, it drifts enough from the orginal position that the water patch looses a row (or column) on one side and gains a row (or column) on the opposite side. When this happens, the water patch coordinates (say, its south west corner) changes abruptly from what it was at the preceding step.
  • Once we have determined the water patch coordinates, the water height of the water is sampled or calculated at each grid point.
  • For each cell we have two triangles formed by the points on the grid elevated in the y direction by the height of the water, as in a traditional height map. We compute the plane equations of the triangles thus formed.
  • We then calculate the height above the water of each hull vertex, by determining which triangle it is on top of, and using the plane equation of that triangle
  • For each triangle of the mesh, given the height above the water of each of its vertices, we use the cutting algorithm to produce 0, 1 or 2 submerged triangles
  • We finally iterate the list of submerged triangles to calculate the water forces (hydrostatic and hydrodynamic)

There are of course lots of optimizations we could do. For instance, we could first project the vertices of the hull vertically to determine exactly which cell triangles are involved, and compute the plane equations only for those triangles.

Figure 11 – Dynamic response of a boat subjected to hydrostatic forces only, on perfectly flat water. It would get pretty messy in there with a fishing line. It’s clear that resistance forces play a big role in reality.

Conclusion


This article presents an algorithm for intersecting an arbitrary mesh with the surface of water and for calculating the hydrostatic forces acting on the body described by that mesh. If you were to write a program which does only that, you would get a boat oscillating up and down as if it were on a spring. The boat will be pushed out of the water into the air, then fall because of gravity, dive back in and be pushed out again into the air. What is needed to stabilize the system is damping. The hydrodynamic forces which are the subject of the next article are very effective at damping the system, as they are in reality. But it is possible to cheat and just apply heavy speed based damping in all directions of motion, or especially in the vertical dimension, to get a sense of what you get with the hydrostatic forces as calculated with the algorithm we just described.

Notes


(*) If the pressure were smaller for some reason at a point of a given depth relative to other points at the same depth, water from these neighboring points at the same depth, being subjected to a larger pressure, would flow very quickly to the point with less pressure and reestablish uniform pressure at that depth. The only thing preventing water at a higher pressure at a greater depth from flowing up to a lower pressure at a smaller depth is gravity, which is why there is a gradient of pressure, increasing with depth.

(**) By the way, when taught the theorem in France, it was named the Ostrogradsky theorem. Later I discovered that it was also known as the Gauss theorem. I wonder (half jokingly) if it’s because the French are reluctant to attribute too many theorems to the Germans and, given the choice, will gladly go with the Russian equivalent. Americans favor practicality and avoid the whole debate by simply calling it the divergence theorem.

Appendix A: Hydrostatic Forces on a submerged triangle


To calculate the hydrostatic forces and moments on an arbitrary triangle completely submerged, it is useful to cut the triangle in two smaller triangles, each of which have one edge which is perfectly horizontal. The reason for doing so is that it is much easier to calculate the hydrostatic forces acting on a triangle with a horizontal edge: it can be cut in (practically) rectangular horizontal bands on which surface the pressure is the same everywhere.

References


1Simship. Edouard Halbert. 
2“Buoyancy”. Joel Feldman. 
3Hydrostatic forces on a plane surface 
4Simulating Ocean Water. Jerry Tessendorf. 
5Upper Bounds For Packing Of Spheres Of Several Radii. David De Laat, Fernando Mario De Oliveira Filho, Frank Vallentin.



https://www.sickgaming.net/blog/2020/02/...t-physics/

Print this item

  News - Road to the IGF: Golden Glitch’s Elsinore
Posted by: xSicKxBot - 02-26-2020, 08:30 PM - Forum: Lounge - No Replies

Road to the IGF: Golden Glitch’s Elsinore

This interview is part of our Road to the IGF series. You can find the rest by clicking here.

Elsinore places players in a time-looping vision of Hamlet, having them guide Ophelia through a living, active world as their decisions shape its tragic conclusions.

Gamasutra had a chat with Connor Fallon of Golden Glitch to speak about fleshing out the world of Hamlet with their game, creating a cohesive world that moved outside of the player’s actions, and tasking players with deciding what matters to them rather than what will give them the ‘best’ ending.

We’re Golden Glitch Studios. We’re a group of friends who met online during nights and weekends for six years in order to develop this game. Bios for each of us individually can be found on our website.

We started this project when we were a bunch of chumps fresh out of college that had made some hobby-level games or had done a few internships. Now, a significant portion of us are full-time game developers. We’ve learned a lot over the course of the project about how small game businesses are run, which is a very different experience from the larger-scale development many of us are used to in our day jobs. Elsinore also allowed us to flex some skills we normally wouldn’t in our roles, such as marketing, production, user research, and outsourcing management.

Elsinore was initially started from a “Shakespeare” jam theme in the game development club at Carnegie Mellon University. It began as an Adventure Game Studio prototype and was meant to be a simple branching exploration of Hamlet where the player could try to make different choices to watch the outcome of the plot change. They could replay the game if they wanted to and try different decisions, and there were only a few of them. But we didn’t end up making anything very compelling for that jam week, and we set the project aside for a while.

We picked it back up in 2013 after some of us worked together on a Molyjam summer project, and a lot of the elements that would define the game (like having events that could happen at any point in the time loop if conditions were satisfied) came in then. It went from being more of a choose-your-own adventure to a true simulation game at that point.

The most important development tools we used were the ones we built to support writing the game content and story. Designing and managing the narrative simulation and and its complex moving parts was a major challenge. We built an in-house scripting language for writing Elsinore scenes, which was built in F#.

In addition to the base scripting language, we built various tools to help manage content. Our tools would check for obviously contradictory narrative states – in the way a compiler might check programs for errors – to catch things like “dead characters who could be referred to as living” or “character you are currently in a relationship with responding like they don’t know you.”

In 2011, Groundhog Day-style time loops were not as popular a concept, but a few of us were reading visual novels like Umineko no naku koro ni and watching anime like Steins;Gate – the concept has been popular in Japanese storytelling for much longer. So, when we picked the project back up in 2013, the idea to add time loops into the choice-based Hamlet game sort of made sense.

Many games are essentially time loops in that you try something repeatedly hoping for a different outcome – usually success. The only difference with Elsinore is that information carries over from loop to loop. This allows us to do a few interesting things. For example, we can have characters go through enormous personal change, like the death of a loved one or a reunion of two lovers, which allows us to push them to dramatic extremes in interesting ways. In a more linear game, a player might spend hours waiting for that kind of dramatic character moment. However, we don’t have to actually pay that off in the “long term” narrative because the world gets reset and those characters are effectively wiped clean, so the player can see many interesting character developments in a relatively short time.

The time loop also allows us to develop Ophelia as a character. In one time loop, she might be sharing deeply intimate, warm moments with someone who she knows is capable of doing awful things in other time loops. Her reaction to that is, as you can imagine, complex. Once you understand that someone is capable of both enormous kindness and enormous cruelty, how do you continue to have a relationship with that person? That’s what we try to explore through Ophelia’s views.

Hamlet is one of the best-known stories in western literature. Outside of the Bible, it’s arguable that “to be or not to be” is one of the most widely-known quotes from any text. It’s also a super malleable story; it’s been molded into some very different adaptations like The Lion King, and many people are familiar with the core concept of “young boy seeks revenge against the uncle who killed his father.” Many of us also have a personal interest in taking things which are normally inaccessible, like Shakespeare, and making them understandable and learnable for all kinds of people. This mix of factors made Hamlet a great candidate.

Often at gaming conventions, we’ll meet people who are tagging along with a friend that doesn’t play games themselves. However, they’ll come see the Elsinore booth and get really excited. “I know Shakespeare!” It helps us connect with a totally different type of person.

We also knew we had a great protagonist in Ophelia, who is often ignored or treated as a small side character in many Hamlet adaptations. There’s so much about her personal background, her motivations, and her history with Hamlet that isn’t really expounded upon in the original text, so we thought she would be a great opportunity for us to fill in the blanks.

Our goal with Elsinore was not to seriously modify the world of Hamlet such that it would be unrecognizable to someone who knew the story well. Rather, we did a lot of work to expand and clarify things which are left undiscussed in the original play (Hamlet got captured by pirates? Who was Ophelia’s mother? Why does Horatio describe King Hamlet’s assault on King Fortinbras as though he were a soldier on the battlefield? What was Hamlet like before his father died?) and add our own twist on them. The real major additions are extra characters like Irma and Brit, which helped flesh out an overwhelmingly male cast, and other Shakespearean characters like Othello and Peter Quince.

Additionally, we knew we wanted to make the story accessible to a modern audience. Shakespeare told stories that were intended to appeal to all kinds of audiences, and that has been lost over time. Elsinore was a chance to open the story up once more.

One of the most common sentiments from people after they watch static-story tragedy, like on stage or in film, is “if the characters had only done X, they would have avoided the tragedy.” If the Titanic hadn’t been sailing too fast, it wouldn’t have hit the iceberg. If Romeo had just waited a little longer, Juliet would have awoken. We wanted to put that power of “if I’d done X” into the player’s hands and let them try that resolution for themselves. But the truth is, the world is full of flawed people and circumstances which can’t be so easily solved with quick fixes. This is true of Elsinore, too.

After describing the game to someone for the first time, the most common question we get is “So you’re trying to get the good ending where no one dies?” That question reveals both that people usually know what we’re trying to do, and also that they understand how much of a trope it is for games to have a “correct” path with the “real” ending that is “objectively” better than the other, failure endings. Games have pretty thoroughly trained players to expect a Golden End.

Many people appreciate a game that forces them to instead make decisions about what they value. Elsinore is not about solving a tragedy and making everything okay. It’s about grappling within the free will we all have within the confines of a bad and ultimately-inescapable situation.

The largest difficulty in creating any simulation is maintaining a sense of logic and cohesion. In Elsinore, characters are often forming dramatic plans that won’t make sense if another character is dead, so we need to check for all those cases. Sweeping methods to remove edge cases, like hearsay no longer being presentable if it’s fundamentally invalid, or characters being upset and unwilling to talk to you if you’ve told them something really extreme, were essential in keeping the possibility space manageable.

On the other hand, what’s nice about a simulation is that once you’ve been working on it for a while, solutions start to present themselves. If you already have behavior for Polonius when he’s lost all hope, it makes sense to link into that behavior from other places. The dynamic, shift-able nature of the story elements means we are able to pull in consequences at all sorts of points.



https://www.sickgaming.net/blog/2020/02/...-elsinore/

Print this item

  News - Feature: The Most Relaxing Switch Games – Chill Games For Nintendo Switch
Posted by: xSicKxBot - 02-26-2020, 02:03 PM - Forum: Nintendo Discussion - No Replies

Feature: The Most Relaxing Switch Games – Chill Games For Nintendo Switch

Best Switch Relaxing Games

Tough day at the office? When it comes to getting adrenaline coursing and your pulse racing, there are plenty of video games that fit the bill. Whether battling to recover your humanity in Dark Souls, making it to the final two in a round of Fortnite or going up against a rock-hard retro classic, there are more than enough Switch games to get you red-faced and riled up.

But what if you’re looking to soothe the soul rather than cleave it from a corpse? What if you’re combating stress with some old fashioned R and R? What are the most relaxing games on Switch? Fortunately, the huge library of games on the console has you covered, so if you’re looking for Switch games to help you chill, you’ve come to the right place. Below we’ve assembled a selection of relaxing Switch games to ease your hypertension with a diverting balm that will calm even the most tumultuous of minds.

So if you’ve come home with that vein in your temples bulging, fetch yourself a calming beverage, find a comfy chair and settle down with our picks of the most relaxing Switch games…

Abzu (Switch eShop)Abzu (Switch eShop)

Publisher: 505 Games / Developer: 505 Games

Release Date: 29th Nov 2018 (USA) / 29th Nov 2018 (UK/EU)

If underwater sections in video games instantly get your pulse racing, Abzu is the antidote to the stress of an air meter. This game offers a gentle underwater adventure as you explore the ocean depths at your leisure. The marine delights of Abzu’s seascapes are a treat for the eyes accompanied by a gorgeous orchestral soundtrack, with fabulous 3D sound if you’re playing with headphones. From the art director of Journey, this is a serene experience that should be your first port of call if you’re looking to get away from it all.

GRIS (Switch eShop)GRIS (Switch eShop)

Publisher: Devolver Digital / Developer: Nomada Studio

Release Date: 13th Dec 2018 (USA) / 13th Dec 2018 (UK/EU)

A 2D platformer from Nomada Studio, you journey through a crumbling, monochrome, metaphorical land in GRIS, gradually spreading watercolours as you go on a wonderfully short and sweet adventure. With light puzzling, generous platforming and a dusting of collectibles, this is a touching journey of a young girl running through an incredibly delicate and beautiful world. With an art style that owes much to Ervind Earle, it’s an unmissable experience and perfect if you’re after a Switch game to calm your nerves.

RiME (Switch)RiME (Switch)

Publisher: Grey Box / Developer: Tequila Works

Release Date: 14th Nov 2017 (USA) / 17th Nov 2017 (UK/EU)

When it first released on Switch, lonely 3D adventure RiME wasn’t in great shape performance-wise. It suffered from appalling frame rate hiccups which affected the masterful adventure beneath and made the Switch port difficult to recommend if you had access to the game on any other platform.

However, patches arrived and addressed the most egregious performance issues, and while the frame rate certainly still chugs here and there, the improvements allow the magical game world and environmental puzzles beneath to shine brighter than before, to the extent that RiME on Switch is a much easier recommendation now. If you’re a frame rate purist for whom a solid 30fps is the absolute minimum, you’ll still want to hunt this down elsewhere. If you can stomach the odd drop and see this on sale, though, we’d recommend picking it up if you’re in the market for a calming, beautifully desolate 3D adventure.

Yoku's Island Express (Switch eShop)Yoku's Island Express (Switch eShop)

Publisher: Team 17 / Developer: Villa Gorilla

Release Date: 29th May 2018 (USA) / 29th May 2018 (UK/EU)

Who would have thought pinball and Metroidvania could blend so beautifully? You control Yoku, a beetle postmaster making deliveries around the mystical island of Mokumana. Your beetle buddy is tethered to a ball which flings him around the huge 2D island when launched by the many sets of bumpers and flippers under your control and dotted across the landscape. A novel adventure that combines a colourful game world with a soothing soundtrack, Yoku’s Island Express is a lovely little game which we can’t recommend enough.

Please note that some links on this page are affiliate links, which means if you click them and make a purchase we may receive a small percentage of the sale. Please read our FTC Disclosure for more information.

The Gardens Between (Switch eShop)The Gardens Between (Switch eShop)

Publisher: The Voxel Agents / Developer: The Voxel Agents

Release Date: 20th Sep 2018 (USA) / 20th Sep 2018 (UK/EU)

The Gardens Between presents intricate puzzles solved by rewinding and directing time, and the game is wrapped up in a beautifully charming aesthetic which belies the complexity beneath. A relaxing soundtrack accompanies this unusual puzzler which will gently massage your grey matter as you make your way to the top of various islands and through a bittersweet, wordless narrative courtesy of Australian indie studio The Voxel Agents. The Gardens Between is a rejuvenating balm for your ol’ brainbox and comes recommended.

Stardew Valley (Switch eShop)Stardew Valley (Switch eShop)

Publisher: ConcernedApe / Developer: ConcernedApe

Release Date: 5th Oct 2017 (USA) / 5th Oct 2017 (UK/EU)

Until the arrival of Animal Crossing: New Horizons, the best digital life sim on Switch has to be Stardew Valley. This farm management title channels the classic gameplay of Harvest Moon into a huge retro-inspired experience that will devour your days if you let it. It takes a while to get into, and you definitely get out what you put in, but Stardew Valley has almost limitless layers to uncover and if you’re ready to invest a significant portion of your free time into a charming, calming game experience, there are few better options on Switch right now.



https://www.sickgaming.net/blog/2020/02/...do-switch/

Print this item

  News - Mass Effect Arrives On The Nintendo Switch As A Minecraft Mash-Up Pack
Posted by: xSicKxBot - 02-26-2020, 02:03 PM - Forum: Nintendo Discussion - No Replies

Mass Effect Arrives On The Nintendo Switch As A Minecraft Mash-Up Pack


In 2012, EA and Bioware released Mass Effect 3 on the Wii U. Now, the series is finally making its return to a Nintendo system. Instead of a game release, though, a Mass Effect-themed Mash-Up Pack for Mojang’s hit title Minecraft has been released (again), this time on the Minecraft Marketplace.

This one is similar to previous packs – adding in new themed locations (such as the Mars Base Camp), and a total of 36 new skins from the original trilogy series. You can play as Shepard, Liara, the Illusive Man, Garrus and even Krogans. This mash-up pack also includes custom-made textures, Mass Effect-style menus, and an appropriately-themed soundtrack, based on the third entry in the series.

Here’s a bit extra from the Minecraft website:

I’m Commander Shephard and this my favorite mash-up pack on the Citadel

Will you be revisiting the Mass Effect trilogy series in Minecraft? Leave a comment down below.



https://www.sickgaming.net/blog/2020/02/...h-up-pack/

Print this item

  News - Dragon Ball FighterZ Adds Free DLC Character Trials
Posted by: xSicKxBot - 02-26-2020, 02:03 PM - Forum: Lounge - No Replies

Dragon Ball FighterZ Adds Free DLC Character Trials

With the release of Dragon Ball FighterZ's third season and the upcoming introduction of new characters in the form of the FighterZ Pass 3, Bandai Namco also revealed that DBFZ will get free trials of its paid DLC characters.

The first three characters available for all players--regardless of platform or currently-owned DLC--are the Legendary Super Saiyan Broly (his DBZ model, not the Super version introduced in FighterZ Pass 2), sword-wielding demon Janemba, and Frieza's much-cooler older brother Cooler. All three are playable from February 28 to March 1. Bandai Namco has confirmed that more free DLC trials are coming in the future, though it's unclear if they will always come in threes.

DBFZ's third season is officially underway, and with it comes a bunch of new additions and changes. Alongside balance adjustments and feature inclusions, such as the new Z Assist and Limit-Breaking Power, DLC fighters Kelfa (a fusion between Caulifla and Kale) and Ultra-Instinct Goku (the seventh Goku in the game) are also on the way. Kefla will be available on February 28 (or February 26 if you own the FighterZ Pass 3), while UI Goku joins the roster sometime between March 19 and June 20.

Continue Reading at GameSpot

https://www.gamespot.com/articles/dragon...01-10abi2f

Print this item

  [Tut] Python Re Groups
Posted by: xSicKxBot - 02-26-2020, 12:31 PM - Forum: Python - No Replies

Python Re Groups

This tutorial explains everything you need to know about matching groups in Python’s re package for regular expressions. You may have also read the term “capture groups” which points to the same concept.

As you read through the tutorial, you can also watch the tutorial video where I explain everything in a simple way:



So let’s start with the basics:

Matching Group ()


What’s a matching group?

Like you use parentheses to structure mathematical expressions, (2 + 2) * 2 versus 2 + (2 * 2), you use parentheses to structure regular expressions. An example regex that does this is 'a(b|c)'. The whole content enclosed in the opening and closing parentheses is called matching group (or capture group). You can have multiple matching groups in a single regex. And you can even have hierarchical matching groups, for example 'a(b|(cd))'.

One big advantage of a matching group is that it captures the matched substring. You can retrieve it in other parts of the regular expression—or after analyzing the result of the whole regex matching.

Let’s have a short example for the most basic use of a matching group—to structure the regex.

Say you create regex b?(a.)* with the matching group (a.) that matches all patterns starting with zero or one occurrence of character 'b' and an arbitrary number of two-character-sequences starting with the character 'a'. Hence, the strings 'bacacaca', 'aaaa', '' (the empty string), and 'Xababababab' all match your regex.

The use of the parentheses for structuring the regular expression is intuitive and should come naturally to you because the same rules apply as for arithmetic operations. However, there’s a more advanced use of regex groups: retrieval.

You can retrieve the matched content of each matching group. So the next question naturally arises:

How to Get the First Matching Group?


There are two scenarios when you want to access the content of your matching groups:

  1. Access the matching group in the regex pattern to reuse partially matched text from one group somewhere else.
  2. Access the matching group after the whole match operation to analyze the matched text in your Python code.

In the first case, you simply get the first matching group with the \number special sequence. For example, to get the first matching group, you’d use the \1 special sequence. Here’s an example:

>>> import re
>>> re.search(r'(j.n) is \1','jon is jon')
<re.Match object; span=(0, 10), match='jon is jon'>

You’ll use this feature a lot because it gives you much more expression power: for example, you can search for a name in a text-based on a given pattern and then process specifically this name in the rest of the text (and not all other names that would also fit the pattern).

Note that the numbering of the groups start with \1 and not with \0—a rare exception to the rule that in programming, all numbering starts with 0.

In the second case, you want to know the contents of the first group after the whole match. How do you do that?

The answer is also simple: use the m.group(0) method on the matching object m. Here’s an example:

>>> import re
>>> m = re.search(r'(j.n)','jon is jon')
>>> m.group(1) 'jon'

The numbering works consistently with the previously introduced regex group numbering: start with identifier 1 to access the contents of the first group.

How to Get All Other Matching Groups?


Again, there are two different intentions when asking this question:

  1. Access the matching group in the regex pattern to reuse partially matched text from one group somewhere else.
  2. Access the matching group after the whole match operation to analyze the matched text in your Python code.

In the first case, you use the special sequence \2 to access the second matching group, \3 to access the third matching group, and \99 to access the ninety-ninth matching group.

Here’s an example:

>>> import re
>>> re.search(r'(j..) (j..)\s+\2', 'jon jim jim')
<re.Match object; span=(0, 11), match='jon jim jim'>
>>> re.search(r'(j..) (j..)\s+\2', 'jon jim jon')
>>>

As you can see, the special sequence \2 refers to the matching contents of the second group 'jim'.

In the second case, you can simply increase the identifier too to access the other matching groups in your Python code:

>>> import re
>>> m = re.search(r'(j..) (j..)\s+\2', 'jon jim jim')
>>> m.group(0) 'jon jim jim'
>>> m.group(1) 'jon'
>>> m.group(2) 'jim'

This code also shows an interesting feature: if you use the identifier 0 as an argument to the m.group(0) method, the regex module will give you the contents of the whole match. You can think of it as the first group being the whole match.

Named Groups: (?P<name>…) and (?P=name)


Accessing the captured group using the notation \number is not always convenient and sometimes not even possible (for example if you have more than 99 groups in your regex). A major disadvantage of regular expressions is that they tend to be hard to read. It’s therefore important to know about the different tweaks to improve readability.

One such optimization is a named group. It’s really just that: a matching group that captures part of the match but with one twist: it has a name. Now, you can use this name to access the captured group at a later point in your regular expression pattern. This can improve readability of the regular expression.

import re
pattern = '(?P<quote>["\']).*(?P=quote)'
text = 'She said "hi"'
print(re.search(pattern, text))
# <re.Match object; span=(9, 13), match='"hi"'>

The code searches for substrings that are enclosed in either single or double quotes. You first match the opening quote by using the regex ["\']. You escape the single quote, \' so that the Python regex engine does not assume (wrongly) that the single quote indicates the end of the string. You then use the same group to match the closing quote of the same character (either a single or double quote).

Non-Capturing Groups (?:…)


In the previous examples, you’ve seen how to match and capture groups with the parentheses (...). You’ve learned that each match of this basic group operator is captured so that you can retrieve it later in the regex with the special commands \1, \2, …, \99 or after the match on the matched object m with the method m.group(1), m.group(2), and so on.

But what if you don’t need that? What if you just need to keep your regex pattern in order—but you don’t want to capture the contents of a matching group?

The simple solution is the non-capturing group operation (?: ... ). You can use it just like the capturing group operation ( ... ). Here’s an example:

>>>import re
>>> re.search('(?:python|java) is great', 'python is great. java is great.')
<re.Match object; span=(0, 15), match='python is great'>

The non-capturing group exists with the sole purpose to structure the regex. You cannot use its content later:

>>> m = re.search('(?:python|java) is great', 'python is great. java is great.')
>>> m.group(1)
Traceback (most recent call last): File "<pyshell#28>", line 1, in <module> m.group(1)
IndexError: no such group
>>>

If you try to access the contents of the non-capturing group, the regex engine will throw an IndexError: no such group.

Of course, there’s a straightforward alternative to non-capturing groups. You can simply use the normal (capturing) group but don’t access its contents. Only rarely will the performance penalty of capturing a group that’s not needed have any meaningful impact on your overall application.

Positive Lookahead (?=…)


The concept of lookahead is a very powerful one and any advanced coder should know it. A friend recently told me that he had written a complicated regex that ignores the order of occurrences of two words in a given text. It’s a challenging problem and without the concept of lookahead, the resulting code will be complicated and hard to understand. However, the concept of lookahead makes this problem simple to write and read.

But first things first: how does the lookahead assertion work?

In normal regular expression processing, the regex is matched from left to right. The regex engine “consumes” partially matching substrings. The consumed substring cannot be matched by any other part of the regex.

Figure: A simple example of lookahead. The regular expression engine matches (“consumes”) the string partially. Then it checks whether the remaining pattern could be matched without actually matching it.

Think of the lookahead assertion as a non-consuming pattern match. The regex engine goes from the left to the right—searching for the pattern. At each point, it has one “current” position to check if this position is the first position of the remaining match. In other words, the regex engine tries to “consume” the next character as a (partial) match of the pattern.

The advantage of the lookahead expression is that it doesn’t consume anything. It just “looks ahead” starting from the current position whether what follows would theoretically match the lookahead pattern. If it doesn’t, the regex engine cannot move on. Next, it “backtracks”—which is just a fancy way of saying: it goes back to a previous decision and tries to match something else.

Positive Lookahead Example: How to Match Two Words in Arbitrary Order?


What if you want to search a given text for pattern A AND pattern B—but in no particular order? If both patterns appear anywhere in the string, the whole string should be returned as a match.

Now, this is a bit more complicated because any regular expression pattern is ordered from left to right. A simple solution is to use the lookahead assertion (?.*A) to check whether regex A appears anywhere in the string. (Note we assume a single line string as the .* pattern doesn’t match the newline character by default.)

Let’s first have a look at the minimal solution to check for two patterns anywhere in the string (say, patterns ‘hi’ AND ‘you’).

>>> import re
>>> pattern = '(?=.*hi)(?=.*you)'
>>> re.findall(pattern, 'hi how are yo?')
[]
>>> re.findall(pattern, 'hi how are you?')
['']

In the first example, both words do not appear. In the second example, they do.

Let’s go back to the expression (?=.*hi)(?=.*you) to match strings that contain both ‘hi’ and ‘you’. Why does it work?

The reason is that the lookahead expressions don’t consume anything. You first search for an arbitrary number of characters .*, followed by the word hi. But because the regex engine hasn’t consumed anything, it’s still in the same position at the beginning of the string. So, you can repeat the same for the word you.

Note that this method doesn’t care about the order of the two words:

>>> import re
>>> pattern = '(?=.*hi)(?=.*you)'
>>> re.findall(pattern, 'hi how are you?')
['']
>>> re.findall(pattern, 'you are how? hi!')
['']

No matter which word “hi” or “you” appears first in the text, the regex engine finds both.

You may ask: why’s the output the empty string? The reason is that the regex engine hasn’t consumed any character. It just checked the lookaheads. So the easy fix is to consume all characters as follows:

>>> import re
>>> pattern = '(?=.*hi)(?=.*you).*'
>>> re.findall(pattern, 'you fly high')
['you fly high']

Now, the whole string is a match because after checking the lookahead with ‘(?=.*hi)(?=.*you)’, you also consume the whole string ‘.*’.

Negative Lookahead (?!…)


The negative lookahead works just like the positive lookahead—only it checks that the given regex pattern does not occur going forward from a certain position.

Here’s an example:

>>> import re
>>> re.search('(?!.*hi.*)', 'hi say hi?')
<re.Match object; span=(8, 8), match=''>

The negative lookahead pattern (?!.*hi.*) ensures that, going forward in the string, there’s no occurrence of the substring 'hi'. The first position where this holds is position 8 (right after the second 'h'). Like the positive lookahead, the negative lookahead does not consume any character so the result is the empty string (which is a valid match of the pattern).

You can even combine multiple negative lookaheads like this:

>>> re.search('(?!.*hi.*)(?!\?).', 'hi say hi?')
<re.Match object; span=(8, 9), match='i'>

You search for a position where neither ‘hi’ is in the lookahead, nor does the question mark character follow immediately. This time, we consume an arbitrary character so the resulting match is the character 'i'.

Group Flags (?aiLmsux:…) and (?aiLmsux)


You can control the regex engine with the flags argument of the re.findall(), re.search(), or re.match() methods. For example, if you don’t care about capitalization of your matched substring, you can pass the re.IGNORECASE flag to the regex methods:

>>> re.findall('PYTHON', 'python is great', flags=re.IGNORECASE)
['python']

But using a global flag for the whole regex is not always optimal. What if you want to ignore the capitalization only for a certain subregex?

You can do this with the group flags: a, i, L, m, s, u, and x. Each group flag has its own meaning:


Syntax Meaning
a If you don’t use this flag, the special Python regex symbols \w, \W, \b, \B, \d, \D, \s and \S will match Unicode characters. If you use this flag, those special symbols will match only ASCII characters — as the name suggests.
i If you use this flag, the regex engine will perform case-insensitive matching. So if you’re searching for [A-Z], it will also match [a-z].
L Don’t use this flag — ever. It’s depreciated—the idea was to perform case-insensitive matching depending on your current locale. But it isn’t reliable.
m This flag switches on the following feature: the start-of-the-string regex ‘^’ matches at the beginning of each line (rather than only at the beginning of the string). The same holds for the end-of-the-string regex ‘$’ that now matches also at the end of each line in a multi-line string.
s Without using this flag, the dot regex ‘.’ matches all characters except the newline character ‘\n’. Switch on this flag to really match all characters including the newline character.
x To improve the readability of complicated regular expressions, you may want to allow comments and (multi-line) formatting of the regex itself. This is possible with this flag: all whitespace characters and lines that start with the character ‘#’ are ignored in the regex.

For example, if you want to switch off the differentiation of capitalization, you’ll use the i flag as follows:

>>> re.findall('(?i:PYTHON)', 'python is great')
['python']

You can also switch off the capitalization for the whole regex with the “global group flag” (?i) as follows:

>>> re.findall('(?i)PYTHON', 'python is great')
['python']

Where to Go From Here?


Summary: You’ve learned about matching groups to structure the regex and capture parts of the matching result. You can then retrieve the captured groups with the \number syntax within the regex pattern itself and with the m.group(i) syntax in the Python code at a later stage.

To learn the Python basics, check out my free Python email academy with many advanced courses—including a regex video tutorial in your INBOX.

Join 20,000+ ambitious coders for free!



https://www.sickgaming.net/blog/2020/02/...re-groups/

Print this item

  (Indie Deal) 1C LIMITED Bundle & Autonauts Historical Crackerjack Deal
Posted by: xSicKxBot - 02-26-2020, 12:31 PM - Forum: Deals or Specials - No Replies

1C LIMITED Bundle & Autonauts Historical Crackerjack Deal

1C LIMITED Bundle | 6 Games | 95% OFF
[www.indiegala.com]
Space Rangers searching Through the Woods & BLACKHOLEs for a better deal than this one. Did they find it? Their Fate is Unknown...

Do not miss the special 24h launch deal!

Autonauts at our BEST historical price!
[www.indiegala.com]
Playful, welcoming and charming, while still being complex & inventive. Travel the universe colonising uninhabited planets with the sole goal of setting worlds in motion through the power of automation.
https://youtu.be/W2lAERTfWr4
Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


https://steamcommunity.com/groups/indieg...6945405026

Print this item

 
Latest Threads
Italy Temu ⇶ promo Code [...
Last Post: seetuvarma5
Less than 1 minute ago
Italy Temu ⇶ promo [[“ale...
Last Post: seetuvarma5
2 minutes ago
Iceland Temu ⇶ promo [[“a...
Last Post: seetuvarma5
3 minutes ago
Greece Temu ⇶ promo [[“al...
Last Post: seetuvarma5
4 minutes ago
Georgia Temu ⇶ promo [[“a...
Last Post: seetuvarma5
6 minutes ago
Andorra Temu ⇶ promo [[“a...
Last Post: seetuvarma5
7 minutes ago
Azerbaijan Temu ⇶ promo [...
Last Post: seetuvarma5
8 minutes ago
Mauritius Temu ⇶ promo [[...
Last Post: seetuvarma5
10 minutes ago
[BesT ►{{$100 off}}Temu C...
Last Post: das210
11 minutes ago
Jordan Temu ⇶ promo [[“al...
Last Post: seetuvarma5
12 minutes ago

Forum software by © MyBB Theme © iAndrew 2016