Hamurabi - with C3P file - free - A text-based strategy video game

0 favourites
  • 8 posts
From the Asset Store
8-bit retro-style music and sound effects: 10 loops-able music tracks and 301 individual SFX!
  • https://el3um4s.itch.io/hamurabi

    Hamurabi is a text-based strategy video game of land and resource management. It was first developed under the name The Sumer Game by Doug Dyment in 1968 at Digital Equipment Corporation as a computer game for fellow employee Richard Merrill's newly invented FOCAL programming language.

    The game consists of ten rounds wherein the player, as the ancient Babylonian king Hammurabi, manages how much of their grain to spend on crops for the next round, feeding their people, and purchasing additional land, while dealing with random variations in crop yields and plagues.

    Credits

    • Original Author (1968) : Doug Dyment
    • BASIC Port (1973) : David Ahl (printed in BASIC Computer Games, 1973)
    • CPP Port (2015): Khlle

    Link

    Screenshot

    Link: https://el3um4s.itch.io/hamurabi

  • Intereresting! A local developer also remade Hamurabi, check it out: jonathanlessard.net

  • Thank you alvarop. That's just a little more than an exercise but it was useful to test Javascript and C3.

    The link you showed me is really well done. The ministers add difficulty and interest to the game.

  • Nice work, a true classic.

    How was it integrating the JS into C3, any special tips or tricks along the way?

  • Nice work, a true classic.

    Mikal Thank you!

    How was it integrating the JS into C3, any special tips or tricks along the way?

    I used JS to manage the math part of the game. I left the graphic part to C3.

    For example, to check that the insertion of values ​​is consistent I used js

    To show the screen writing I used c3

    A useful trick, even if fairly trivial, was to use a global object to pass some values ​​between C3 and Js.

    To pass the values ​​I used two JS functions: getValoreVariabile, to get the value.

    function getValoreVariabile(runtime, nomeOggetto, nomeVariabile, position = "first") {
    	if (position == "first") {
    		const obj = runtime.objects[nomeOggetto].getFirstInstance();
    		return obj.instVars[nomeVariabile];
    	} else {
    		const obj = runtime.objects[nomeOggetto].getFirstPickedInstance();
    		return obj.instVars[nomeVariabile];
    	}
    }

    And setValoreVariabile, to set the value.

    function setValoreVariabile(runtime, nomeOggetto, nomeVariabile, value, position = "first") {
    	if (position == "first") {
    		runtime.objects[nomeOggetto].getFirstInstance().instVars[nomeVariabile] = value;	
    	} else {
    		const array = runtime.objects[nomeOggetto].getPickedInstances();
    		array.forEach(function(obj) { obj.instVars[nomeVariabile] = value; });
    	}
    }

    For example, to print the player's statistics, I first calculate everything to JS

    const value = hamurabi.ReportPlayer();

    Then I pass the value to an object c3

    setValoreVariabile(runtime, "HAMURABI_PERSISTENT_MEMORY", "HAMURABI_log", value);

    And finally I leave to C3 the task of writing on screen.

    -> txtLog: Typewriter text HAMURABI_PERSISTENT_MEMORY.Log over 3 seconds

  • Great tips, thank you! I particularly like the global object concept.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oh, interesting, I love the story behind this :)

  • Really nice game. Its the first time i've heard of it.

    I found another really nice version here, https://adventuron.itch.io/hamurabi

    Heres the best i could do.

    The trick seems to be to sacrifice some people when you need to, and sell land.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)