Just Starting - Economy

User projects written in or related to FreeBASIC.
DCrawshawJr
Posts: 67
Joined: Oct 24, 2009 13:45
Contact:

Just Starting - Economy

Postby DCrawshawJr » Aug 12, 2012 20:20

Hello again! I've decided to dive into the RPG genre again, and it's probably going to be more of a simulation than a storyline-based game.

Check it out at http://dcjrprogramming.blogspot.com/201 ... onomy.html
Lachie Dazdarian
Posts: 2230
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Re: Just Starting - Economy

Postby Lachie Dazdarian » Aug 12, 2012 21:11

I love the idea. Sounds very interesting. I hope you will be able to flesh it out.

I would also appreciate that you include what the current WIP contains, what are controls and what I can do in it ATM. For the next release keep that in mind.

Anyway, the character seems to be slowing and speeding up randomly when I walk.

I hope you will take more care with this RPG to beta-test the game better and remove all gameplay related bugs.
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: Just Starting - Economy

Postby TESLACOIL » Aug 12, 2012 21:56

Quite possibly the pest PC game every created. There are many features, themes and ideas that you could include.

Lords of the Realm II -Intro- 1996
http://www.youtube.com/watch?v=zDiLapH- ... re=related

Let's Play Lords of the Realm II Ep. 12 Rose
http://www.youtube.com/watch?v=r3jNhiLI ... ure=relmfu


Watch some videos and google for screenshots
http://en.wikipedia.org/wiki/Lords_of_the_Realm_II





Graphics Tips

Avoid playschool high contrast colours. The grass is horrendous on the eyes, consider using horizontal lines if you want depth perspective rather top down perspective. If you mix the two perspectives the players brain gets confused and fatigued. Levels of brightness are more important than colour ( thats why we can enjoy B&W films)

Tiling, a cheap trick is to use mono colour tiles and just sprinkle some off colour but on contrast (same lightness) dots & dashes

Take a look at the grass here. Note: if you double the screen resolution the graphics will blend in better, adding noise pixels smooths things nicely when you get the brightness levels close. ( jpeg compression is noisy but looks good for the same reason)
viewtopic.php?f=17&t=20013



When creating a game the user interface and graphics needs plenty of attention. They dont have to be amazing BUT they do have to avoid assaulting the senses. Make screen mock ups in paint. Graphics & UI is not an afterthought...its central to games. There are countless tile sets you can download, tweak or rip off. Plenty of FOSS graphics out there.
DCrawshawJr
Posts: 67
Joined: Oct 24, 2009 13:45
Contact:

Re: Just Starting - Economy

Postby DCrawshawJr » Aug 13, 2012 22:50

All right; I'm a little lost here Lachie...WIP? ATM?

I'm not sure what the problem is with the slowing/speeding up. I confess that I've been using the SLEEP command to delay each frame to account for a given FPS (I admit, I'm guessing at this point what the frame delay should be). I'm thinking there's a better way to do this...any help?

TESLACOIL: Know any good grass tutorials? I've used http://pixel-zone.rpgdx.net/shtml/tutmini-grass.shtml to try to refine my grass tile. Maybe it's a problem with the contrast like you've said, since in the Pixel Zone tutorial, the colors are nearer to each other than what I've got.

All in all, I'm surprised that there's more art than logic that comes into games of this genre. I'm pretty good at fleshing out equations (see my Analog Clock tutorial), but graphics and design has always been my weak point. Once again, thanks for the pointers.
Lachie Dazdarian
Posts: 2230
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Re: Just Starting - Economy

Postby Lachie Dazdarian » Aug 14, 2012 7:23

To me personally the most important aspect of any game is a functioning and challenging gameplay, refined and clean interface and/or controls, bug free and consistent/coherent engine (pretty much the same as functioning and challenging gameplay). The engine can be clunky, the graphics can be amateurish. Just make it all a meaningful, playtested and coherent experience. What bugs me the most are gameplay/controls related bugs. This is something, IMO, that every game designer should attend and master first, if working alone, and then concentrate on graphics and polish. Also, games not properly tested and/or finished by the very developers I refuse to play.

When I said WIP, I meant work in progress. When releasing demos please be so kind to include a small txt file in the package explaining the scope of the demo (what can be done in it and what can't, where it ends) and controls.
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: Just Starting - Economy

Postby TESLACOIL » Aug 14, 2012 22:23

sleep is crap for very short time delays it wobbles badly time wise. Using very long integers and a for next loop delays would be better. You can set a variable at the start of the prog so that all loops are a multiple of this. ADDED > this can be useful for testing and padding out animation loops <

for i = 123456789 to 123456789000 ' the long start number means the loop runs slower and somewhat smoother ive found

expect 200 (P4) to 500 (i7) million empty loops per second so slow is a relative term here * loops per core

dload speedtest7.exe
http://freebasicportal.wikispaces.com/FB+app%27s




Lazy mans Graphics tip

Take all your el lamo eye jarring graphics :-p, load em into m$ paint , save as jpeg 3 or 4 times in a row, this will wash out the colours, then save again as bmp so you can load them back into your prog. Saving as jpeg smooths everything out. If you create a sprite sheet and make that available to download then people can edit the gfx and perhaps save you some work.

Someone else was writing a chess prog, i found a nice set of pieces online, took a screen shot, wrote a pixel scanner, scanned the picture and saved the colours & x,y co ordinates. This data can then be saved in DATA statements or a txt file your main exe reads in. Just another idea.

The Zelda graphics are easy to find online. Google ' legend of zelda sprite sheet '
http://homeworlds.wikispaces.com/file/v ... castle.PNG



Ive just started work on my EPIC space game. One thing i need to do is create a set of game tools that will allow others to easily add multimedia & story line content. It has RPG & economic elements to it as well as combat.
viewtopic.php?f=8&t=20184


I cant code for toffee but my eye and nose is as good as it gets. Im a long time gamer and an Interface freak.
Last edited by TESLACOIL on Aug 16, 2012 17:13, edited 2 times in total.
Lachie Dazdarian
Posts: 2230
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Re: Just Starting - Economy

Postby Lachie Dazdarian » Aug 14, 2012 23:34

Stop giving bad advises on programming, please.
Pritchard
Posts: 5425
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Re: Just Starting - Economy

Postby Pritchard » Aug 15, 2012 5:38

TESLACOIL,

I'm tired of threads being derailed by your presence. I'd gladly ignore you if you didn't just suggest something horrendous. Please edit or remove your post, so I can edit or remove mine, so this thread won't become another ghost town due to you having posted in it.

Calling the operating system's sleep methods are essential for returning resources from the calling program back to the CPU so that it may be utilized by other programs. If you used for loops instead of calling sleep, you have the potential to take up 100% of available CPU resources, an absolutely awful thing, especially on newer computers.

Hard-coding values into the for-loop is just as bad and should, in this case, be considered a bannable offense. Thankfully, our moderators are a lot more level-headed than I am, so you'll probably get away with killing threads for years to come.

So tell me, TESLACOIL, how does it feel?

To get away with murder, that is.
counting_pine
Site Admin
Posts: 5793
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Just Starting - Economy

Postby counting_pine » Aug 15, 2012 12:25

DCrawshawJr wrote:All right; I'm a little lost here Lachie...WIP? ATM?

(WIP = Work in progress, ATM = At the moment, FOSS = Free open-source software)
codeFoil
Posts: 255
Joined: Dec 22, 2011 4:45
Location: United States
Contact:

Re: Just Starting - Economy

Postby codeFoil » Aug 16, 2012 0:47

TESLACOIL wrote: ' the long start number means the loop runs slower and somewhat smoother ive found


Slower? Perhaps if you happen to be converting your loop control variable into a string or involving it in some other manner in the duration of an inner loop, there might be hint of substance to this assertion, but that would only highlight why depending on the timing of execution to create a delay is the most unreliable method available. Since the issue of CPU hogging has already been mentioned, I'll leave that untouched.

Smoother? Again, if the value of your loop control effects the duration of an inner loop, then maybe the smaller proportion of change might be called smoother.

TESLACOIL, I try always to give you the benefit of the doubt, and though I often dislike your style I fight the temptation to argue with you over matters of opinion. Sometimes, though, it really seems like you are baiting others into a fight.
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: Just Starting - Economy

Postby TESLACOIL » Aug 16, 2012 7:22

when i was writing my speedtest.exe programs i found that the start and end values of for next loops altered how fast they completed even when the number of loops was the same. eg 1 to 10 billion was faster than 10 to 20 billion. i think ? it has something to do with the fact that very long numbers require more than 1 byte to be sent to the cpu

...something like that, im guessing the low numbers ie starting from 1 causes first 1 byte of data then 1+ bytes of data to be sent to the cpu or be calculated upon once there

do some for next loop tests yourself, CPU architecture and cache size may also be an influence


Obviously if you have an empty for next loop running its going to hog most or all of one core of the CPU. If for some reason you need a very short time delay, shorter than the sleep command can reliably deliver then you can use a for next loop. There are other methods. Out of interest on a multi core machine FreeBASIC just tends to use one core while the rest lay idle.



The original question posed was this

DCrawshawJr > I'm not sure what the problem is with the slowing/speeding up. I confess that I've been using the SLEEP command to delay each frame to account for a given FPS (I admit, I'm guessing at this point what the frame delay should be). I'm thinking there's a better way to do this...any help?
Pritchard
Posts: 5425
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Re: Just Starting - Economy

Postby Pritchard » Aug 16, 2012 11:34

@TESLACOIL:

Let people who actually know instead of "think" or "guess" answer people's questions, please. Thanks.

@DCrawshawJr:

The timing resolution of most operating systems is within the realm of 10 - 15 ms. You can try increasing this for your app by boosting thread priority, then trying OS-specific sleep/timing methods. Chances are, you'll still end up bogging down your user's system quite a bit, especially with a graphics-intensive program.

The idea of performing CPU operations to pause your program is referred to as a "busy wait". This can be fine in some environments, such as older mobile devices or handheld gaming systems. On all other devices, sleeping and returning execution to the OS is almost always recommended.

Highly accurate and precise timing is not an entirely trivial task, unfortunately. If sleep(16) gets you somewhere in the realm of 60 Hz, you may want to stick with that.

If that's not OK with you and you're interested in using the OS specific APIs, you can try these links:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298(v=vs.85).aspx

http://www.geisswerks.com/ryan/FAQS/timing.html

As you can read from the article, the timer resolution of the CPU has to be set before more advanced timing begins. This makes a simple function call to perform highly accurate timing difficult... The good news, however, is that timeBeginPeriod() should only applies to the application which uses it.

And again, I don't recommend busy waits, especially on machines now which can probably run 10 - 20 instances of your program.
counting_pine
Site Admin
Posts: 5793
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Just Starting - Economy

Postby counting_pine » Aug 16, 2012 12:50

TESLACOIL wrote:when i was writing my speedtest.exe programs i found that the start and end values of for next loops altered how fast they completed even when the number of loops was the same. eg 1 to 10 billion was faster than 10 to 20 billion. i think ? it has something to do with the fact that very long numbers require more than 1 byte to be sent to the cpu

...something like that, im guessing the low numbers ie starting from 1 causes first 1 byte of data then 1+ bytes of data to be sent to the cpu or be calculated upon once there

do some for next loop tests yourself, CPU architecture and cache size may also be an influence

I'll bet this is because you were using 32-bit math, where numbers over 4 billion aren't what you want them to be:

Code: Select all

const as ulongint onebillion = 1e9, tenbillion = 10e9, twentybillion = 20e9

print "64 bit:"
print onebillion
print tenbillion
print twentybillion

print "Truncated to 32 bit:"
print cuint(onebillion)
print cuint(tenbillion)
print cuint(twentybillion)


TESLACOIL, it seems you have a lot of "blind spots" in programming, which means you're likely to say things that are wrong without realising it. So I ask you: please don't try to speak as an authority on programming and don't try to give advice to people on the forum.
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: Just Starting - Economy

Postby TESLACOIL » Aug 16, 2012 16:46

we all have blind spots.....NOTE i wrote i think ? and you wrote I bet , which is not a crime when you are unsure

and If you want a very small time delay, smaller than sleep 10 you could just use an for empty next loop

and If you used ULONGINT you have a wide of values range which can easily be changed by a global variable

This can be very useful thing to do when you are in the process of writing a game...i fail to see any issue whatsoever, wiggling your mouse cursor will load the CPU far more than a sub 1000th of a second empty loop. Granted its not a perfect solution and you don't want to go filling your code with blank loops BUT it can be 'better than sleep' when you are after very short delays, which may or not be what the OP was after, he wasn't abundantly clear but did mention he was using sleep so i mentioned using a for next loop...that is all ( keep panty hose on :-p )

I mentioned in passing using a for next loop as a hard delay (a busy delay) as the OP mentioned he was using the sleep command which can have timing wobbles at very low values of sleep. Precision timing is difficult as mentioned several times above. Maybe swapping the sleep command for a for next loop would highlight or eliminate a particular timing issue. An investigative tool, not necessarily a solution. It does however have its uses...READ ON !

When im doing animations i will often use hard delays, i will insert a for next loop into a code block, where at a later stage i know CPU cycles will be consumed once the actual animation code has been added. This is perhaps a more realistic way to pad out the code in advance than to use the sleep command. This can help you avoid a recode should additional animations start causing a bottleneck down the road.


Sprite footprint

Given the choice of perspective it might be an idea to change the dimensions of the collision box of the main character. I noticed i was head butting the house and coming to a halt even when i was walking in the middle of the road. Collision boxes are often smaller and of a different shape than the visible area of the sprite on screen. A lengthways rectangle collision box placed near the characters feet would be in keeping with the Zeldaesque type perspective. In this way two characters can shake hands without sprite overlap but the character can walk along paths in an east west fashion with out headbutting buildings or artifacts slightly north of their feet placement.

I did like the walking animation, very cute. Its incredibly hard to get the feel of swinging arms and legs when you only have a few pixels to play with and you did just that. The accompanying touch of 'skaters glide' very retro. You might consider adding a delay when moving diagonally. This could be done by taking a smaller diagonal pixel step than when moving horizontally.

If east west speed = 10 then north south should be smaller than 10 and diagonal movements a reflection of these two values. Not essential but it does add realism that is in keeping with the perspective should you wish to do so. Some games do, some games don't.

Ive found that sprite steps of up 10 pixels a time can work, depending on frame-rate, screen resolution and the kind of on screen effect you are after. In cartoons and some games, speed trails are also added to highlight movement, tension or action.

happy skating all
counting_pine
Site Admin
Posts: 5793
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Just Starting - Economy

Postby counting_pine » Aug 16, 2012 20:26

TESLACOIL wrote:we all have blind spots.....NOTE i wrote i think ? and you wrote I bet , which is not a crime when you are unsure

But you're offering speculation when someone is trusting you to give advice. What I said about 32-bit math was true. What I was speculating on whether it happened to be the cause of your problem.

It's not a crime to have a limited knowledge, or to speculate, and indeed it's not even a crime to give bad advice and false information in an unofficial capacity. But the thing is, is that something you would actually want to do?

This is something I've done before. There was a thread a long time ago on sorting algorithms, and I posted what I thought was a quick sort algorithm. It wasn't even close, and I discovered during the course of the thread that I had no idea what I was talking about, even though I thought I did. The thread taught me a thing or two, but for anyone else reading I could have caused bad information to propagate.

My advice to you is to be careful, in the interest of protecting other forum participants from bad ideas. And in your own interest as well, because I don't think you want to mislead people.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 2 guests