Coldcraft!

Here we are now. One day before the final “exam”, doing the blog that needs to be blogged.

Coldcraft! You can see a trailer here.

Well, first I want to say how a hassle it was to develop under the rule of Forge and how much I depended on a library that couldn’t get along with Forge, up to the point we needed to downgrade from Forge for Minecraft 1.8.9 to Minecraft 1.8. And to think that if it was obsolete with 1.8.9, now it is far behind. This happened because when we started developing Minecraft 1.9 was going out in some weeks, and when it was out, it took Forge to update to Minecraft 1.9 more time that we could spare to wait and have the newr versions. This kinda makes me sad, because all the work isn’t truly going to be implemented if the player wants the latest Minecraft version.

It was difficult to understand which methods were needed, because obviously we couldn’t write code and make magic. There wasn’t a complete library documentation, Forge wiki wasn’t a big help either. The most useful resource we had were the Minecraft Forums were I posted some questions, and a basics tutorial by _bedrock_miner.

Now that I’ve finished writing excuses, I will write about the mod itself.

First some links:

  1. Coldcraft Per Diem 1. (For specifications on Load Order, Blocks-Campfire- and textures)
  2. Coldcraft Per Diem 2. (For specifications about PlayerData, GUI, Handlers, Events, Sync, Recipes, Lang, TileEntities -Campfire-, Items -Thermometer-, and others)
  3. Coldcraft Per Diem 3. (Missing)

Coldcraft, as it was written on a previous blog, its a mod for Minecraft(v1.8) using Forge(v11.14.3.1450) and the external library Miner’s Basic(v1.0 – beta build 327). The purpose of the mod is to add temperature to the game. A variable the player needs to consider (And protect itself) when playing, specially if moving trough biomes.

As right now, the mod focuses mostly on cold areas (Still you can die from insolation) and singleplayer only. Every process is made and loaded on the server side (Yes singleplayer has a server side) so it can be adapted fully to multiplayer, but there are several tweaks needed to accomplish fully that capability. The only problem with this during the development (And what delayed us the most) was that we couldn’t show the player any of this data because he is on the client side and everything is managed on the server. We implemented messages between both so everything is synced when a change is registered.

Start and basics

There are 4 types of temperatures in the Mod.

  • Hot biomes (Biome temperature above 1.2): Desert, savanna, mesa, plateau, hell and child biomes.
  • Warm biomes (Biome temperature above 0.5 and below 1.2): Plains, forest, swampland, jungle, river, beach, mushroom and child biomes.
  • Cold biomes (Below 0.5): Extreme hills, taiga, stone beach, the end and child biomes.
  • Very cold biomes (Below 0): Ice plains, cold taiga, frozen river, frozen beach and child biomes.

When a player enters a world the default temperature its registered (37.0°C) and it starts to increase or decrease according to the biome where the player is locates.

  • Hot: Objective temperature of 43°C. Rate of + 0.003°C per tick.
  • Warm: Objective temperature of 37°C. Rate of +/- 0.002°C per tick.
  • Cold: Objective of 29°C. Rate of -0.001°C per tick.
  • Very cold: Objective 29°C. Rate of -0.005°C per tick.

Either the player gets to 43°C or 29°C it will start to receive damage until he dies, or protects itself from the temperature.

Everything mentioned is mostly present on the PlayerData.class. Visit GitHub if you want to analyze completely the code (It has some pretty comments)

Campfire

Animation.gif

A campfire (That’s the name, but it doesn’t look at all as a campfire), it’s a block that provides an area of effect of 4 blocks of heat.

The campfire is crafted with 3 blocks of cobblestone, 2 sticks, 1 flint and steel.

Image 3

This method of protection is just enough to handle the cold biomes, but in a small area. It’s useful if placed in home or making a path with them.

The rate of heat is 0.0011°C per tick, up to 3°C of cold protection

On code, each time the TileEntity Campfire is set to true, the PlayerData general loop takes it into consideration for at the end of the tick make the final addition to the temperature.

Coat armor

Animation2.gif

This green armor, if held completely (Helmet, chestplate, boots) kind of protects the player of the very cold biome’s temperature, but not enough to prevent the freeze.

It provides a rate of heat of 0.004°C per tick with a maximum of 5°C. It should be combined with the campfire to prevent the freeze in very cold biomes. It can be used on cold biomes to fully exceed the biome’s temperature.

On code it’s similar to the campfire. If the coat detects its used completely, lets PlayerData take it into consideration for the final sum per tick.

Thermometer

As seen above, the thermometer (Yeah, that blue redstone, such thermometer, very wow), when right clicked displays a GUI that provides to the user information.

Image 9

The temperature is called from the entity data from the client side, that is obtained from the server side. The same process is used for the biome temperature. This was some of the most difficult tasks to accomplish because of already mentioned reasons. Why they couldn’t make everything on server side? We could have saved some time of coding and a lot of investigation.

Comments

Please, go to GitHub if you want to see more about the code (It’s commented over there) or the Coldcraft Per Diem entries.

Even if the textures have nothing to do with the item, or if the temperature system doesn’t work as well as we would like to, or we didn’t made all of what we proposed at the start (OMG, those are a lot of ors). And apart from all the words I wrote above. We must say that we enjoyed doing this project. I don’t know if we will continue to develop our idea, but the basis is there waiting to be completed.

Oh, and at the moment we figure out how to export the project so it can be used anywhere I will be sharing it.

For more information, you know where to find me… or my team (Santiago Kelley and Arturo Fornes).

Peace.

😀

 

Anuncios

Course review

First I just wanted to say this blog’s photo is mine 😀  I took it for my photography class when doing all black or all white content.

As I think I wrote in some of my first post, I really do prefer self learning, and that is something I liked about this new way of experiencing the course. The problem is that even if I did have the time to do the work and I made all of it, most of the time I left the assignments until the end. I guess that I was missing the pressure of failing or the need to obtain all the point in the partial-term rubric. But that was fixed on the second partial. Still on the first one, I think I’ve self evaluated correctly.

When doing the assignments I got the basic ideas of the related concepts of the course. That isn’t bad, but I feel -as some of my classes did comment- that maybe more assigment could be useful to learn all the capabilities and functionality of the concept I just learned.

Still, that wasn’t a problem, because what wasn’t clear, I assure you, doing my Minecraft-Forge project forced me to understand every concept… all of them, I used all of them coding my mod. And also I learned a lot about Forge (The Minecraft Moding API), and how a hassle it can be, and the importance of documenting everything if and when I do a program, because that is a problem I think Forge did have.

Lastly, I want to congratulate Ken. He made a good and big effort realizing this course. Nothing it’s perfect, but this teaching model is going in the correct path.

I hope I have more courses with this style in the future.

That’s all… You can go now.

Bye… 😀

9
Some rights reserved (CC BY-NC 2.0)

 

Coldcraft Per Diem 2

I got to say… the project had a lot of progress since the last post about it. In fact, I need to see what was included the last time I wrote. Wait please… I’m ready.

As always, the full project is available in GitHub

  • Well lets start it simple. A .lang archive was made to give proper names for our blocks in game. This was needed because the previous test_block did evolve to a campfire, and we didn’t like the in-game name was coldcraft.blocks.tile… and it displays just Campfire.
    Screenshot from 2016-04-25 11-24-39
  • A recipe to the block was added, called ModCrafting.class. It’s simple. The recipe is defined in a pattern. Everything is added to the common load order in the Init phase.
    Screenshot from 2016-04-25 12-10-15
  • The PlayerData.class was made with the objective to create the attribute Temperature. This is a very long class to post and image of everything, so if you want, please click on the link to GitHub to see it all. Still, I will explain it.
    Basically, first some properties of the class are stated, along with the constructor of the extended data of the player, and methods to assign the properties to the player. When calling a method of this class, the id of the entity holding the properties must be provided using: public static PlayerData get(EntityPlayer player)
    Screenshot from 2016-04-25 11-51-34Then we have some methods that save the properties as NBT Data (Where the data regarding of Minecraft is saved). Sadly those doesn’t work as expected or maybe we don’t now what we are doing.
    Then, the interactions are stated. I’m just going to write about the first one (The other hasn’t been tested). campTemperature it’s called by the campfire (Explained below), it increases the temperature by 0.001 per tick until a limit of 6.
    Screenshot from 2016-04-25 11-56-10
    Lastly, setTemperature and getTemperature methods. SyncTemperature is used everytime the temperature is setted. This is needed to actually display and save the temperature. The syncing is handled by a handler (Too complex, I just need to say that is works)
    Screenshot from 2016-04-25 12-00-42
  • The Campfire (Previously named test_block), now it isn’t just a block, is a Tile Entity. This makes available a whole lot of functionality to the block, making available the update() method, which is called every in-game tick so it can do stuff. One important thing is that the block class still exists. This happens on the ModTileEntity.class (Its unique at the moment, thats why the generic name)
    Screenshot from 2016-04-25 11-31-59.pngBasically, each tick Minecraft gets the location of the block, creates an area with a “apothem” of 4 blocks, checks if and entity of the type EntityPlayer (This means it looks for players) is in that area, and if true, calls the campTemperature() method in the Player Extended Properties, which as explained, increases the temperature.
    Screenshot from 2016-04-25 11-36-44And well, as always, the tile (Or anything) must be registered into Forge and Minecraft in the ModTileEntities.class… and into the Forge loading order: The TileEntity is added to the Common Proxy in the preInit, and the regular block and textures stayed the same.
  • A GUI was made to display information about the temperature (GuiTempBar.class), we can call it thermometer. Currently it displays on real-time the temperature, and has a button that closes the interface.
    Screenshot from 2016-04-25 12-25-10.pngScreenshot from 2016-04-25 12-26-24There is also the ModGuiHandler.class (Basically is gives permission to the server and client to display things) and everything is added to the common load order in the Init phase.
  • 4 items were made (3 for testing) in the ModItems.class. The important one is the one that opens the Thermometer/Temperature GUI for the player. Those are added to the common load order in the preInit phase and their textures (which are none) to the client load order in the init phase.
    Screenshot from 2016-04-25 12-14-35.png
    The item uses the event onItemRightClick to do stuff. (More events things explained below)
  • Finally, the EventHandlerCommon.class , here when the player joins to world or changes of map (Ender, Nether or regular) loads the temperature attribute, but it doesn’t quite work, we guess is because the playerID changes sometimes the game starts.
    LivingUpdateEvent.class is an event that happens every tick if a living entity exist. This will be used to update the temperature of the player depending on the biome he exists, for each tick.

I guess it would be nice a photo of the common load order CommomProxy.class:

Screenshot from 2016-04-25 12-40-13.png

And, that is all for now. We are currently working on:

  • Updating the temperature of the player according to the biome.
  • Deal damage
  • Do some armor/sweaters

For more information, you know where to find me… or my team (Santiago Kelley and Arturo Fornes).

Peace.

😀

My thoughts on James Gosling – WSQ13

Next: Triangulation 245: James Gosling interview. James Gosling, creator of Java language (He implemented the language and the virtual machine). My thoughts that I got of the video:

  • Java is born based on the idea that the companies were missing the transition from the usage of components in computers to use them in everything. They thought out of the box and designed a language that would be used in everything.

BTW, the video is missing 50 minutes of content. Don’t know why…

Well…. Now there are no more videos.

“But remember my dear friend: Its not good-bye, oh no, its never good-bye, its see you later (you’re pretty darn awesome)” (Jake Roper Vsauce3’s host):

5662924328_d07f42301b_b
flickr photo by 43158397@N02 https://www.flickr.com/photos/43158397@N02/5662924328 obtained under a Creative Commons (BY)

My thoughts on Ward Cunningham – WSQ12

Well, after watching Triangulation 239: Ward Cunningham the inventor of the wiki, part of the SmallTalk community, contributor to programming patterns, Eclipse and Relic. My thoughts and what I got of the video:

  • “Wikis are a different kind of thinking on the web”. Instead of the typical publication where the reader can’t be also the writer, wikis explodes that concept. The reader is also the core of the writing process, it’s him who writes. The community should work together (Scientists, engineers, artists, anyone in general) to construct “monuments” like Wikipedia, even with its upsides and downsides, but it’s the biggest but simplest archive of information in the web.
  • XP programming. This is got mainly because of Software Engineering Fundaments course with Sherif Kassem. Now evrytime I hear XP Programming, I intermediately think: An agile, fast development, project style. It’s iterative, and there is programmed feedback cycles, it involves a lot of testing. Theres is a lot of process but it can show the works basically from the start (Not like waterfall models, where nothing works until the end).
    The first wiki Cunningham made was an activist site for people interested in computing patterns using XP Programming.
    Among other concepts I’ve learned in Sherif’s class, refactoring, pair programming, testing were also mentioned in the interview.
  • Programming patterns are a solution for a problem that can be used multiple times in design and object oriented programming (SmallTalk was referenced a lot). They showed the relation between classes and objects using CRC Cards.

Well…. that’s everything… for now.

“But remember my dear friend: Its not good-bye, oh no, its never good-bye, its see you later (you’re pretty darn awesome)” (Jake Roper Vsauce3’s host):

1152595430_d7df3245a3_o
flickr photo by kevlar https://www.flickr.com/photos/kevlar/1152595430 obtained under a Creative Commons (BY-NC-ND)

Preparing for partial 2 “exam”

Well, here I am… doing stuff, I want to sleep, but whatever, who needs that?

I do… I really should…

Here we go:

What are inheritance and polymorphism? (Specification and implementation)

  • Inheritance: When I think of inheritance, I think of the keyword “extends”, you know, that thing you put at the new class, when you want it to have all of the superior classes methods and attributes. That is inheritance.
  • Polymorphism: Now, this gets more complicated. It is to inherit a method from a superclass, but only to mostly have it modified in the subclass or in the same class (Overloading and overwriting).

What are overloading and overwriting? How do we implement those in Java?

  • Overriding: It is dynamic because its made between a hierarchy of classes. It implies that the method in the current class is the one being initialized (even if super classes have the same named method). The only way to get the supermethod also initialized is to write super.methodname().
    class Car { makeNoise(System.out.println(“Bruum”))}
    subclass Ferrari { makeNoise(System.out.println(“Big lousy bruum”))}
    Final output: Big lousy broom
  • Overloading: It is static because it can be done in the same class. It ocurrs when two or more methods have the same name, but different arguments (Type or quantity).

What is delegation?

  • To call another method, or even another class to do your chores (Instead of doing it by itself).

What are CRC cards and how do we use them?

  • Stands form Class Responsibility Colaboration. Used to stated how classes work. Its a design that answer to what and with whom the job will get done.

What do you feel are the benefits to object-oriented programming?

  • It provides the tools to create everything! Seriously. As always, if you consider that everything is an object, that means that, to some extent, you can create anything as long as it has characteristics and functions. If it isn’t sufficient to you, because you want still something more specific, you can overwrite and overload until you get exactly what you want.

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

  • I really like the way my dear friend Arturo explained it. I guess I would explaine it as he has done it (The analogy with math dimensions -Luzma’s 4th dimension is really hard- its nice. And also, today I saw Interstellar, so he should add the 5th dimension to his explanation).
    The most difficult for anyone I guess it is the change from simple straight code to a more complex context. In OOP there is no room for code without order. You have a class, with a constructor, several methods, and a main method if needed. Then you have the arena (As defined here) were the objects are created with the required characteristics and do the required stuff. And then you have other classes that contain other objects and you need to find a way to get everything connected without making Java explode, or yourself.

Like a dear YouTuber would say (Jake Roper Vsauce3’s host). I guess I’ll stick to this until I have a proper way to end my posts:

“But remember my dear friend: Its not good-bye, oh no, its never good-bye, its… see you later (you’re pretty darn awesome)

-Miguel

 

 

WSQGraphicsExtra

Well, now into some Graphing basics. I’ve done the MIT exercises that Ken previously had shown us. You should know, dear reader, that my art it’s just going to be as good as that bear of the Flickr artist Orin Zebest ( ;-; )

As always, my code can be found on GitHub. This time just one class, the DrawGraphics, was modified, because the objective of this activity was mainly to teach how to insert objects into the drawing surface, how do the parameters work and how to animate an object. Further I’ve revised the code of the other two classes, it is very similar to previous work I’ve done in Python or JavaScript, so nothing scary there.

Now, here it is the code:

Screenshot from 2016-04-03 23-48-24.png

And the result (OMG a gif!)

optimised.gif

You know how to get in touch, I hope…

Like a dear YouTuber would say (Jake Roper Vsauce3’s host):

“But remember my dear friend: Its not good-bye, oh no, its never good-bye, its see you later (you’re pretty darn awesome)”

2110547610_831a653a7c_b
flickr photo by orinrobertjohn https://www.flickr.com/photos/orinrobertjohn/2110547610 obtained under a Creative Commons (BY)